auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String, ?> properties, CallbackHandler callbackHandler) throws HttpAuthenticationException { checkNotNullParam("mechanismName", mechanismName); checkNotNullParam("properties", properties); checkNotNullParam("callbackHandler", callbackHandler); switch (mechanismName) { case BASIC_NAME: return new BasicAuthenticationMechanism(callbackHandler, (String) properties.get(CONFIG_REALM), false); case CLIENT_CERT_NAME: return new ClientCertAuthenticationMechanism(callbackHandler); case DIGEST_NAME: return new DigestAuthenticationMechanism(callbackHandler, nonceManager, (String) properties.get(CONFIG_REALM), (String) properties.get(CONFIG_CONTEXT_PATH), (String) properties.get(CONFIG_ALGORITHM), providers); case FORM_NAME: return new FormAuthenticationMechanism(callbackHandler, properties); case SPNEGO_NAME: return new SpnegoAuthenticationMechanism(callbackHandler, properties); case BEARER_TOKEN: return new BearerTokenAuthenticationMechanism(callbackHandler); } return null; }

Target:
public HttpServerAuthenticationMechanism createAuthenticationMechanism(String mechanismName, Map<String, ?> properties, CallbackHandler callbackHandler) throws HttpAuthenticationException { checkNotNullParam("mechanismName", mechanismName); checkNotNullParam("properties", properties); checkNotNullParam("callbackHandler", callbackHandler); switch (mechanismName) { case BASIC_NAME: return new BasicAuthenticationMechanism(callbackHandler, (String) properties.get(CONFIG_REALM), false); case CLIENT_CERT_NAME: return new ClientCertAuthenticationMechanism(callbackHandler); case DIGEST_NAME: return new DigestAuthenticationMechanism(callbackHandler, nonceManager, (String) properties.get(CONFIG_REALM), (String) properties.get(CONFIG_CONTEXT_PATH), MD5, providers); case DIGEST_SHA256_NAME: return new DigestAuthenticationMechanism(callbackHandler, nonceManager, (String) properties.get(CONFIG_REALM), (String) properties.get(CONFIG_CONTEXT_PATH), SHA256, providers); case DIGEST_SHA512_256_NAME: return new DigestAuthenticationMechanism(callbackHandler, nonceManager, (String) properties.get(CONFIG_REALM), (String) properties.get(CONFIG_CONTEXT_PATH), SHA512_256, providers); case FORM_NAME: return new FormAuthenticationMechanism(callbackHandler, properties); case SPNEGO_NAME: return new SpnegoAuthenticationMechanism(callbackHandler, properties); case BEARER_TOKEN: return new BearerTokenAuthenticationMechanism(callbackHandler); } return null; }
Source:
public void getAmbryBlobStorageServiceTest() throws Exception { Properties properties = new Properties(); properties.setProperty(HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "zk.client.connect.string", ZK_CONNECT_STRING); properties.setProperty(HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "root.path", STORE_ROOT_PATH); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); AmbryBlobStorageServiceFactory ambryBlobStorageServiceFactory = new AmbryBlobStorageServiceFactory(verifiableProperties, new MockClusterMap(), new MockRestRequestResponseHandler(), new InMemoryRouter(verifiableProperties, new MockClusterMap()), new MockNotifier()); BlobStorageService ambryBlobStorageService = ambryBlobStorageServiceFactory.getBlobStorageService(); assertNotNull("No BlobStorageService returned", ambryBlobStorageService); assertEquals("Did not receive an AmbryBlobStorageService instance", AmbryBlobStorageService.class.getCanonicalName(), ambryBlobStorageService.getClass().getCanonicalName()); }

Target:
public void getAmbryBlobStorageServiceTest() throws Exception { Properties properties = new Properties(); VerifiableProperties verifiableProperties = new VerifiableProperties(properties); AmbryBlobStorageServiceFactory ambryBlobStorageServiceFactory = new AmbryBlobStorageServiceFactory(verifiableProperties, new MockClusterMap(), new MockRestRequestResponseHandler(), new InMemoryRouter(verifiableProperties, new MockClusterMap()), new MockNotifier()); BlobStorageService ambryBlobStorageService = ambryBlobStorageServiceFactory.getBlobStorageService(); assertNotNull("No BlobStorageService returned", ambryBlobStorageService); assertEquals("Did not receive an AmbryBlobStorageService instance", AmbryBlobStorageService.class.getCanonicalName(), ambryBlobStorageService.getClass().getCanonicalName()); }
Source:
public void testMultiThreadedCreateWithDuplicateClientAssignedIdsInTransaction() throws Exception { ExecutorService executor = Executors.newFixedThreadPool(20); List<Future<String>> futures = new ArrayList<>(); for (int i = 0; i < 100; i++) { int finalI = i; Callable<String> task = () -> { Bundle input = new Bundle(); input.setType(BundleType.TRANSACTION); Patient p = new Patient(); p.setId("A" + finalI); p.addIdentifier().setValue("A"+finalI); input.addEntry().setResource(p).setFullUrl("Patient/A" + finalI).getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/A" + finalI); try { ourClient.transaction().withBundle(input).execute(); return null; } catch (ResourceVersionConflictException e) { assertThat(e.toString(), containsString("Error flushing transaction with resource types: [Patient] - The operation has failed with a client-assigned ID constraint failure")); return e.toString(); } }; for (int j = 0; j < 2; j++) { Future<String> future = executor.submit(task); futures.add(future); } } List<String> results = new ArrayList<>(); for (Future<String> next : futures) { String nextOutcome = next.get(); if (isNotBlank(nextOutcome)) { results.add(nextOutcome); } } ourLog.info("Results: {}", results); assertThat(results, not(Matchers.empty())); }

Target:
public void testMultiThreadedCreateWithDuplicateClientAssignedIdsInTransaction() throws Exception { ExecutorService executor = Executors.newFixedThreadPool(20); List<Future<String>> futures = new ArrayList<>(); for (int i = 0; i < 100; i++) { int finalI = i; Callable<String> task = () -> { Bundle input = new Bundle(); input.setType(BundleType.TRANSACTION); Patient p = new Patient(); p.setId("A" + finalI); p.addIdentifier().setValue("A"+finalI); input.addEntry().setResource(p).setFullUrl("Patient/A" + finalI).getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/A" + finalI); try { ourClient.transaction().withBundle(input).execute(); return null; } catch (ResourceVersionConflictException e) { assertThat(e.toString(), containsString("Error flushing transaction with resource types: [Patient] - The operation has failed with a client-assigned ID constraint failure")); return e.toString(); } }; for (int j = 0; j < 2; j++) { Future<String> future = executor.submit(task); futures.add(future); } } List<String> results = new ArrayList<>(); for (Future<String> next : futures) { String nextOutcome = next.get(); if (isNotBlank(nextOutcome)) { results.add(nextOutcome); } } ourLog.info("Results: {}", results); assertThat(results, not(Matchers.empty())); assertThat(results.get(0), containsString("HTTP 409 Conflict: Error flushing transaction with resource types: [Patient]")); }
Source:
private void setClientOptions(WebClient webClient, String htmlUnitWebClientOptions) { final WebClientOptions webClientOptions = webClient.getOptions(); Map<String, String> clientOptions = new LinkedHashMap<>(); final String[] options = htmlUnitWebClientOptions.split(","); for (String option : options) { final String[] keyValue = option.split("="); if (keyValue.length == 2) { String key = keyValue[0].trim(); key = BROWSER_CAPABILITIES + Character.toUpperCase(key.charAt(0)) + key.substring(1); clientOptions.put(key, keyValue[1].trim()); } } final DesiredCapabilities webClientCapabilities = new DesiredCapabilities(clientOptions); CapabilitiesOptionsMapper.mapCapabilities(webClientOptions, webClientCapabilities, BROWSER_CAPABILITIES); }

Target:
private void setClientOptions(WebClient webClient, String htmlUnitWebClientOptions) { final WebClientOptions webClientOptions = webClient.getOptions(); Map<String, String> clientOptions = new LinkedHashMap<>(); final String multiline = StringUtils.trimMultiline(htmlUnitWebClientOptions); final String[] options = multiline.split(";"); for (String option : options) { final String[] keyValue = option.split("="); if (keyValue.length == 2) { String key = keyValue[0].trim(); if (key.length() > 0) { key = BROWSER_NAME + Character.toUpperCase(key.charAt(0)) + key.substring(1); String value = keyValue[1].trim(); if (value.contains(",")) { value = value.replaceAll("\\s*,\\s*", " "); } clientOptions.put(key, value); } else { logger.info("Excluding option : " + option + "to set for HtmlUnitDriver webClientOptions as it is not as per required format i.e. key=value"); } } } final DesiredCapabilities webClientCapabilities = new DesiredCapabilities(clientOptions); logger.info("Setting HtmlDriver web client options: " + clientOptions); CapabilitiesOptionsMapper.mapCapabilities(webClientOptions, webClientCapabilities, BROWSER_NAME); }
Source:
private boolean transitState(String endpoint, ClientState from, ClientState to) { boolean updated = clientStatus.replace(endpoint, from, to); if(updated) { LOG.debug("Client state update -> {}", endpoint, from, to); } else { LOG.debug("Cannot update Client state -> {}. Current state is {}", endpoint, from, to, clientStatus.get(endpoint)); } return updated; }

Target:
private boolean transitState(String endpoint, ClientState from, ClientState to) { boolean updated = clientStatus.replace(endpoint, from, to); if(LOG.isDebugEnabled()) { if (updated) { LOG.debug("Client state update -> {}", endpoint, from, to); } else { LOG.debug("Cannot update Client state -> {}. Current state is {}", endpoint, from, to, clientStatus.get(endpoint)); } } return updated; }
Source:
protected List<OrganizationEntity> getActiveOrganizations() { List<OrganizationEntity> result = new ArrayList<>(); if (StringUtils.isNotBlank(ENABLED_ORGANIZATIONS)) { String[] organizationIdentifiers = StringUtils.split(ENABLED_ORGANIZATIONS, ","); for (String organizationIdentifierStr : organizationIdentifiers) { if (StringUtils.isNotBlank(organizationIdentifierStr)) { SchoolDataIdentifier identifier = SchoolDataIdentifier.fromId(organizationIdentifierStr); if (identifier != null) { OrganizationEntity organizationEntity = organizationEntityController.findByDataSourceAndIdentifier(identifier.getDataSource(), identifier.getIdentifier()); if (organizationEntity != null) { result.add(organizationEntity); } } } } } return result; }

Target:
protected List<OrganizationEntity> getActiveOrganizations() { List<OrganizationEntity> result = new ArrayList<>(); if (StringUtils.isNotBlank(ENABLED_ORGANIZATIONS)) { String[] organizationIdentifiers = StringUtils.split(ENABLED_ORGANIZATIONS, ","); for (String organizationIdentifierStr : organizationIdentifiers) { if (StringUtils.isNotBlank(organizationIdentifierStr)) { SchoolDataIdentifier identifier = SchoolDataIdentifier.fromId(organizationIdentifierStr); if (identifier != null) { OrganizationEntity organizationEntity = organizationEntityController.findByDataSourceAndIdentifierAndArchived( identifier.getDataSource(), identifier.getIdentifier(), Boolean.FALSE); if (organizationEntity != null) { result.add(organizationEntity); } } } } } return result; }
Source:
private SimpleReportEntry createReportEntry( TestIdentifier testIdentifier, TestExecutionResult testExecutionResult, Map<String, String> systemProperties, String reason, Integer elapsedTime ) { String[] classMethodName = toClassMethodName( testIdentifier ); String className = classMethodName[0]; String classText = classMethodName[1]; if ( Objects.equals( className, classText ) ) { classText = null; } boolean isFailedContainer = isFailedContainer( testIdentifier, testExecutionResult ); String methodName = ( isFailedContainer || testIdentifier.isTest() ) ? classMethodName[2] : null; String methodText = ( isFailedContainer || testIdentifier.isTest() ) ? classMethodName[3] : null; if ( Objects.equals( methodName, methodText ) ) { methodText = null; } StackTraceWriter stw = testExecutionResult == null ? null : toStackTraceWriter( className, methodName, testExecutionResult ); return new SimpleReportEntry( className, classText, methodName, methodText, stw, elapsedTime, reason, systemProperties ); }

Target:
private SimpleReportEntry createReportEntry( TestIdentifier testIdentifier, TestExecutionResult testExecutionResult, Map<String, String> systemProperties, String reason, Integer elapsedTime ) { String[] classMethodName = toClassMethodName( testIdentifier ); String className = classMethodName[0]; String classText = classMethodName[1]; if ( Objects.equals( className, classText ) ) { classText = null; } boolean failed = testExecutionResult != null && testExecutionResult.getStatus() == FAILED; String methodName = failed || testIdentifier.isTest() ? classMethodName[2] : null; String methodText = failed || testIdentifier.isTest() ? classMethodName[3] : null; if ( Objects.equals( methodName, methodText ) ) { methodText = null; } StackTraceWriter stw = testExecutionResult == null ? null : toStackTraceWriter( className, methodName, testExecutionResult ); return new SimpleReportEntry( className, classText, methodName, methodText, stw, elapsedTime, reason, systemProperties ); }
Source:
protected StrategyPriority internalCanHandle(Map<VolumeInfo, DataStore> volumeMap) { if (super.internalCanHandle(volumeMap) == StrategyPriority.CANT_HANDLE) { Set<VolumeInfo> volumeInfoSet = volumeMap.keySet(); for (VolumeInfo volumeInfo : volumeInfoSet) { StoragePoolVO storagePoolVO = _storagePoolDao.findById(volumeInfo.getPoolId()); if (storagePoolVO.getPoolType() != StoragePoolType.Filesystem) { return StrategyPriority.CANT_HANDLE; } } return StrategyPriority.HIGHEST; } return StrategyPriority.CANT_HANDLE; }

Target:
protected StrategyPriority internalCanHandle(Map<VolumeInfo, DataStore> volumeMap) { if (super.internalCanHandle(volumeMap) == StrategyPriority.CANT_HANDLE) { Set<VolumeInfo> volumeInfoSet = volumeMap.keySet(); for (VolumeInfo volumeInfo : volumeInfoSet) { StoragePoolVO storagePoolVO = _storagePoolDao.findById(volumeInfo.getPoolId()); if (storagePoolVO.getPoolType() != StoragePoolType.Filesystem && storagePoolVO.getPoolType() != StoragePoolType.NetworkFilesystem) { return StrategyPriority.CANT_HANDLE; } } return StrategyPriority.HYPERVISOR; } return StrategyPriority.CANT_HANDLE; }
Source:
private void parse(String argv) { OptionSet options = buildOptionParser().parse(argv); Properties properties; if (options.has("config")) { properties = parseFile((String) options.valueOf("config"), true); } else { properties = parseFile(DEFAULT_CONFIG_FILE, false); } if (options.has("env_config_prefix")) { String prefix = ((String) options.valueOf("env_config_prefix")).toLowerCase(); System.getenv().entrySet().stream().filter(map -> map.getKey().toLowerCase().startsWith(prefix)) .forEach(config -> properties.put(config.getKey().toLowerCase().replace(prefix, ""), config.getValue())); } if (options.has("help")) usage("Help for Maxwell:"); setup(options, properties); List<?> arguments = options.nonOptionArguments(); if(!arguments.isEmpty()) { usage("Unknown argument(s): " + arguments); } }

Target:
private void parse(String argv) { OptionSet options = buildOptionParser().parse(argv); Properties properties; if (options.has("config")) { properties = parseFile((String) options.valueOf("config"), true); } else { properties = parseFile(DEFAULT_CONFIG_FILE, false); } String prefix = getEnvConfigPrefix(options, properties); if (prefix != null) { System.getenv().entrySet().stream() .filter(map -> map.getKey().toLowerCase().startsWith(prefix.toLowerCase())) .forEach(config -> properties.put(config.getKey().toLowerCase().replaceFirst(prefix.toLowerCase(), ""), config.getValue())); } if (options.has("help")) usage("Help for Maxwell:"); setup(options, properties); List<?> arguments = options.nonOptionArguments(); if(!arguments.isEmpty()) { usage("Unknown argument(s): " + arguments); } }
Source:
public boolean processMessage(Message message) { switch (message.what) { case CMD_NETWORK_CONNECTED: updateConnectedNetworkAttributes(message); transitionTo(mValidatedState); break; case CMD_EVALUATE_PRIVATE_DNS: transitionTo(mEvaluatingPrivateDnsState); break; case EVENT_DNS_NOTIFICATION: mDnsStallDetector.accumulateConsecutiveDnsTimeoutCount(message.arg1); if (evaluateDataStall()) { transitionTo(mEvaluatingState); } break; case EVENT_POLL_TCPINFO: if (getTcpSocketTracker().pollSocketsInfo() && evaluateDataStall()) { transitionTo(mEvaluatingState); } sendTcpPollingEvent(); break; default: return NOT_HANDLED; } return HANDLED; }

Target:
public boolean processMessage(Message message) { switch (message.what) { case CMD_NETWORK_CONNECTED: updateConnectedNetworkAttributes(message); transitionTo(mValidatedState); break; case CMD_EVALUATE_PRIVATE_DNS: transitionTo(mEvaluatingPrivateDnsState); break; case EVENT_DNS_NOTIFICATION: mDnsStallDetector.accumulateConsecutiveDnsTimeoutCount(message.arg1); if (evaluateDataStall()) { transitionTo(mEvaluatingState); } break; case EVENT_POLL_TCPINFO: if (getTcpSocketTracker().pollSocketsInfo() && evaluateDataStall()) { transitionTo(mEvaluatingState); } else { sendTcpPollingEvent(); } break; default: return NOT_HANDLED; } return HANDLED; }
Source:
static <E extends Entity<?, ?>> Map<String, MemoizedValue> extractColumnValues( E entity, Collection<EntityColumn> entityColumns) { checkNotNull(entityColumns); checkNotNull(entity); final Class<? extends Entity> entityClass = entity.getClass(); if (!isPublic(entityClass)) { return Collections.emptyMap(); } final Map<String, MemoizedValue> values = recordColumnValuesToMap(entityColumns, entity); return values; }

Target:
extractColumnValues(E entity, Collection<EntityColumn> entityColumns) { checkNotNull(entity); checkNotNull(entityColumns); final ColumnValueExtractor columnValueExtractor = ColumnValueExtractor.create(entity, entityColumns); return columnValueExtractor.extractColumnValues(); }
Source:
private Set<SpecificHaxeClassReference> getCompatibleTypesInternal() { final Stack<HaxeClass> stack = processedElements.get(); final HaxeClassModel model = getHaxeClassModel(); final HaxeGenericResolver genericResolver = getGenericResolver(); final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (model == null) return list; if (stack.contains(model.haxeClass)) return list; stack.push(model.haxeClass); if (!model.isAbstract()) { if (model.haxeClass instanceof HaxeTypedefDeclaration) { SpecificHaxeClassReference type = ((AbstractHaxeTypeDefImpl)model.haxeClass).getTargetClass(genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypes()); } } else for (HaxeType extendsType : model.haxeClass.getHaxeExtendsList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { if (model.isInterface()) list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } final List<HaxeClassReferenceModel> interfaces = model.getImplementingInterfaces(); for (HaxeClassReferenceModel interfaceReference : interfaces) { SpecificHaxeClassReference type = propagateGenericsToType(interfaceReference.getPsi(), genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } else { for (HaxeType extendsType : model.getAbstractFromList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } return list; }

Target:
private Set<SpecificHaxeClassReference> getCompatibleTypesInternal() { final Stack<HaxeClass> stack = processedElements.get(); final HaxeClassModel model = getHaxeClassModel(); final HaxeGenericResolver genericResolver = getGenericResolver(); final Set<SpecificHaxeClassReference> list = new HashSet<>(); if (model == null) return list; if (stack.contains(model.haxeClass)) return list; stack.push(model.haxeClass); if (!model.isAbstract()) { if (model.haxeClass instanceof HaxeTypedefDeclaration) { SpecificHaxeClassReference type = ((AbstractHaxeTypeDefImpl)model.haxeClass).getTargetClass(genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } else for (HaxeType extendsType : model.haxeClass.getHaxeExtendsList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { if (model.isInterface()) list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } final List<HaxeClassReferenceModel> interfaces = model.getImplementingInterfaces(); for (HaxeClassReferenceModel interfaceReference : interfaces) { SpecificHaxeClassReference type = propagateGenericsToType(interfaceReference.getPsi(), genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } else { for (HaxeType extendsType : model.getAbstractFromList()) { SpecificHaxeClassReference type = propagateGenericsToType(extendsType, genericResolver); if (type != null) { list.add(type); list.addAll(type.getCompatibleTypesInternal()); } } } return list; }
Source:
private static void replaceWord(StringBuilder input, String word, String replace, boolean ignoreCase) { StringBuilder workInput; String workWord = word; if (ignoreCase) { workInput = new StringBuilder(input.toString().toLowerCase(Locale.ENGLISH)); workWord = word.toLowerCase(Locale.ENGLISH); } else { workInput = new StringBuilder(input); } int pos = 0; do { pos = workInput.indexOf(workWord, pos); if (pos == -1) { break; } if (pos > 0) { char prevChar = workInput.charAt(pos - 1); if (Character.isLetterOrDigit(prevChar)) { pos = pos + workWord.length(); continue; } } int nextPos = pos + workWord.length(); if (nextPos < workInput.length()) { char nextChar = workInput.charAt(nextPos); if (Character.isLetterOrDigit(nextChar)) { pos = pos + workWord.length(); continue; } } input.replace(pos, pos + workWord.length(), replace); pos = pos + replace.length(); } while (pos > -1); }

Target:
private static void replaceWord(StringBuilder input, String word, String replace, boolean ignoreCase) { StringBuilder workInput; String workWord; if (ignoreCase) { workInput = new StringBuilder(input.toString().toLowerCase(Locale.ENGLISH)); workWord = word.toLowerCase(Locale.ENGLISH); } else { workInput = new StringBuilder(input); workWord = word; } int pos = 0; do { pos = workInput.indexOf(workWord, pos); if (pos == -1) { break; } if (pos > 0) { char prevChar = workInput.charAt(pos - 1); if (Character.isLetterOrDigit(prevChar)) { pos = pos + workWord.length(); continue; } } int nextPos = pos + workWord.length(); if (nextPos < workInput.length()) { char nextChar = workInput.charAt(nextPos); if (Character.isLetterOrDigit(nextChar)) { pos = pos + workWord.length(); continue; } } input.replace(pos, pos + workWord.length(), replace); pos = pos + replace.length(); } while (pos > -1); }
Source:
public static String unquoteDoubleQuotes(String s) { if (s.length() >= 2) { if (s.charAt(0) == '\"' && s.charAt(s.length() - 1) == '\"') { return s.substring(1, s.length() - 1); } } return s; }

Target:
public static String unquoteDoubleQuotes(String s) { return unquote(s, '\"'); }
Source:
protected List<TimeLinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) { return new ArrayList<TimeLinkEvent>(fLinkEvents); }

Target:
protected List<ILinkEvent> getLinkList(long startTime, long endTime, long resolution, IProgressMonitor monitor) { return new ArrayList<ILinkEvent>(); }
Source:
private void addOrUpdateDayTruncatedActivity(ActivityPayload payload, GoalDTO matchingGoal) { ActivityCacheResult activity = getRegisteredDayActivity(payload, matchingGoal); if (canCombineWithLastRegisteredActivity(payload, activity.content)) { if (isBeyondSkipWindowAfterLastRegisteredActivity(payload, activity.content)) { updateActivityEndTime(payload, matchingGoal, activity); } } else { addActivity(payload, matchingGoal, activity); } }

Target:
private void addOrUpdateDayTruncatedActivity(ActivityPayload payload, GoalDTO matchingGoal) { ActivityDTO lastRegisteredActivity = getLastRegisteredActivity(payload, matchingGoal); if (canCombineWithLastRegisteredActivity(payload, lastRegisteredActivity)) { if (isBeyondSkipWindowAfterLastRegisteredActivity(payload, lastRegisteredActivity)) { updateActivityEndTime(payload, matchingGoal, lastRegisteredActivity); } } else { addActivity(payload, matchingGoal, lastRegisteredActivity); } }
Source:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); when(storIOSQLite.internal()).thenReturn(internal); final PreparedGet<TestItem> preparedGet = storIOSQLite .get() .object(TestItem.class) .withQuery(RawQuery.builder().query("test query").build()) .prepare(); try { preparedGet.executeAsBlocking(); failBecauseExceptionWasNotThrown(StorIOException.class); } catch (StorIOException expected) { assertThat(expected).hasCauseInstanceOf(IllegalStateException.class); } verify(storIOSQLite).get(); verify(storIOSQLite).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).rawQuery(any(RawQuery.class)); verifyNoMoreInteractions(storIOSQLite, internal); }

Target:
public void shouldThrowExceptionIfNoTypeMappingWasFoundWithoutAccessingDbWithRawQueryBlocking() { final StorIOSQLite storIOSQLite = mock(StorIOSQLite.class); final StorIOSQLite.Internal internal = mock(StorIOSQLite.Internal.class); when(storIOSQLite.get()).thenReturn(new PreparedGet.Builder(storIOSQLite)); when(storIOSQLite.internal()).thenReturn(internal); final PreparedGet<TestItem> preparedGet = storIOSQLite .get() .object(TestItem.class) .withQuery(RawQuery.builder().query("test query").build()) .prepare(); try { preparedGet.executeAsBlocking(); failBecauseExceptionWasNotThrown(StorIOException.class); } catch (StorIOException expected) { assertThat(expected).hasCauseInstanceOf(IllegalStateException.class); assertThat(expected.getCause()).hasMessage("This type does not have type mapping: " + "type = " + TestItem.class + "," + "db was not touched by this operation, please add type mapping for this type"); } verify(storIOSQLite).get(); verify(storIOSQLite).internal(); verify(internal).typeMapping(TestItem.class); verify(internal, never()).rawQuery(any(RawQuery.class)); verifyNoMoreInteractions(storIOSQLite, internal); }
Source:
public GarruksWarsteed(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); this.subtype.add(SubType.RHINO); this.power = new MageInt(3); this.toughness = new MageInt(5); this.addAbility(VigilanceAbility.getInstance()); this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryGraveyardPutInHandEffect(filter, false, true), true)); }

Target:
public GarruksWarsteed(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}{G}"); this.subtype.add(SubType.RHINO); this.power = new MageInt(3); this.toughness = new MageInt(5); this.addAbility(VigilanceAbility.getInstance()); this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryGraveyardPutInHandEffect(filter, false, true))); }
Source:
public MergeStrategy getPreferredMergeStrategy() { final IEclipsePreferences prefs = InstanceScope.INSTANCE .getNode(Activator.getPluginId()); if (prefs.getBoolean(GitCorePreferences.core_enableLogicalModel, false)) { String preferredMergeStrategyKey = prefs.get( GitCorePreferences.core_preferredModelMergeStrategy, MergeStrategy.RECURSIVE.getName()); if (preferredMergeStrategyKey != null && !preferredMergeStrategyKey.isEmpty()) { MergeStrategy result = MergeStrategy .get(preferredMergeStrategyKey); if (result != null) { return result; } logError(NLS.bind( CoreText.Activator_invalidPreferredModelMergeStrategy, preferredMergeStrategyKey), null); } logError(CoreText.Activator_missingPreferredModelMergeStrategy, null); } return MergeStrategy.RECURSIVE; }

Target:
public MergeStrategy getPreferredMergeStrategy() { final IEclipsePreferences prefs = InstanceScope.INSTANCE .getNode(Activator.getPluginId()); String preferredMergeStrategyKey = prefs.get( GitCorePreferences.core_preferredMergeStrategy, null); if (preferredMergeStrategyKey != null && !preferredMergeStrategyKey.isEmpty()) { MergeStrategy result = MergeStrategy.get(preferredMergeStrategyKey); if (result != null) { return result; } logError(NLS.bind(CoreText.Activator_invalidPreferredMergeStrategy, preferredMergeStrategyKey), null); } return null; }
Source:
public Object transform(Message<?> message) { try { HttpHeaders headers = new HttpHeaders(); HttpMethod method = HttpMethod.valueOf(properties.getHttpMethod()); URI uri = new URI(properties.getUrl()); HttpEntity<?> requestEntity = new RequestEntity<Object>(properties.getBody(), headers, method, uri); ResponseEntity<String> httpResponse = restTemplate.exchange( properties.getUrl(), HttpMethod.valueOf(properties.getHttpMethod()), requestEntity, String.class); return httpResponse.getBody(); } catch (Exception e) { LOG.warn("Error in HTTP request", e); return null; } }

Target:
public Object transform(Message<?> message) { try { HttpHeaders headers = new HttpHeaders(); if(properties.getHeaders() != null) { Map<String,String> headersMap = properties.getHeaders().getValue(Map.class); for(Entry<String,String> header : headersMap.entrySet()) { headers.add(header.getKey(), header.getValue()); } } Class<?> clazz = String.class; if(properties.getExpectedReturnType() != null) { clazz = properties.getExpectedReturnType().getValue(Class.class); } HttpMethod method = HttpMethod.valueOf(properties.getHttpMethod()); String url = properties.getUrl().getValue(String.class); Object body = properties.getBody() == null ? null : properties.getBody().getValue(message); URI uri = new URI(url); HttpEntity<?> requestEntity = new RequestEntity<Object>(body, headers, method, uri); ResponseEntity<?> httpResponse = restTemplate.exchange( uri, HttpMethod.valueOf(properties.getHttpMethod()), requestEntity, clazz); return httpResponse.getBody(); } catch (Exception e) { LOG.warn("Error in HTTP request", e); return null; } }
Source:
public void replay() { clickElement(String.format(REPLAY_BUTTON_SELECTOR_FORMAT, slot)); playing = true; }

Target:
public void replay() { clickElement(String.format(REPLAY_BUTTON_SELECTOR_FORMAT, slot)); muted = false; playing = true; }
Source:
private Maybe<User> getUserByEmail(String userEmail) throws NoResultException { User user; try { user = entityManagerProvider.get().createQuery( "SELECT u FROM User u " + "WHERE u.email = :email", User.class) .setParameter("email", userEmail) .getSingleResult(); return Maybe.of(user); } catch (NoResultException e) { return Maybe.notFound(); } }

Target:
private Optional<User> getUserByEmail(String userEmail) { User user; try { user = entityManagerProvider.get().createQuery( "SELECT u FROM User u " + "WHERE u.email = :email", User.class) .setParameter("email", userEmail) .getSingleResult(); return Optional.of(user); } catch (NoResultException e) { return Optional.empty(); } }
Source:
public Profile(final Integer id, final String node, final List<ProfileEntry> profileEntries) { this.id = id; this.node = node; this.profileEntries = profileEntries; }

Target:
public Profile(final Integer id, final String node, final List<ProfileEntry> profileEntries) { this.id = id; this.node = node; this.profileEntries = new ArrayList<>(profileEntries); }
Source:
private WritableMemory getMemory(final ByteBuffer buffer) { WritableMemory mem = memCache.get(buffer); if (mem == null) { mem = WritableMemory.wrap(buffer); memCache.put(buffer, mem); } return mem; }

Target:
private WritableMemory getMemory(final ByteBuffer buffer) { return memCache.computeIfAbsent(buffer, buf -> WritableMemory.wrap(buf)); }
Source:
public PayloadBlobBuilder contentType(MediaType contentType) { String contentTypeString = null; if (contentType != null) { contentTypeString = contentType.toString(); } return contentType(contentTypeString); }

Target:
public PayloadBlobBuilder contentType(MediaType contentType) { return contentType(checkNotNull(contentType, "contentType").toString()); }
Source:
private void writeObject(ObjectOutputStream out) throws IOException { writeNotNull(out, commit); writeNotNull(out, into); switch (submitType) { case FAST_FORWARD_ONLY: out.writeChar('F'); break; case MERGE_IF_NECESSARY: out.writeChar('M'); break; case REBASE_IF_NECESSARY: out.writeChar('R'); break; case MERGE_ALWAYS: out.writeChar('A'); break; case CHERRY_PICK: out.writeChar('C'); break; default: throw new IOException("Invalid submit type: " + submitType); } writeString(out, mergeStrategy); }

Target:
private void writeObject(ObjectOutputStream out) throws IOException { writeNotNull(out, commit); writeNotNull(out, into); Character c = SUBMIT_TYPES.get(submitType); if (c == null) { throw new IOException("Invalid submit type: " + submitType); } out.writeChar(c); writeString(out, mergeStrategy); }
Source:
public com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse getActualMeterReadsResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ActualMeterReadsAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ActualMeterReadsAsyncRequest for meter: {}", request.getDeviceIdentification()); try { final MeterResponseData meterResponseData = this.meterResponseDataRepository .findSingleResultByCorrelationUid(request.getCorrelationUid()); if (meterResponseData == null) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_CORRELATION_UID, ComponentType.WS_SMART_METERING); } if (meterResponseData.getMessageData() instanceof ActualMeterReads) { final com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse response = this.monitoringMapper .map(meterResponseData.getMessageData(), com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse.class); this.meterResponseDataRepository.delete(meterResponseData); return response; } else { LOGGER.warn("Incorrect type of response data: for correlation UID: {}", meterResponseData.getClass() .getName(), request.getCorrelationUid()); } } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return null; }

Target:
public com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse getActualMeterReadsResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final ActualMeterReadsAsyncRequest request) throws OsgpException { LOGGER.debug("Incoming ActualMeterReadsAsyncRequest for meter: {}", request.getDeviceIdentification()); try { final MeterResponseData meterResponseData = this.meterResponseDataRepository .findSingleResultByCorrelationUid(request.getCorrelationUid()); if (meterResponseData == null) { throw new FunctionalException(FunctionalExceptionType.UNKNOWN_CORRELATION_UID, ComponentType.WS_SMART_METERING); } if (meterResponseData.getMessageData() instanceof MeterReads) { final com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse response = this.monitoringMapper .map(meterResponseData.getMessageData(), com.alliander.osgp.adapter.ws.schema.smartmetering.monitoring.ActualMeterReadsResponse.class); this.meterResponseDataRepository.delete(meterResponseData); return response; } else { LOGGER.warn("Incorrect type of response data: for correlation UID: {}", meterResponseData.getClass() .getName(), request.getCorrelationUid()); } } catch (final Exception e) { this.handleRetrieveException(e, request, organisationIdentification); } return null; }
Source:
public boolean onEvaluateInputViewShown() { Configuration config = getResources().getConfiguration(); return isInputViewShown() || config.keyboard == Configuration.KEYBOARD_NOKEYS || config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES; }

Target:
public boolean onEvaluateInputViewShown() { Configuration config = getResources().getConfiguration(); return config.keyboard == Configuration.KEYBOARD_NOKEYS || config.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES; }
Source:
public TermCons(String psort, List<Term> contents, Production production) { super(psort); cons = ""; this.contents = contents; this.production = production; }

Target:
public TermCons(String psort, List<Term> contents, Production production) { super(psort); cons = null; this.contents = contents; this.production = production; }
Source:
public int compareTo(PartitionChunk<T> chunk) { if (chunk instanceof IntegerPartitionChunk) { IntegerPartitionChunk<T> intChunk = (IntegerPartitionChunk<T>) chunk; int retVal = comparator.compare(start, intChunk.start); if (retVal == 0) { retVal = comparator.compare(end, intChunk.end); } return retVal; } else { throw new IllegalArgumentException("Cannot compare against something that is not an IntegerPartitionChunk."); } }

Target:
public int compareTo(PartitionChunk<T> chunk) { if (chunk instanceof IntegerPartitionChunk) { IntegerPartitionChunk<T> intChunk = (IntegerPartitionChunk<T>) chunk; return comparator.compare(chunkNumber, intChunk.chunkNumber); } else { throw new IllegalArgumentException("Cannot compare against something that is not an IntegerPartitionChunk."); } }
Source:
public Builder fetchedValue(FetchedValue fetchedValue) { this.fetchedValue = fetchedValue; errors(fetchedValue.getErrors()); return this; }

Target:
public Builder fetchedValue(FetchedValue fetchedValue) { this.fetchedValue = fetchedValue; return this; }
Source:
private ListenableFuture<Response> authenticateAndRetry(final HeliosRequest request, final Response response) { final ListenableFuture<Response> f = Futures.transform( authProvider.renewAuthorization(response.header(HttpHeaders.WWW_AUTHENTICATE)), new AsyncFunction<String, Response>() { @Override public ListenableFuture<Response> apply(final String authHeader) throws Exception { return delegate.request( request.toBuilder().header(HttpHeaders.AUTHORIZATION, authHeader).build()); } }); return Futures.withFallback(f, new FutureFallback<Response>() { @Override public ListenableFuture<Response> create(final Throwable t) throws Exception { return immediateFuture(response); } }); }

Target:
private ListenableFuture<Response> authenticateAndRetry(final HeliosRequest request, final Response response) { final ListenableFuture<Response> f = Futures.transform( authProvider.renewAuthorizationHeader(response.header(HttpHeaders.WWW_AUTHENTICATE)), new AsyncFunction<String, Response>() { @Override public ListenableFuture<Response> apply(final String authHeader) throws Exception { return delegate.request( request.toBuilder().header(HttpHeaders.AUTHORIZATION, authHeader).build()); } }); return Futures.withFallback(f, new FutureFallback<Response>() { @Override public ListenableFuture<Response> create(final Throwable t) throws Exception { return immediateFuture(response); } }); }
Source:
private void updateVersion(Optional<LockWatchVersion> maybeNewVersion) { currentVersion = maybeNewVersion.map(newVersion -> currentVersion .filter(current -> current.id().equals(newVersion.id()) && current.version() > newVersion.version()) .orElse(newVersion)); }

Target:
private void updateVersion(Optional<LockWatchVersion> maybeNewVersion) { currentVersion = maybeNewVersion.map(newVersion -> currentVersion .map(current -> { if (current.id().equals(newVersion.id()) && current.version() > newVersion.version()) { return current; } else { return newVersion; } }) .orElse(newVersion)); }
Source:
public Harness(String note) { this.testName = note; System.out.println(testName); }

Target:
public Harness(String note) { this.testName = note; }
Source:
private void parseHostName(NodeList listOfPeers) { for (int i=0; i < listOfPeers.getLength(); i++) { Node firstPeer = listOfPeers.item(i); if(firstPeer.getNodeType() == Node.ELEMENT_NODE){ Element firstHostElement = (Element)firstPeer; int state = getIntValue(firstHostElement, STATE); if (state == 3) { hostNamesOrIp.add(getTextValue(firstHostElement, HOST_NAME)); } } } }

Target:
private void parseHostName(NodeList listOfPeers) { for (int i=0; i < listOfPeers.getLength(); i++) { Node firstPeer = listOfPeers.item(i); if(firstPeer.getNodeType() == Node.ELEMENT_NODE){ Element firstHostElement = (Element)firstPeer; int state = getIntValue(firstHostElement, STATE); if (state == PEER_IN_CLUSTER) { hostNamesOrIp.add(getTextValue(firstHostElement, HOST_NAME)); } } } }
Source:
public boolean getBoolean(int columnIndex) throws SQLException { connection.getLogger().log(Level.FINEST, " getBoolean columnIndex: {0}", columnIndex); checkResultSet(columnIndex); if (wasNullFlag) { return false; } int col = columnIndex - 1; if (Oid.BOOL == fields[col].getOID()) { final byte[] v = this_row[col]; return (1 == v.length) && (116 == v[0]); } if (isBinary(columnIndex)) { return BooleanTypeUtil.castToBoolean(readDoubleValue(this_row[col], fields[col].getOID(), "boolean"), Oid.toString(fields[col].getOID())); } return BooleanTypeUtil.castToBoolean(getString(columnIndex), Oid.toString(fields[col].getOID())); }

Target:
public boolean getBoolean(int columnIndex) throws SQLException { connection.getLogger().log(Level.FINEST, " getBoolean columnIndex: {0}", columnIndex); checkResultSet(columnIndex); if (wasNullFlag) { return false; } int col = columnIndex - 1; if (Oid.BOOL == fields[col].getOID()) { final byte[] v = this_row[col]; return (1 == v.length) && (116 == v[0]); } if (isBinary(columnIndex)) { return BooleanTypeUtil.castToBoolean(readDoubleValue(this_row[col], fields[col].getOID(), "boolean")); } return BooleanTypeUtil.castToBoolean(getString(columnIndex)); }
Source:
public final JSONArrayBuilder add(JsArrayString value) { if (value == null) return appendNull(); JSONArray array = new JSONArray(); if (value != null) for (int i = 0, n = value.length(); i < n; i++) array.set(i, fromString(value.get(i))); append(array); return this; }

Target:
public final JSONArrayBuilder add(JsArrayString value) { if (value == null) return appendNull(); JSONArray array = new JSONArray(); for (int i = 0, n = value.length(); i < n; i++) array.set(i, fromString(value.get(i))); append(array); return this; }
Source:
private CompilationUnitTree parse(String source) { List<File> classpath = Lists.newArrayList(new File("target/test-classes"), new File("target/classes")); return JParser.parse("1.8", "test", source, classpath); }

Target:
private CompilationUnitTree parse(String source) { List<File> classpath = Lists.newArrayList(new File(TEST_CLASSES_FILEPATH), new File(CLASSES_FILEPATH)); return JParser.parse(JAVA_VERSION, UNIT_NAME, source, classpath); }
Source:
private void checkCollectionAssignments(List<IdentifierTree> usages) { for (IdentifierTree usage : usages) { Tree parentTree = usage.parent(); if (parentTree instanceof AssignmentExpressionTree) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) parentTree; ExpressionTree expression = assignment.expression(); if (usage.equals(assignment.variable()) && !expression.is(Tree.Kind.NULL_LITERAL) && implementsCollectionButNotSerializable(expression.symbolType())) { reportIssue(usage); } } } }

Target:
private void checkCollectionAssignments(List<IdentifierTree> usages) { for (IdentifierTree usage : usages) { Tree parentTree = usage.parent(); if (parentTree.is(Tree.Kind.ASSIGNMENT)) { AssignmentExpressionTree assignment = (AssignmentExpressionTree) parentTree; ExpressionTree expression = assignment.expression(); if (usage.equals(assignment.variable()) && !expression.is(Tree.Kind.NULL_LITERAL) && isUnserializableCollection(expression.symbolType())) { reportIssue(usage); } } } }
Source:
private static String buildFullyQualifiedMetricName(String shortName) { return "com.palantir.atlasdb.monitoring.TimestampTracker." + shortName; }

Target:
private static String buildFullyQualifiedMetricName(String shortName) { return MetricRegistry.name(TimestampTracker.class, shortName); }
Source:
public Date convertDate(Date inDate) { if (inDate == null) { return null; } DateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); String formattedDate = format.format(inDate); try { return format.parse(formattedDate); } catch (Exception ex) { log.error("Error while converting the date to simple date format"); return null; } }

Target:
public Date convertDate(Date inDate) throws ParseException { if (inDate == null) { return null; } DateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); String formattedDate = format.format(inDate); return format.parse(formattedDate); }
Source:
protected void emitContent(String content) throws IOException { ConfluenceDocumentBuilder.this.emitContent(content); if (content.length() > 1) { ConfluenceDocumentBuilder.this.emitContent(" | "); } if (attributes.getHref() != null) { ConfluenceDocumentBuilder.this.emitContent(attributes.getHref()); } if (!Strings.isNullOrEmpty(attributes.getTitle())) { ConfluenceDocumentBuilder.this.emitContent(" | "); ConfluenceDocumentBuilder.this.emitContent(attributes.getTitle()); } ConfluenceDocumentBuilder.this.emitContent(']'); }

Target:
protected void emitContent(String content) throws IOException { ConfluenceDocumentBuilder.this.emitContent(content); if (!Strings.isNullOrEmpty(content)) { ConfluenceDocumentBuilder.this.emitContent(" | "); } if (attributes.getHref() != null) { ConfluenceDocumentBuilder.this.emitContent(attributes.getHref()); } if (!Strings.isNullOrEmpty(attributes.getTitle())) { ConfluenceDocumentBuilder.this.emitContent(" | "); ConfluenceDocumentBuilder.this.emitContent(attributes.getTitle()); } }
Source:
private PageTitle(@Nullable String text, @NonNull WikiSite wiki, @Nullable String thumbUrl, @Nullable PageProperties properties) { if (TextUtils.isEmpty(text)) { text = SiteInfoClient.getMainPageForLang(wiki.languageCode()); } String[] fragParts = text.split("#", -1); text = fragParts[0]; if (fragParts.length > 1) { this.fragment = decodeURL(fragParts[1]).replace(" ", "_"); } else { this.fragment = null; } String[] parts = text.split(":", -1); if (parts.length > 1) { String namespaceOrLanguage = parts[0]; if (Arrays.asList(Locale.getISOLanguages()).contains(namespaceOrLanguage)) { this.wiki = WikiSite.forLanguageCode(namespaceOrLanguage); this.text = TextUtils.join(":", Arrays.copyOfRange(parts, 1, parts.length)); } else { this.wiki = wiki; this.text = text; } } else { this.wiki = wiki; this.text = parts[0]; } this.namespace = null; this.thumbUrl = thumbUrl; this.properties = properties; }

Target:
private PageTitle(@Nullable String text, @NonNull WikiSite wiki, @Nullable String thumbUrl, @Nullable PageProperties properties) { if (TextUtils.isEmpty(text)) { text = SiteInfoClient.getMainPageForLang(wiki.languageCode()); } String[] fragParts = text.split("#", -1); text = fragParts[0]; if (fragParts.length > 1) { this.fragment = decodeURL(fragParts[1]).replace(" ", "_"); } else { this.fragment = null; } String[] parts = text.split(":", -1); if (parts.length > 1) { String namespaceOrLanguage = parts[0]; if (Arrays.asList(Locale.getISOLanguages()).contains(namespaceOrLanguage)) { this.namespace = null; this.wiki = WikiSite.forLanguageCode(namespaceOrLanguage); } else { this.wiki = wiki; this.namespace = namespaceOrLanguage; } this.text = TextUtils.join(":", Arrays.copyOfRange(parts, 1, parts.length)); } else { this.wiki = wiki; this.namespace = null; this.text = parts[0]; } this.thumbUrl = thumbUrl; this.properties = properties; }
Source:
private static TextSummarizer getLocalSummarizer() throws IOException { Collection<? extends TextSummarizer> summarizers = Lookup.getDefault().lookupAll(TextSummarizer.class ); if (!summarizers.isEmpty()) { summarizerToUse = summarizers.iterator().next(); return summarizerToUse; } throw new IOException("No summarizers found"); }

Target:
private static TextSummarizer getLocalSummarizer() { Collection<? extends TextSummarizer> summarizers = Lookup.getDefault().lookupAll(TextSummarizer.class ); if (!summarizers.isEmpty()) { summarizerToUse = summarizers.iterator().next(); return summarizerToUse; } return null; }