auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private StudentProfileAttributes extractProfileData() { StudentProfileAttributes editedProfile = new StudentProfileAttributes(); editedProfile.googleId = account.googleId; editedProfile.shortName = getRequestParamValue(Const.ParamsNames.STUDENT_SHORT_NAME); editedProfile.email = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_EMAIL); editedProfile.institute = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_INSTITUTION); editedProfile.nationality = getRequestParamValue(Const.ParamsNames.STUDENT_NATIONALITY); editedProfile.gender = getRequestParamValue(Const.ParamsNames.STUDENT_GENDER); editedProfile.moreInfo = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_MOREINFO); editedProfile.pictureKey = ""; validatePostParameters(editedProfile); trimStudentProfileValues(editedProfile); return editedProfile; }

Target:
private StudentProfileAttributes extractProfileData() { StudentProfileAttributes editedProfile = new StudentProfileAttributes(); editedProfile.googleId = account.googleId; editedProfile.shortName = getRequestParamValue(Const.ParamsNames.STUDENT_SHORT_NAME); editedProfile.email = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_EMAIL); editedProfile.institute = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_INSTITUTION); editedProfile.nationality = getRequestParamValue(Const.ParamsNames.STUDENT_NATIONALITY); editedProfile.gender = getRequestParamValue(Const.ParamsNames.STUDENT_GENDER); editedProfile.moreInfo = getRequestParamValue(Const.ParamsNames.STUDENT_PROFILE_MOREINFO); editedProfile.pictureKey = ""; preprocessParameters(editedProfile); validatePostParameters(editedProfile); return editedProfile; }
Source:
public static Map<Role, List<ActionType>> getRolesWhichCanWorkWithAttribute(ActionType actionType, AttributeDefinition attrDef) throws InternalErrorException { String actType = actionType.getActionType().toLowerCase() + "%"; try { Map<Role, List<ActionType>> result = new HashMap<>(); List<Pair<Role, ActionType>> pairs = jdbc.query("select distinct roles.name, action_types.action_type from attributes_authz " + "join roles on attributes_authz.role_id=roles.id " + "join action_types on attributes_authz.action_type_id=action_types.id " + "where attributes_authz.attr_id=? and action_types.action_type like ?", (rs, arg1) -> new Pair<>(Role.valueOf(rs.getString("name").toUpperCase()), ActionType.valueOf(rs.getString("action_type").toUpperCase())), attrDef.getId(), actType); for (Pair<Role, ActionType> pair : pairs) { if (result.containsKey(pair.getLeft())) { List<ActionType> rights = new ArrayList<>(); rights.add(pair.getRight()); rights.addAll(result.get(pair.getLeft())); result.replace(pair.getLeft(), rights); } else { List<ActionType> rights = new ArrayList<>(); rights.add(pair.getRight()); result.put(pair.getLeft(), rights); } } return result; } catch (EmptyResultDataAccessException e) { return new HashMap<>(); } catch (RuntimeException e) { throw new InternalErrorException(e); } }

Target:
public static Map<Role, Set<ActionType>> getRolesWhichCanWorkWithAttribute(ActionType actionType, AttributeDefinition attrDef) throws InternalErrorException { String actType = actionType.getActionType().toLowerCase() + "%"; try { List<Pair<Role, ActionType>> pairs = jdbc.query("select distinct roles.name, action_types.action_type from attributes_authz " + "join roles on attributes_authz.role_id=roles.id " + "join action_types on attributes_authz.action_type_id=action_types.id " + "where attributes_authz.attr_id=? and action_types.action_type like ?", (rs, arg1) -> new Pair<>(Role.valueOf(rs.getString("name").toUpperCase()), ActionType.valueOf(rs.getString("action_type").toUpperCase())), attrDef.getId(), actType); Map<Role, Set<ActionType>> result = new HashMap<>(); for (Pair<Role, ActionType> pair : pairs) { if (result.containsKey(pair.getLeft())) { result.get(pair.getLeft()).add(pair.getRight()); } else { Set<ActionType> rights = new HashSet<>(); rights.add(pair.getRight()); result.put(pair.getLeft(), rights); } } return result; } catch (EmptyResultDataAccessException e) { return new HashMap<>(); } catch (RuntimeException e) { throw new InternalErrorException(e); } }
Source:
private double getPenaltyDistribution(Distribution distribution, double scaleFactor) { int[] result = analyzeDistribution(distribution); int count = result[0]; int top1 = result[1]; int top2 = result[2]; if (scaleFactor == 1d) { return count * (penaltyMaxScale / penaltyMax); } if (top1 != top2) { double penalty = penaltyInfrequentResponse * (1d - scaleFactor) + penaltyMaxScale * scaleFactor; return (count - top1) * (penalty / penaltyMax); } else { double penalty = penaltyNoMajorityResponse * (1d - scaleFactor) + penaltyMaxScale * scaleFactor; return count * (penalty / penaltyMax); } }

Target:
private double getPenaltyDistribution(Distribution distribution, double scaleFactor) { int[] statistics = getStatistics(distribution); int count = statistics[0]; int top1 = statistics[1]; int top2 = statistics[2]; if (scaleFactor == 1d) { return count * (penaltyMaxScale / penaltyMax); } if (top1 != top2) { double penalty = penaltyInfrequentResponse * (1d - scaleFactor) + penaltyMaxScale * scaleFactor; return (count - top1) * (penalty / penaltyMax); } else { double penalty = penaltyNoMajorityResponse * (1d - scaleFactor) + penaltyMaxScale * scaleFactor; return count * (penalty / penaltyMax); } }
Source:
public void testPANBroadcastSerialDataReceiveSubscribedRx16() throws Exception { Mockito.when(rx16Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST_PAN); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx16Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); assertEquals(XBEE_16BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }

Target:
public void testPANBroadcastSerialDataReceiveSubscribedRx16() throws Exception { Mockito.when(rx16Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST_PAN); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx16Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).serialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_16BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
public void beforeAll(ExtensionContext context) { Class<?> testClass = context.getTestClass() .orElseThrow(() -> new ExtensionConfigurationException("TestcontainersExtension is only supported for classes.")); Store store = context.getStore(NAMESPACE); List<TestLifecycleAware> lifecycleAwareContainers = findSharedContainers(testClass) .peek(adapter -> store.getOrComputeIfAbsent(adapter.getKey(), k -> adapter.start())) .filter(this::isTestLifecycleAware) .map(lifecycleAwareAdapter -> (TestLifecycleAware) lifecycleAwareAdapter.container) .collect(toList()); store.put(SHARED_LIFECYCLE_AWARE_CONTAINERS, lifecycleAwareContainers); signalBeforeTestToContainers(lifecycleAwareContainers, testDescriptionFrom(context)); }

Target:
public void beforeAll(ExtensionContext context) { Class<?> testClass = context.getTestClass() .orElseThrow(() -> new ExtensionConfigurationException("TestcontainersExtension is only supported for classes.")); Store store = context.getStore(NAMESPACE); List<StoreAdapter> sharedContainersStoreAdapters = findSharedContainers(testClass); sharedContainersStoreAdapters.forEach(adapter -> store.getOrComputeIfAbsent(adapter.getKey(), k -> adapter.start())); List<TestLifecycleAware> lifecycleAwareContainers = sharedContainersStoreAdapters .stream() .filter(this::isTestLifecycleAware) .map(lifecycleAwareAdapter -> (TestLifecycleAware) lifecycleAwareAdapter.container) .collect(toList()); store.put(SHARED_LIFECYCLE_AWARE_CONTAINERS, lifecycleAwareContainers); signalBeforeTestToContainers(lifecycleAwareContainers, testDescriptionFrom(context)); }
Source:
public <K, V> void assertContainsOnlyKeys(AssertionInfo info, Map<K, V> actual, Iterable<K> keys) { assertNotNull(info, actual); failIfNull(keys); if (actual.isEmpty() && !keys.iterator().hasNext()) { return; } if (!keys.iterator().hasNext()) { throw new IllegalArgumentException(ErrorMessages.iterableOfKeysToLookForIsEmpty()); } final K[] keysAsArray = (K[]) StreamSupport.stream(keys.spliterator(), false).toArray(Object[]::new); compareActualMapAndExpectedKeys(info, actual, keysAsArray); }

Target:
public <K, V> void assertContainsOnlyKeys(AssertionInfo info, Map<K, V> actual, Iterable<K> keys) { final K[] keysAsArray = keys != null ? (K[]) Streams.stream(keys).toArray(Object[]::new) : null; assertContainsOnlyKeys(info, actual, "keys iterable", keysAsArray); }
Source:
private void clearSourceAndTargetFolder() { File sourceDirectory = sourceFolder; for (File sourceFile : sourceDirectory.listFiles()) { sourceFile.delete(); } File targetDirectory = targetFolder; for (File targetFile : targetDirectory.listFiles()) { targetFile.delete(); } }

Target:
public void clearSourceAndTargetFolder() { deleteFiles(sourceFolder); deleteFiles(targetFolder); }
Source:
public void validate() { checkNotNullOrEmpty(configuration.getProjectId(), "project"); checkNotNullOrEmpty(configuration.getZone(), "zone"); checkNotNullOrEmpty(configuration.getCluster(), "cluster"); checkNotNullOrEmpty(configuration.getTable(), "table"); }

Target:
public void validate() { CloudBigtableIO.validate(configuration, configuration.getTableId()); }
Source:
public void initialize(SystemTreeItemModel systemTreeSelectedItem) { super.initialize(systemTreeSelectedItem); getModel().getTemplate().setIsChangable(false); getModel().getVmType().setIsChangable(true); DisksAllocationModel disksAllocationModel = getModel().getDisksAllocationModel(); disksAllocationModel.setIsAliasChangable(true); AsyncDataProvider.getDataCenterById(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { NewTemplateVmModelBehavior behavior = (NewTemplateVmModelBehavior) target; final StoragePool dataCenter = (StoragePool) returnValue; if (dataCenter == null) { disableNewTemplateModel(ConstantsManager.getInstance() .getConstants() .dataCenterIsNotAccessibleMsg()); } else { AsyncDataProvider.getClusterListByService( new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; List<VDSGroup> clusters = (List<VDSGroup>) returnValue; model.setDataCentersAndClusters(model, Arrays.asList(dataCenter), clusters, vm.getVdsGroupId().getValue()); AsyncDataProvider.isSoundcardEnabled(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { getModel().getIsSoundcardEnabled().setEntity(returnValue); initTemplate(); } }, getModel().getHash()), vm.getId()); } }, getModel().getHash()), true, false); } } }, getModel().getHash()), vm.getStoragePoolId()); }

Target:
public void initialize(SystemTreeItemModel systemTreeSelectedItem) { super.initialize(systemTreeSelectedItem); getModel().getTemplate().setIsChangable(false); getModel().getVmType().setIsChangable(true); DisksAllocationModel disksAllocationModel = getModel().getDisksAllocationModel(); disksAllocationModel.setIsAliasChangable(true); AsyncDataProvider.getDataCenterById(new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { NewTemplateVmModelBehavior behavior = (NewTemplateVmModelBehavior) target; final StoragePool dataCenter = (StoragePool) returnValue; if (dataCenter == null) { disableNewTemplateModel(ConstantsManager.getInstance() .getConstants() .dataCenterIsNotAccessibleMsg()); } else { AsyncDataProvider.getClusterListByService( new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object target, Object returnValue) { UnitVmModel model = (UnitVmModel) target; List<VDSGroup> clusters = (List<VDSGroup>) returnValue; model.setDataCentersAndClusters(model, Arrays.asList(dataCenter), clusters, vm.getVdsGroupId().getValue()); initTemplate(); } }, getModel().getHash()), true, false); AsyncDataProvider.isSoundcardEnabled(new AsyncQuery(getModel(), new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { getModel().getIsSoundcardEnabled().setEntity(returnValue); } }, getModel().getHash()), vm.getId()); } } }, getModel().getHash()), vm.getStoragePoolId()); }
Source:
public List<AnnotationTypeInfo> getAnnotations() { return annotations; }

Target:
public List<AnnotationValueInfo> getAnnotations() { return annotations; }
Source:
public ValidationResult networkNameNotUsedAsVdsmName() { List<String> conflictingNetworks = getDbFacade() .getNetworkDao() .getAllForDataCenter(network.getDataCenterId()) .stream() .filter(net -> !net.getId().equals(network.getId())) .filter(net -> net.getVdsmName().equals(network.getName())) .map(net -> net.getName()) .collect(toList()); if (conflictingNetworks.isEmpty()) { return ValidationResult.VALID; } Collection<String> nameReplacements = ReplacementUtils.replaceWith("ConflictingNetworks", conflictingNetworks); nameReplacements.add(getNetworkNameReplacement()); return new ValidationResult(EngineMessage.NETWORK_NAME_USED_AS_INTERFACE_NAME, nameReplacements); }

Target:
public ValidationResult networkNameNotUsedAsVdsmName() { List<String> conflictingNetworks = getDbFacade() .getNetworkDao() .getAllForDataCenter(network.getDataCenterId()) .stream() .filter(net -> !net.getId().equals(network.getId())) .filter(net -> net.getVdsmName().equals(network.getName())) .map(net -> net.getName()) .collect(toList()); if (conflictingNetworks.isEmpty()) { return ValidationResult.VALID; } Collection<String> nameReplacements = ReplacementUtils.replaceWith("ConflictingNetworks", conflictingNetworks); nameReplacements.add(getNetworkNameReplacement()); return new ValidationResult(EngineMessage.NETWORK_NAME_USED_AS_VDSM_INTERFACE_NAME, nameReplacements); }
Source:
public static Properties defaultProperties() { Properties properties = ProfitBricksApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_REGIONS, "de,us"); properties.setProperty(PROPERTY_REGION + ".de.zones", "de/fkb,de/fra"); properties.setProperty(PROPERTY_REGION + ".us.zones", "us/las,us/lasdev"); properties.setProperty(PROPERTY_ZONES, "de/fkb,de/fra,us/las,us/lasdev"); properties.setProperty(PROPERTY_ISO3166_CODES, "DE-BW,DE-HE,US_NV"); properties.setProperty(PROPERTY_REGION + ".de." + ISO3166_CODES, "DE-BW,DE-HE"); properties.setProperty(PROPERTY_REGION + ".us." + ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ZONE + ".de/fkb." + ISO3166_CODES, "DE-BW"); properties.setProperty(PROPERTY_ZONE + ".de/fra." + ISO3166_CODES, "DE-HE"); properties.setProperty(PROPERTY_ZONE + ".us/las." + ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ZONE + ".us/lasdebv." + ISO3166_CODES, "US-NV"); properties.put("jclouds.ssh.max-retries", "7"); properties.put("jclouds.ssh.retry-auth", "true"); long defaultTimeout = 60l * 60l; properties.put(POLL_TIMEOUT, defaultTimeout); properties.put(POLL_PERIOD, 2l); properties.put(POLL_MAX_PERIOD, 2l * 10l); properties.put(PROPERTY_SO_TIMEOUT, 60000 * 5); properties.put(PROPERTY_CONNECTION_TIMEOUT, 60000 * 5); return properties; }

Target:
public static Properties defaultProperties() { Properties properties = ProfitBricksApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_REGIONS, "de,us"); properties.setProperty(PROPERTY_REGION + ".de.zones", "de/fkb,de/fra"); properties.setProperty(PROPERTY_REGION + ".us.zones", "us/las,us/lasdev"); properties.setProperty(PROPERTY_ZONES, "de/fkb,de/fra,us/las,us/lasdev"); properties.setProperty(PROPERTY_ISO3166_CODES, "DE-BW,DE-HE,US_NV"); properties.setProperty(PROPERTY_REGION + ".de." + ISO3166_CODES, "DE-BW,DE-HE"); properties.setProperty(PROPERTY_REGION + ".us." + ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ZONE + ".de/fkb." + ISO3166_CODES, "DE-BW"); properties.setProperty(PROPERTY_ZONE + ".de/fra." + ISO3166_CODES, "DE-HE"); properties.setProperty(PROPERTY_ZONE + ".us/las." + ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ZONE + ".us/lasdev." + ISO3166_CODES, "US-NV"); properties.put("jclouds.ssh.max-retries", "7"); properties.put("jclouds.ssh.retry-auth", "true"); long defaultTimeout = 60l * 60l; properties.put(POLL_TIMEOUT, defaultTimeout); properties.put(POLL_PERIOD, 2l); properties.put(POLL_MAX_PERIOD, 2l * 10l); properties.put(PROPERTY_SO_TIMEOUT, 60000 * 5); properties.put(PROPERTY_CONNECTION_TIMEOUT, 60000 * 5); return properties; }
Source:
private synchronized void connectToCassandra() { Cluster.Builder clusterBuilder = Cluster.builder().addContactPoint(config.getHost()) .withPort(config.getPort().intValue()); keyspace = config.getKeyspace(); table = config.getTable(); if (!Strings.isNullOrEmpty(config.getUser()) && !Strings.isNullOrEmpty(config.getPassword())) { cluster = clusterBuilder.withCredentials(config.getUser(), config.getPassword()).build(); } else { cluster = clusterBuilder.build(); } Metadata metadata = cluster.getMetadata(); if (Objects.isNull(metadata.getKeyspace(keyspace))) { LOGGER.info("Keyspace does not exist. Creating Keyspace", keyspace); Map<String, Object> replication = new HashMap<String, Object>(); replication.put("class", "SimpleStrategy"); replication.put("replication_factor", 1); String createKeyspaceStmt = SchemaBuilder.createKeyspace(keyspace).with() .replication(replication).getQueryString(); cluster.connect().execute(createKeyspaceStmt); } session = cluster.connect(keyspace); KeyspaceMetadata ks = metadata.getKeyspace(keyspace); TableMetadata tableMetadata = ks.getTable(table); if (Objects.isNull(tableMetadata)) { LOGGER.info("Table does not exist in Keyspace {}. Creating Table", table, keyspace); String createTableStmt = SchemaBuilder.createTable(table) .addPartitionKey(config.getPartitionKeyColumn(), DataType.varchar()) .addColumn(config.getColumn(), DataType.blob()).getQueryString(); session.execute(createTableStmt); } createInsertStatement(); }

Target:
private synchronized void connectToCassandra() { Cluster.Builder clusterBuilder = Cluster.builder() .addContactPoints(config.getHost().toArray(new String[config.getHost().size()])) .withPort(config.getPort().intValue()); keyspace = config.getKeyspace(); table = config.getTable(); if (StringUtils.isNotEmpty(config.getUser()) && StringUtils.isNotEmpty(config.getPassword())) { cluster = clusterBuilder.withCredentials(config.getUser(), config.getPassword()).build(); } else { cluster = clusterBuilder.build(); } Metadata metadata = cluster.getMetadata(); if (Objects.isNull(metadata.getKeyspace(keyspace))) { LOGGER.info("Keyspace does not exist. Creating Keyspace", keyspace); Map<String, Object> replication = new HashMap<>(); replication.put("class", "SimpleStrategy"); replication.put("replication_factor", 1); String createKeyspaceStmt = SchemaBuilder.createKeyspace(keyspace).with() .replication(replication).getQueryString(); cluster.connect().execute(createKeyspaceStmt); } session = cluster.connect(keyspace); KeyspaceMetadata ks = metadata.getKeyspace(keyspace); TableMetadata tableMetadata = ks.getTable(table); if (Objects.isNull(tableMetadata)) { LOGGER.info("Table does not exist in Keyspace {}. Creating Table", table, keyspace); String createTableStmt = SchemaBuilder.createTable(table) .addPartitionKey(config.getPartitionKeyColumn(), DataType.varchar()) .addColumn(config.getColumn(), DataType.blob()).getQueryString(); session.execute(createTableStmt); } createInsertStatement(); }
Source:
private String getVideoId(Uri playuri) { if (playuri.getHost().endsWith("youtube.com") || playuri.getHost().endsWith("youtu.be") || playuri.getHost().endsWith("vimeo.com")) { final Pattern pattern; if (playuri.getHost().endsWith("vimeo.com")) { pattern = Pattern.compile("^(?:https?:\\/\\/)?(?:www\\.|player\\.)?vimeo\\.com\\/(?:.*\\/)?(\\d+)(?:\\?.*)?$", Pattern.CASE_INSENSITIVE); } else { pattern = Pattern.compile("^(?:https?:\\/\\/)?(?:www\\.|m\\.)?youtu(?:\\.be|be\\.com)\\/watch\\?(?:.*&)?v=([\\w-]+)(?:&.*)?$", Pattern.CASE_INSENSITIVE); } final Matcher matcher = pattern.matcher(playuri.toString()); if (matcher.matches()) { return matcher.group(1); } } return null; }

Target:
private String getVideoId(Uri playuri) { if (playuri.getHost().endsWith("youtube.com") || playuri.getHost().endsWith("youtu.be") || playuri.getHost().endsWith("vimeo.com")) { final Pattern pattern; if (playuri.getHost().endsWith("vimeo.com")) { pattern = Pattern.compile("^(?:https?:\\/\\/)?(?:www\\.|player\\.)?vimeo\\.com\\/(?:.*\\/)?(\\d+)(?:\\?.*)?$", Pattern.CASE_INSENSITIVE); } else { pattern = Pattern.compile("^(?:https?:\\/\\/)?(?:www\\.|m\\.)?youtu(?:\\.be\\/|be\\.com\\/watch\\?v=)([\\w-]+)(?:[\\?&].*)?$", Pattern.CASE_INSENSITIVE); } final Matcher matcher = pattern.matcher(playuri.toString()); if (matcher.matches()) { return matcher.group(1); } } return null; }
Source:
public void EditorEventTrackingTests_001_verifyEditPageEvent() { CommonUtils.deleteDirectory(PathsContent.harDirPath); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } CommonFunctions.logOut(driver); WikiBasePageObject wiki = new WikiBasePageObject(driver, Global.DOMAIN); wiki.openWikiPage(); CommonFunctions.logInCookie(Properties.userNameStaff, Properties.passwordStaff); WikiArticlePageObject article = wiki.openRandomArticle(); WikiArticleEditMode edit = article.edit(); edit.enableWikiaTracker(); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } EventTrackingVerifier verifier = new EventTrackingVerifier(PathsContent.harDirPath); verifier.verifyEvent("editor-ck*view*edit-page"); verifier.verifyEvent("editor-ck*open*gallery-tool"); }

Target:
public void EditorEventTrackingTests_001_verifyEditPageEvent() { CommonUtils.deleteDirectory(PathsContent.harDirPath); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } CommonFunctions.logOut(driver); WikiBasePageObject wiki = new WikiBasePageObject(driver, Global.DOMAIN); wiki.openWikiPage(); CommonFunctions.logInCookie(Properties.userNameStaff, Properties.passwordStaff); WikiArticlePageObject article = wiki.openRandomArticle(); WikiArticleEditMode edit = article.edit(); edit.enableWikiaTracker(); edit.clickGalleryButton(); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } EventTrackingVerifier verifier = new EventTrackingVerifier(PathsContent.harDirPath); verifier.verifyEvent(EventsContent.editPageEvent); verifier.verifyEvent(EventsContent.openGalleryEvent); }
Source:
protected void startDeltaCounterListener(String strPort, SharedGraphiteHostAnnotator hostAnnotator, SenderTaskFactory senderTaskFactory) { final int port = Integer.parseInt(strPort); registerPrefixFilter(strPort); registerTimestampFilter(strPort); if (httpHealthCheckAllPorts) healthCheckManager.enableHealthcheck(port); new ReportableEntityHandlerFactoryImpl(senderTaskFactory, pushBlockedSamples, flushThreads, () -> validationConfiguration); ReportableEntityHandlerFactory deltaCounterHandlerFactory = new ReportableEntityHandlerFactory() { private Map<HandlerKey, ReportableEntityHandler> handlers = new HashMap<>(); @Override public ReportableEntityHandler getHandler(HandlerKey handlerKey) { return handlers.computeIfAbsent(handlerKey, k -> new DeltaCounterAccumulationHandlerImpl( handlerKey.getHandle(), pushBlockedSamples, senderTaskFactory.createSenderTasks(handlerKey, flushThreads), () -> validationConfiguration, deltaCountersAggregationIntervalSeconds)); } }; WavefrontPortUnificationHandler wavefrontPortUnificationHandler = new WavefrontPortUnificationHandler(strPort, tokenAuthenticator, healthCheckManager, decoderSupplier.get(), deltaCounterHandlerFactory, hostAnnotator, preprocessors.get(strPort)); startAsManagedThread(new TcpIngester(createInitializer(wavefrontPortUnificationHandler, strPort, pushListenerMaxReceivedLength, pushListenerHttpBufferSize, listenerIdleConnectionTimeout), port).withChildChannelOptions(childChannelOptions), "listener-deltaCounter-" + port); }

Target:
protected void startDeltaCounterListener(String strPort, SharedGraphiteHostAnnotator hostAnnotator, SenderTaskFactory senderTaskFactory) { final int port = Integer.parseInt(strPort); registerPrefixFilter(strPort); registerTimestampFilter(strPort); if (httpHealthCheckAllPorts) healthCheckManager.enableHealthcheck(port); ReportableEntityHandlerFactory deltaCounterHandlerFactory = new ReportableEntityHandlerFactory() { private Map<HandlerKey, ReportableEntityHandler> handlers = new HashMap<>(); @Override public ReportableEntityHandler getHandler(HandlerKey handlerKey) { return handlers.computeIfAbsent(handlerKey, k -> new DeltaCounterAccumulationHandlerImpl( handlerKey.getHandle(), pushBlockedSamples, senderTaskFactory.createSenderTasks(handlerKey, flushThreads), () -> validationConfiguration, deltaCountersAggregationIntervalSeconds)); } }; WavefrontPortUnificationHandler wavefrontPortUnificationHandler = new WavefrontPortUnificationHandler(strPort, tokenAuthenticator, healthCheckManager, decoderSupplier.get(), deltaCounterHandlerFactory, hostAnnotator, preprocessors.get(strPort)); startAsManagedThread(new TcpIngester(createInitializer(wavefrontPortUnificationHandler, strPort, pushListenerMaxReceivedLength, pushListenerHttpBufferSize, listenerIdleConnectionTimeout), port).withChildChannelOptions(childChannelOptions), "listener-deltaCounter-" + port); }
Source:
@Override public Single<List<Subtitle>> list(@NonNull final Media media) { return service.login(new String[]{"", "", Locale.getDefault().getLanguage(), USER_AGENT}) .flatMap((Function<LoginResponse, SingleSource<SearchResponse>>) loginResponse -> { List<Object> params = new ArrayList<>(); params.add(loginResponse.getTokem()); params.add(Collections.singletonList(new QuerySearchRequest(media.getTitle()))); return service.search(params); }) .map(SearchResponse::getData) .flatMapObservable(Observable::fromIterable) .groupBy(OpenSubItem::getLanguageCode) .concatMap((Function<GroupedObservable<String, OpenSubItem>, ObservableSource<OpenSubItem>>) observable -> observable.reduce((openSubItem, openSubItem2) -> { int diff = getItemScore(openSubItem2) - getItemScore(openSubItem); if (diff > 0 || diff == 0) { return openSubItem2; } else { return openSubItem; } }).toObservable()) .map(openSubItem -> { Map<String, String> meta = new HashMap<>(1); meta.put(META_DOWNLOAD_LINK, openSubItem.getDownalodLink().replace(".gz", ".srt")); return new Subtitle(openSubItem.getLanguageCode(), openSubItem.getLanguageName(), meta); }) .toSortedList((o1, o2) -> o1.getName().compareTo(o2.getName())); }

Target:
@Override public Single<List<Subtitle>> list(@NonNull final Media media) { return service.login(new String[]{"", "", Locale.getDefault().getLanguage(), USER_AGENT}) .flatMap((Function<LoginResponse, SingleSource<SearchResponse>>) loginResponse -> { List<Object> params = new ArrayList<>(); params.add(loginResponse.getTokem()); params.add(Collections.singletonList(new QuerySearchRequest(media.getTitle()))); return service.search(params); }) .map(SearchResponse::getData) .flatMapObservable(Observable::fromIterable) .groupBy(OpenSubItem::getLanguageCode) .concatMap((Function<GroupedObservable<String, OpenSubItem>, ObservableSource<OpenSubItem>>) observable -> observable.reduce((openSubItem, openSubItem2) -> { int diff = getItemScore(openSubItem2) - getItemScore(openSubItem); if (diff >= 0) { return openSubItem2; } else { return openSubItem; } }).toObservable()) .map(openSubItem -> { Map<String, String> meta = new HashMap<>(1); meta.put(META_DOWNLOAD_LINK, openSubItem.getDownalodLink().replace(".gz", ".srt")); return new Subtitle(openSubItem.getLanguageCode(), openSubItem.getLanguageName(), meta); }) .toSortedList((o1, o2) -> o1.getName().compareTo(o2.getName())); }
Source:
public Color getBackground(Object element) { Security security = Adaptor.adapt(Security.class, element); if(security == null) return null; Attributes attributes = security.getAttributes(); LimitPrice limit = (LimitPrice) attributes.get(attribute); if(limit == null) return null; if(limit.getCompareType() == CompareType.GREATER_OR_EQUAL) { if(security.getLatest().getValue() >= limit.getLimitPrice()) return Colors.GREEN; } else if(limit.getCompareType() == CompareType.SMALLER_OR_EQUAL) { if(security.getLatest().getValue() <= limit.getLimitPrice()) return Colors.RED; } else if(limit.getCompareType() == CompareType.GREATER) { if(security.getLatest().getValue() > limit.getLimitPrice()) return Colors.GREEN; } else if(limit.getCompareType() == CompareType.SMALLER) { if(security.getLatest().getValue() < limit.getLimitPrice()) return Colors.RED; } return null; }

Target:
public Color getBackground(Object element) { Security security = Adaptor.adapt(Security.class, element); if(security == null) return null; Attributes attributes = security.getAttributes(); LimitPrice limit = (LimitPrice) attributes.get(attribute); if(limit == null) return null; SecurityPrice latestSecurityPrice = security.getSecurityPrice(LocalDate.now()); if(latestSecurityPrice == null) return null; switch(limit.getCompareType()) { case GREATER_OR_EQUAL: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.GREEN : null); case SMALLER_OR_EQUAL: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.RED : null); case GREATER: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.GREEN : null); case SMALLER: return (latestSecurityPrice.getValue() >= limit.getValue() ? Colors.RED : null); default: return null; } }
Source:
public static String getTopicProperty(final String topic, final String zkPath, final String propertyName) { KafkaZkClient zkClient = null; try { zkClient = getZkClient(zkPath); final AdminZkClient adminZkClient = new AdminZkClient(zkClient); final Properties topicConfig = adminZkClient.fetchEntityConfig(ConfigType.Topic(), topic); return topicConfig.getProperty(propertyName); } finally { if (zkClient != null) { zkClient.close(); } } }

Target:
public static String getTopicProperty(final String topic, final String zkPath, final String propertyName) { try (KafkaZkClient zkClient = createZkClient(zkPath)) { final AdminZkClient adminZkClient = new AdminZkClient(zkClient); final Properties topicConfig = adminZkClient.fetchEntityConfig(ConfigType.Topic(), topic); return topicConfig.getProperty(propertyName); } }
Source:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (servletLatency == null || !(servletRequest instanceof HttpServletRequest)) { filterChain.doFilter(servletRequest, servletResponse); return; } HttpServletRequest request = (HttpServletRequest) servletRequest; String path = request.getRequestURI(); int lastSlash = StringUtils.ordinalIndexOf(path, "/", pathComponents+1); Histogram.Timer timer = servletLatency .labels(lastSlash == -1 ? path : path.substring(0, lastSlash), request.getMethod()) .startTimer(); try { filterChain.doFilter(servletRequest, servletResponse); } finally { timer.observeDuration(); } }

Target:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (!(servletRequest instanceof HttpServletRequest)) { filterChain.doFilter(servletRequest, servletResponse); return; } HttpServletRequest request = (HttpServletRequest) servletRequest; String path = request.getRequestURI(); Histogram.Timer timer = histogram .labels(getComponents(path), request.getMethod()) .startTimer(); try { filterChain.doFilter(servletRequest, servletResponse); } finally { timer.observeDuration(); } }
Source:
public ParsedRegistryID(String id) { try { id = URLDecoder.decode(id, StandardCharsets.UTF_8.displayName()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } List<String> textSegments = Splitter.on('/').omitEmptyStrings().splitToList(id); List<String> list = new ArrayList<>(textSegments); String firstTextSegment = list.get(0); if (WORKFLOW_PREFIX.equalsIgnoreCase(firstTextSegment) || SERVICE_PREFIX.equals(firstTextSegment)) { list.remove(0); tool = false; } checkToolId(list); registry = list.get(0); organization = list.get(1); name = list.get(2); toolName = list.size() > SEGMENTS_IN_ID ? list.get(SEGMENTS_IN_ID) : ""; }

Target:
public ParsedRegistryID(String id) { try { id = URLDecoder.decode(id, StandardCharsets.UTF_8.displayName()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } List<String> textSegments = Splitter.on('/').omitEmptyStrings().splitToList(id); List<String> list = new ArrayList<>(textSegments); String firstTextSegment = list.get(0); if (WORKFLOW_PREFIX.equalsIgnoreCase(firstTextSegment) || SERVICE_PREFIX.equalsIgnoreCase(firstTextSegment)) { list.remove(0); tool = false; } checkToolId(list); registry = list.get(0); organization = list.get(1); name = list.get(2); toolName = list.size() > SEGMENTS_IN_ID ? list.get(SEGMENTS_IN_ID) : ""; }
Source:
public void stop() { serverAnnouncer.unannounce(); if (fireChiefExecutor != null) { fireChiefExecutor.shutdownNow(); } }

Target:
public void stop() { stopping = true; try { if (fireChiefExecutor != null) { fireChiefExecutor.shutdownNow(); Preconditions.checkState( fireChiefExecutor.awaitTermination(10, TimeUnit.SECONDS), "persistExecutor not terminated" ); } } catch (InterruptedException e) { throw new ISE(e, "Failed to shutdown fireChiefExecutor during stop()"); } serverAnnouncer.unannounce(); }
Source:
public void refreshHooks() { log.debug("Refreshing hooks list"); List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (!cluster.supportsGlusterService() && GlusterFeatureSupported.glusterHooks(cluster.getcompatibility_version())) { break; } List<VDS> upServers = getClusterUtils().getAllUpServers(cluster.getId()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : upServers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue =runVdsCommand(VDSCommandType.GlusterHooksList, new VdsIdVDSCommandParametersBase(upServer.getId())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); addOrUpdateHooks(cluster.getId(), pairResults); } }

Target:
public void refreshHooks() { log.debug("Refreshing hooks list"); List<VDSGroup> clusters = getClusterDao().getAll(); for (VDSGroup cluster : clusters) { if (!supportsGlusterHookFeature(cluster)) { continue; } List<VDS> upServers = getClusterUtils().getAllUpServers(cluster.getId()); List<Callable<Pair<VDS, VDSReturnValue>>> taskList = new ArrayList<Callable<Pair<VDS, VDSReturnValue>>>(); for (final VDS upServer : upServers) { taskList.add(new Callable<Pair<VDS, VDSReturnValue>>() { @Override public Pair<VDS, VDSReturnValue> call() throws Exception { VDSReturnValue returnValue =runVdsCommand(VDSCommandType.GlusterHooksList, new VdsIdVDSCommandParametersBase(upServer.getId())); return new Pair<VDS, VDSReturnValue>(upServer, returnValue); } }); } List<Pair<VDS, VDSReturnValue>> pairResults = ThreadPoolUtil.invokeAll(taskList); addOrUpdateHooks(cluster.getId(), pairResults); } }
Source:
private void exitATCommandMode() { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); try { connectionInterface.writeData(COMMAND_MODE_EXIT.getBytes()); Thread.sleep(DEFAULT_GUARD_TIME); } catch (IOException e) { logger.error(e.getMessage(), e); } catch (InterruptedException e) { logger.error(e.getMessage(), e); } }

Target:
private void exitATCommandMode() { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); try { connectionInterface.writeData(COMMAND_MODE_EXIT.getBytes()); Thread.sleep(DEFAULT_GUARD_TIME); } catch (IOException | InterruptedException e) { logger.error(e.getMessage(), e); } }
Source:
@Test public void allowRunOverrides() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { DockerTestUtil.assumeDocker(); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " withDockerContainer(args: '--entrypoint top', image: 'ubuntu') {\n" + " sh 'cat /proc/1/cmdline'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); story.j.assertLogContains("top", b); } }); }

Target:
@Test public void allowRunOverrides() throws Exception { story.addStep(new Statement() { @Override public void evaluate() throws Throwable { DockerTestUtil.assumeDocker(); WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " withDockerContainer(args: '--entrypoint /sbin/init', image: 'ubuntu') {\n" + " sh 'grep /sbin/init /proc/1/cmdline'\n" + " }\n" + "}", true)); WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); } }); }
Source:
public void waitForNextAttempt() throws InterruptedException { log.debug("Sleeping for {}ms before retrying operation", currentWait); sleep(currentWait); waitIncrement *= waitFactor; currentWait = Math.min(maxWait, currentWait + waitIncrement); }

Target:
public void waitForNextAttempt() throws InterruptedException { double waitFactor = (1 + (rand.nextDouble() - 0.5) / 10.0) * currentBackOffFactor; if (!doTimeJitter) waitFactor = currentBackOffFactor; currentBackOffFactor = currentBackOffFactor * backOffFactor; log.debug("Sleeping for {}ms before retrying operation", currentWait); sleep(currentWait); if (backOffFactor == 1) currentWait = Math.min(maxWait, currentWait + waitIncrement); else if (backOffFactor > 1.0) { waitIncrement = (long) (Math.ceil(waitFactor * this.initialWait)); currentWait = Math.min(maxWait, initialWait + waitIncrement); } }
Source:
public IComposedStyledString getStyledName() { final IStyledString.IComposedStyledString ret = new ComposedStyledString(getName()); int unresolvedRealDiffs = Iterables.size(Iterables.filter(getDifferences(), unresolvedReal)); int unresolvedPseudoDiffs = Iterables.size(Iterables.filter(getDifferences(), unresolvedPseudo)); ret.append(" [" + unresolvedRealDiffs + " real and " + unresolvedPseudoDiffs + " pseudo unresolved difference", Style.DECORATIONS_STYLER); if (unresolvedRealDiffs + unresolvedPseudoDiffs > 1) { ret.append("s", Style.DECORATIONS_STYLER); } ret.append("]", Style.DECORATIONS_STYLER); return ret; }

Target:
public IComposedStyledString getStyledName() { final IStyledString.IComposedStyledString ret = new ComposedStyledString(getName()); int unresolvedRealDiffs = Iterables.size(Iterables.filter(getDifferences(), and( hasState(DifferenceState.UNRESOLVED), hasConflict(ConflictKind.REAL)))); int unresolvedPseudoDiffs = Iterables.size(Iterables.filter(getDifferences(), and( hasState(DifferenceState.UNRESOLVED), hasConflict(ConflictKind.PSEUDO)))); ret.append(" [" + unresolvedRealDiffs + " real and " + unresolvedPseudoDiffs + " pseudo unresolved difference", Style.DECORATIONS_STYLER); if (unresolvedRealDiffs + unresolvedPseudoDiffs > 1) { ret.append("s", Style.DECORATIONS_STYLER); } ret.append("]", Style.DECORATIONS_STYLER); return ret; }
Source:
private Object cast(String valueAsString, Class<?> type) throws ParseException { if (String.class.getCanonicalName().equals(type.getCanonicalName())) { return valueAsString; } else if (Byte.class.getCanonicalName().equals(type.getCanonicalName())) { return Byte.valueOf(valueAsString); } else if (Short.class.getCanonicalName().equals(type.getCanonicalName())) { return Short.valueOf(valueAsString); } else if (Integer.class.getCanonicalName().equals(type.getCanonicalName())) { return Integer.valueOf(valueAsString); } else if (Long.class.getCanonicalName().equals(type.getCanonicalName())) { return Long.valueOf(valueAsString); } else if (Float.class.getCanonicalName().equals(type.getCanonicalName())) { return Float.valueOf(valueAsString); } else if (Double.class.getCanonicalName().equals(type.getCanonicalName())) { return Double.valueOf(valueAsString); } else if (Boolean.class.getCanonicalName().equals(type.getCanonicalName())) { return Boolean.valueOf(valueAsString); } else if (Date.class.getCanonicalName().equals(type.getCanonicalName())) { return KnoxShellTableJSONSerializer.JSON_DATE_FORMAT.parse(valueAsString); } return type.cast(valueAsString); }

Target:
private Object cast(String valueAsString, Class<?> type) throws ParseException { if (String.class == type) { return valueAsString; } else if (Byte.class == type) { return Byte.valueOf(valueAsString); } else if (Short.class == type) { return Short.valueOf(valueAsString); } else if (Integer.class == type) { return Integer.valueOf(valueAsString); } else if (Long.class == type) { return Long.valueOf(valueAsString); } else if (Float.class == type) { return Float.valueOf(valueAsString); } else if (Double.class == type) { return Double.valueOf(valueAsString); } else if (Boolean.class == type) { return Boolean.valueOf(valueAsString); } else if (Date.class == type) { return KnoxShellTableJSONSerializer.JSON_DATE_FORMAT.parse(valueAsString); } return type.cast(valueAsString); }
Source:
private Block getProperBlock(WorldProvider worldProvider, Vector3i location) { List<Side> sides = new ArrayList<>(); for (Side side : new Side[] {Side.TOP, Side.BOTTOM}) { Vector3i neighborLocation = new Vector3i(location); neighborLocation.add(side.getVector3i()); if (worldProvider.isBlockRelevant(neighborLocation)) { Block neighborBlock = worldProvider.getBlock(neighborLocation); final BlockFamily blockFamily = neighborBlock.getBlockFamily(); if (blockFamily instanceof RomanColumnFamily) { sides.add(side); } } } if (sides.contains(Side.BOTTOM) && !sides.contains(Side.TOP)) { return BLOCKS.get(SideBitFlag.getSide(Side.TOP)); } else if (!sides.contains(Side.BOTTOM) && sides.contains(Side.TOP)) { return BLOCKS.get(SideBitFlag.getSide(Side.BOTTOM)); } else if (sides.contains(Side.BOTTOM) && sides.contains(Side.TOP)) { return BLOCKS.get(SideBitFlag.getSides(Side.BOTTOM, Side.TOP)); } else if (!sides.contains(Side.BOTTOM) && !sides.contains(Side.TOP)) { return BLOCKS.get(SideBitFlag.getSides(Side.BOTTOM, Side.TOP)); } return null; }

Target:
private Block getProperBlock(WorldProvider worldProvider, Vector3i location) { byte connections = 0; for (Side connectSide : new Side[] {Side.TOP, Side.BOTTOM}) { if (this.connectionCondition(location, connectSide)) { connections += SideBitFlag.getSide(connectSide); } } return blocks.get(connections); }
Source:
public void play(Location location) { for (String name : effects) { if (name.startsWith("SMOKE")) { name = trimSpace(name.substring(5)); Integer data = null; if (name.length() >= 2) { data = DIR_NAMES.get(name.substring(0, 2)); } if (data == null && name.length() >= 1) { data = DIR_NAMES.get(name.substring(0, 1)); } if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 0; } if (data == 4) { play(location.clone().add(0.0, 0.5, 0.0), org.bukkit.Effect.SMOKE, data); } else { play(location, org.bukkit.Effect.SMOKE, data); } continue; } else if (name.startsWith("RECORD")) { name = trimSpace(name.substring(6)); if (name.startsWith("PLAY")) { name = trimSpace(name.substring(4)); } Integer data = DISK_NAMES.get(name); if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 2257; } play(location, org.bukkit.Effect.RECORD_PLAY, data); continue; } org.bukkit.Effect effect = ParseUtil.parseEnum(org.bukkit.Effect.class, name, null); if (effect != null && !effect.toString().toUpperCase(Locale.ENGLISH).endsWith("_BREAK")) { play(location, effect, 0); continue; } Sound sound = ParseUtil.parseEnum(Sound.class, name, null); if (sound != null) { location.getWorld().playSound(location, sound, volume, pitch); continue; } location.getWorld().playSound(location, name, volume, pitch); } }

Target:
public void play(Location location) { for (String name : effects) { if (name.startsWith("SMOKE")) { name = trimSpace(name.substring(5)); Integer data = null; if (name.length() >= 2) { data = DIR_NAMES.get(name.substring(0, 2)); } if (data == null && name.length() >= 1) { data = DIR_NAMES.get(name.substring(0, 1)); } if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 0; } if (data == 4) { play(location.clone().add(0.0, 0.5, 0.0), org.bukkit.Effect.SMOKE, data); } else { play(location, org.bukkit.Effect.SMOKE, data); } continue; } else if (name.startsWith("RECORD")) { name = trimSpace(name.substring(6)); if (name.startsWith("PLAY")) { name = trimSpace(name.substring(4)); } Integer data = DISK_NAMES.get(name); if (data == null) { try { data = ParseUtil.parseInt(name, null); } catch (NumberFormatException ignored) { } } if (data == null) { data = 2257; } play(location, org.bukkit.Effect.RECORD_PLAY, data); continue; } org.bukkit.Effect effect = ParseUtil.parseEnum(org.bukkit.Effect.class, name, null); if (effect != null && !effect.toString().toUpperCase(Locale.ENGLISH).endsWith("_BREAK")) { play(location, effect, 0); continue; } Sound sound = ParseUtil.parseEnum(Sound.class, name, null); if (sound != null) { location.getWorld().playSound(location, sound, volume, pitch); continue; } play(location, name, volume, pitch); } }
Source:
protected void saveCredentialsInSmartLock(LoginListener loginListener, String username, String password) { if (loginListener != null) { loginListener.saveCredentials(username, password, mAccountStore.getAccount().getDisplayName(), Uri.parse(mAccountStore.getAccount().getAvatarUrl())); } }

Target:
protected void saveCredentialsInSmartLock(LoginListener loginListener, String username, String password) { if (loginListener != null) { loginListener.saveCredentialsInSmartLock(username, password, mAccountStore.getAccount().getDisplayName(), Uri.parse(mAccountStore.getAccount().getAvatarUrl())); } }
Source:
public void tearDown() throws Exception { jedis.disconnect(); jedis1.disconnect(); }

Target:
public void tearDown() throws Exception { lfuJedis.disconnect(); super.tearDown(); }