auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void afterTest() { logger.info("Cleaning up created key values."); client.listSettings(new SettingSelector().setKeys(keyPrefix + "*")) .flatMap(configurationSetting -> { Mono<Response<ConfigurationSetting>> unlock; if (configurationSetting.isLocked()) { unlock = client.clearReadOnlyWithResponse(configurationSetting); } else { unlock = Mono.empty(); } logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.getKey(), configurationSetting.getLabel(), configurationSetting.isLocked()); return unlock.then(client.deleteSetting(configurationSetting)); }) .blockLast(); logger.info("Finished cleaning up values."); }

Target:
protected void afterTest() { logger.info("Cleaning up created key values."); client.listSettings(new SettingSelector().setKeys(keyPrefix + "*")) .flatMap(configurationSetting -> { logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.getKey(), configurationSetting.getLabel(), configurationSetting.isLocked()); Mono<Response<ConfigurationSetting>> unlock = configurationSetting.isLocked() ? client.clearReadOnlyWithResponse(configurationSetting) : Mono.empty(); return unlock.then(client.deleteSettingWithResponse(configurationSetting, false)); }) .blockLast(); logger.info("Finished cleaning up values."); }
Source:
private void sendNotification(List<MentionNotificationParameters> notificationParametersList) { for (MentionNotificationParameters mentionNotificationParameters : notificationParametersList) { for (String type : mentionNotificationParameters.getNewTypes()) { this.mentionNotificationServiceProvider.get(type) .ifPresent(it -> { try { it.sendNotifications(mentionNotificationParameters); } catch (Exception e) { this.logger .warn("Notification of with type failed. Cause: [{}]", mentionNotificationParameters, type, getRootCauseMessage(e)); } }); } } }

Target:
private void sendNotification(List<MentionNotificationParameters> notificationParametersList) { for (MentionNotificationParameters mentionNotificationParameters : notificationParametersList) { Map<String, Set<MentionNotificationParameter>> newMentions = mentionNotificationParameters.getNewMentions(); if (!newMentions.isEmpty()) { this.observationManager .notify(new NewMentionsEvent(), mentionNotificationParameters.getAuthorReference(), mentionNotificationParameters); } } }
Source:
public void readWriteOffsets() { KafkaConsumer<String, ChangeEvent> consumer = mock(KafkaConsumer.class); Uris uris = mock(Uris.class); when(uris.isEntityNamespace(0)).thenReturn(true); when(uris.getHost()).thenReturn("acme.test"); URIBuilder b = new URIBuilder(); b.setScheme("https"); b.setHost("acme.test"); when(uris.builder()).thenReturn(b); Instant startTime = Instant.ofEpochMilli(BEGIN_DATE); Collection<String> topics = ImmutableList.of("topictest", "othertopic"); when(consumer.partitionsFor(any())).thenAnswer(inv -> { String pName = inv.getArgumentAt(0, String.class); PartitionInfo pi = mock(PartitionInfo.class); when(pi.partition()).thenReturn(0); when(pi.topic()).thenReturn(pName); return ImmutableList.of(pi); }); RdfRepositoryForTesting rdfRepository = new RdfRepositoryForTesting("wdq"); KafkaPoller poller = new KafkaPoller(consumer, uris, startTime, 5, topics, rdfRepository); poller.setUpTopicPartitions(); when(consumer.position(any())).thenReturn(1L, 2L, 3L, 4L); poller.writeOffsetsToStorage(); Map<TopicPartition, OffsetAndTimestamp> offsets = poller.getOffsetsFromStorage(); assertThat(offsets.get(new TopicPartition("topictest", 0)).offset(), is(1L)); assertThat(offsets.get(new TopicPartition("othertopic", 0)).offset(), is(2L)); poller.writeOffsetsToStorage(); offsets = poller.getOffsetsFromStorage(); assertThat(offsets.get(new TopicPartition("topictest", 0)).offset(), is(3L)); assertThat(offsets.get(new TopicPartition("othertopic", 0)).offset(), is(4L)); }

Target:
public void readWriteOffsets() throws Exception { KafkaConsumer<String, ChangeEvent> consumer = mock(KafkaConsumer.class); Uris uris = new Uris("https", "acme.test", 443, new long[]{0}); Instant startTime = Instant.ofEpochMilli(BEGIN_DATE); Collection<String> topics = ImmutableList.of("topictest", "othertopic"); when(consumer.partitionsFor(any())).thenAnswer(inv -> { String pName = inv.getArgumentAt(0, String.class); PartitionInfo pi = new PartitionInfo(pName, 0, null, null, null); return ImmutableList.of(pi); }); try (RdfRepositoryForTesting rdfRepository = new RdfRepositoryForTesting("wdq")) { try { rdfRepository.before(); KafkaPoller poller = new KafkaPoller(consumer, uris, startTime, 5, topics, rdfRepository); poller.setUpTopicPartitions(); when(consumer.position(any())).thenReturn(1L, 2L, 3L, 4L); poller.writeOffsetsToStorage(); Map<TopicPartition, OffsetAndTimestamp> offsets = poller.fetchOffsetsFromStorage(); assertThat(offsets.get(new TopicPartition("topictest", 0)).offset(), is(1L)); assertThat(offsets.get(new TopicPartition("othertopic", 0)).offset(), is(2L)); poller.writeOffsetsToStorage(); offsets = poller.fetchOffsetsFromStorage(); assertThat(offsets.get(new TopicPartition("topictest", 0)).offset(), is(3L)); assertThat(offsets.get(new TopicPartition("othertopic", 0)).offset(), is(4L)); } finally { rdfRepository.after(); } } }
Source:
public void addResponseToOMDB(OMMetadataManager omMetadataManager) throws IOException { String dbUserKey = omMetadataManager.getUserKey(owner); VolumeList volumeList = updatedVolumeList; if (updatedVolumeList.getVolumeNamesList().size() == 0) { omMetadataManager.getUserTable().delete(dbUserKey); } else { omMetadataManager.getUserTable().put(dbUserKey, volumeList); } omMetadataManager.getVolumeTable().delete( omMetadataManager.getVolumeKey(volume)); }

Target:
public void addResponseToOMDB(OMMetadataManager omMetadataManager) throws IOException { String dbUserKey = omMetadataManager.getUserKey(owner); if (updatedVolumeList.getVolumeNamesList().size() == 0) { omMetadataManager.getUserTable().delete(dbUserKey); } else { omMetadataManager.getUserTable().put(dbUserKey, updatedVolumeList); } omMetadataManager.getVolumeTable().delete( omMetadataManager.getVolumeKey(volume)); }
Source:
private List<Set<FieldId>> enumerateGroupingSets(Analysis.GroupingSetAnalysis groupingSetAnalysis) { List<List<Set<FieldId>>> partialSets = new ArrayList<>(); for (Set<FieldId> cube : groupingSetAnalysis.getCubes()) { partialSets.add(ImmutableList.copyOf(Sets.powerSet(cube))); } for (List<FieldId> rollup : groupingSetAnalysis.getRollups()) { List<Set<FieldId>> sets = IntStream.range(0, rollup.size() + 1) .mapToObj(i -> ImmutableSet.copyOf(rollup.subList(0, i))) .collect(toImmutableList()); partialSets.add(sets); } partialSets.addAll(groupingSetAnalysis.getOrdinarySets()); if (partialSets.isEmpty()) { return ImmutableList.of(ImmutableSet.of()); } List<Set<FieldId>> allSets = new ArrayList<>(); partialSets.get(0) .stream() .map(ImmutableSet::copyOf) .forEach(allSets::add); for (int i = 1; i < partialSets.size(); i++) { List<Set<FieldId>> groupingSets = partialSets.get(i); List<Set<FieldId>> oldGroupingSetsCrossProduct = ImmutableList.copyOf(allSets); allSets.clear(); for (Set<FieldId> existingSet : oldGroupingSetsCrossProduct) { for (Set<FieldId> groupingSet : groupingSets) { Set<FieldId> concatenatedSet = ImmutableSet.<FieldId>builder() .addAll(existingSet) .addAll(groupingSet) .build(); allSets.add(concatenatedSet); } } } return allSets; }

Target:
private List<Set<FieldId>> enumerateGroupingSets(Analysis.GroupingSetAnalysis groupingSetAnalysis) { List<List<Set<FieldId>>> partialSets = new ArrayList<>(); for (Set<FieldId> cube : groupingSetAnalysis.getCubes()) { partialSets.add(ImmutableList.copyOf(Sets.powerSet(cube))); } for (List<FieldId> rollup : groupingSetAnalysis.getRollups()) { List<Set<FieldId>> sets = IntStream.rangeClosed(0, rollup.size()) .mapToObj(i -> ImmutableSet.copyOf(rollup.subList(0, i))) .collect(toImmutableList()); partialSets.add(sets); } partialSets.addAll(groupingSetAnalysis.getOrdinarySets()); if (partialSets.isEmpty()) { return ImmutableList.of(ImmutableSet.of()); } List<Set<FieldId>> allSets = new ArrayList<>(); partialSets.get(0) .stream() .map(ImmutableSet::copyOf) .forEach(allSets::add); for (int i = 1; i < partialSets.size(); i++) { List<Set<FieldId>> groupingSets = partialSets.get(i); List<Set<FieldId>> oldGroupingSetsCrossProduct = ImmutableList.copyOf(allSets); allSets.clear(); for (Set<FieldId> existingSet : oldGroupingSetsCrossProduct) { for (Set<FieldId> groupingSet : groupingSets) { Set<FieldId> concatenatedSet = ImmutableSet.<FieldId>builder() .addAll(existingSet) .addAll(groupingSet) .build(); allSets.add(concatenatedSet); } } } return allSets; }
Source:
private void epdqSetupWithStatusCheck(boolean require3ds) { try { new URL(url).openConnection().connect(); Map<String, String> validEpdqCredentials = ImmutableMap.of( "merchant_id", merchantId, "username", username, "password", password, "sha_in_passphrase", shaInPassphrase); GatewayAccountEntity validGatewayAccount = new GatewayAccountEntity(); validGatewayAccount.setId(123L); validGatewayAccount.setGatewayName("epdq"); validGatewayAccount.setCredentials(validEpdqCredentials); validGatewayAccount.setType(TEST); validGatewayAccount.setRequires3ds(require3ds); chargeEntity = aValidChargeEntity() .withGatewayAccountEntity(validGatewayAccount) .withTransactionId(randomUUID().toString()) .build(); mockMetricRegistry = mock(MetricRegistry.class); mockHistogram = mock(Histogram.class); mockCounter = mock(Counter.class); when(mockMetricRegistry.histogram(anyString())).thenReturn(mockHistogram); mockEnvironment = mock(Environment.class); when(mockEnvironment.metrics()).thenReturn(mockMetricRegistry); } catch (IOException ex) { Assume.assumeTrue(false); } }

Target:
private void epdqSetupWithStatusCheck(boolean require3ds) { try { new URL(url).openConnection().connect(); Map<String, String> validEpdqCredentials = ImmutableMap.of( "merchant_id", merchantId, "username", username, "password", password, "sha_in_passphrase", shaInPassphrase); GatewayAccountEntity validGatewayAccount = new GatewayAccountEntity(); validGatewayAccount.setId(123L); validGatewayAccount.setGatewayName("epdq"); validGatewayAccount.setCredentials(validEpdqCredentials); validGatewayAccount.setType(TEST); validGatewayAccount.setRequires3ds(require3ds); chargeEntity = aValidChargeEntity() .withGatewayAccountEntity(validGatewayAccount) .withTransactionId(randomUUID().toString()) .build(); } catch (IOException ex) { Assume.assumeTrue(false); } }
Source:
public static String processPageSourceForFailureCase(String content) { return processPageSourceForGodMode(content) .replace("&#x2f;js&#x2f;lib&#x2f;jquery.min.js", "{*}&#x2f;jquery.min.js") .replace("https:&#x2f;&#x2f;ajax.googleapis.com&#x2f;ajax&#x2f;libs&#x2f;jquery&#x2f;1.11.3&#x2f;jquery.min.js", "{*}&#x2f;jquery.min.js") .replace("&#x2f;js&#x2f;lib&#x2f;jquery-ui.min.js", "{*}&#x2f;jquery-ui.min.js") .replace("https:&#x2f;&#x2f;ajax.googleapis.com&#x2f;ajax&#x2f;libs&#x2f;jqueryui&#x2f;1.10.4&#x2f;jquery-ui.min.js", "{*}&#x2f;jquery-ui.min.js"); }

Target:
public static String processPageSourceForFailureCase(String content) { Date now = new Date(); return processPageSourceForGodMode(content) .replace(Sanitizer.sanitizeForHtml("/js/lib/jquery-ui.min.js"), Sanitizer.sanitizeForHtml("{*}/jquery-ui.min.js")) .replace(Sanitizer.sanitizeForHtml("<LINK_1>"), Sanitizer.sanitizeForHtml("{*}/jquery.min.js")) .replace(Sanitizer.sanitizeForHtml("/js/lib/jquery-ui.min.js"), Sanitizer.sanitizeForHtml("{*}/jquery-ui.min.js")) .replace(Sanitizer.sanitizeForHtml("<LINK_0>"), Sanitizer.sanitizeForHtml("{*}/jquery-ui.min.js")) .replace(TimeHelper.formatDate(now), "{*}"); }
Source:
public BranchId getBranchId(IAtsVersion version) { return BranchId.valueOf( services.getAttributeResolver().getSoleAttributeValue(version, AtsAttributeTypes.BaselineBranchUuid, "-1")); }

Target:
public BranchId getBranchId(IAtsVersion version) { return services.getAttributeResolver().getSoleAttributeValue(version, AtsAttributeTypes.BaselineBranchUuid, BranchId.SENTINEL); }
Source:
void releaseView() { LOG.info("Releasing view of subpartition of {}.", getSubPartitionIndex(), parent.getPartitionId()); readView = null; isPartialBuffer = true; isBlockedByCheckpoint = false; sequenceNumber = 0; }

Target:
private void releaseView() { assert Thread.holdsLock(buffers); if (readView != null) { LOG.debug("Releasing view of subpartition of {}.", getSubPartitionIndex(), parent.getPartitionId()); readView.releaseAllResources(); readView = null; isPartialBufferCleanupRequired = true; isBlockedByCheckpoint = false; sequenceNumber = 0; } }
Source:
public void updateLoggingPrefs() { final AdminSettingsManager settingsManager = new AdminSettingsManager(); final String enabled = settingsManager.getPref(SalesforceAnalyticsManager.ANALYTICS_ON_OFF_KEY, account); if (!TextUtils.isEmpty(enabled)) { if (FALSE.equals(enabled.trim().toLowerCase())) { disableOrEnableLogging(false); } else { disableOrEnableLogging(true); } } }

Target:
public void updateLoggingPrefs() { final AdminSettingsManager settingsManager = new AdminSettingsManager(); final String enabled = settingsManager.getPref(SalesforceAnalyticsManager.ANALYTICS_ON_OFF_KEY, account); if (!TextUtils.isEmpty(enabled)) { if (!Boolean.parseBoolean(enabled)) { disableOrEnableLogging(false); } else { disableOrEnableLogging(true); } } }
Source:
private boolean validate() { if (builderLedgerType == null) { LOG.error("invalid null builderLedgerType"); return false; } if (bk.getConf().getUseV2WireProtocol() && builderLedgerType != LedgerType.FORCE_ON_JOURNAL) { LOG.error("invalid builderLedgerType while using v2 wire protocol"); return false; } if (builderWriteQuorumSize > builderEnsembleSize) { LOG.error("invalid writeQuorumSize > ensembleSize {}", builderWriteQuorumSize, builderEnsembleSize); return false; } if (builderLedgerType.equals(LedgerType.FORCE_DEFERRED_ON_JOURNAL) && builderWriteQuorumSize != builderEnsembleSize) { LOG.error("invalid writeQuorumSize != ensembleSize for FORCE_DEFERRED_ON_JOURNAL ledger. Striping is not allowed", builderWriteQuorumSize, builderEnsembleSize); return false; } if (builderAckQuorumSize > builderWriteQuorumSize) { LOG.error("invalid ackQuorumSize > writeQuorumSize {}", builderAckQuorumSize, builderWriteQuorumSize); return false; } if (builderAckQuorumSize <= 0) { LOG.error("invalid ackQuorumSize <= 0", builderAckQuorumSize); return false; } if (builderPassword == null) { LOG.error("invalid null password"); return false; } if (builderDigestType == null) { LOG.error("invalid null digestType"); return false; } if (builderCustomMetadata == null) { LOG.error("invalid null customMetadata"); return false; } return true; }

Target:
private boolean validate() { if (builderLedgerType == null) { LOG.error("invalid null builderLedgerType"); return false; } if (bk.getConf().getUseV2WireProtocol() && !builderLedgerType.equals(LedgerType.FORCE_ON_JOURNAL)) { LOG.error("invalid builderLedgerType while using v2 wire protocol"); return false; } if (builderWriteQuorumSize > builderEnsembleSize) { LOG.error("invalid writeQuorumSize > ensembleSize {}", builderWriteQuorumSize, builderEnsembleSize); return false; } if (builderAckQuorumSize > builderWriteQuorumSize) { LOG.error("invalid ackQuorumSize > writeQuorumSize {}", builderAckQuorumSize, builderWriteQuorumSize); return false; } if (builderAckQuorumSize <= 0) { LOG.error("invalid ackQuorumSize <= 0", builderAckQuorumSize); return false; } if (builderPassword == null) { LOG.error("invalid null password"); return false; } if (builderDigestType == null) { LOG.error("invalid null digestType"); return false; } if (builderCustomMetadata == null) { LOG.error("invalid null customMetadata"); return false; } return true; }
Source:
public void setLocationInfo(IFrameDMData dmData) { if (dmData == null) { this.m_locInfo = null; } else { StringBuilder label = new StringBuilder(); if (dmData.getFunction() != null && dmData.getFunction().length() != 0) { label.append(" "); label.append(dmData.getFunction()); label.append("()"); } boolean hasFileName = dmData.getFile() != null && dmData.getFile().length() != 0; if (hasFileName) { label.append(" at "); label.append(dmData.getFile()); } if (dmData.getLine() >= 0) { label.append(":"); label.append(dmData.getLine()); label.append(" "); } if (!hasFileName && (dmData.getModule() != null && dmData.getModule() .length() != 0)) { label.append(" "); label.append(dmData.getModule()); label.append(" "); } if (dmData.getAddress() != null) { label.append("- 0x" + dmData.getAddress().toString(16)); } this.m_locInfo = label.toString(); } }

Target:
public void setLocationInfo(IFrameDMData dmData) { if (dmData == null) { this.m_locInfo = null; } else { StringBuilder label = new StringBuilder(); if (dmData.getFunction() != null && dmData.getFunction().length() != 0) { label.append(" "); label.append(dmData.getFunction()); label.append("()"); } boolean hasFileName = dmData.getFile() != null && dmData.getFile().length() != 0; if (hasFileName) { label.append(" at "); label.append(dmData.getFile()); if (dmData.getLine() >= 0) { label.append(":"); label.append(dmData.getLine()); label.append(" "); } } if (!hasFileName && (dmData.getModule() != null && dmData.getModule() .length() != 0)) { label.append(" "); label.append(dmData.getModule()); label.append(" "); } if (dmData.getAddress() != null) { label.append("- 0x" + dmData.getAddress().toString(16)); } this.m_locInfo = label.toString(); } }
Source:
protected void configure() { TransactionSynchronizationManager.initSynchronization(); TransactionSynchronizationManager.setActualTransactionActive(true); install(new EngineInitModule()); }

Target:
protected void configure() { requestInjection(transactionManager); bindInterceptor(any(), annotatedWith(Transactional.class), new TransactionInterceptor(transactionManager, new AnnotationTransactionAttributeSource())); install(new EngineInitModule()); }
Source:
public void saveOrUpdateShouldBeUnsuccessfulWhenCandidateIdIsNotANumber() throws Exception { this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", TEXT) .param("position.id", STRING_VALUE_ONE).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(REDIRECT_URL_FOR_NON_EXISTING_CANDIDATE)); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(null); then(this.positionService).should().getPositionDtoById(1L); then(this.channelService).should().getChannelDtoById(1L); }

Target:
public void saveOrUpdateShouldBeUnsuccessfulWhenCandidateIdIsNotANumber() throws Exception { given(this.candidateService.getCandidate(null)).willThrow(new AssertionError()); given(this.positionService.getPositionDtoById(1L)).willReturn(positionDTO); given(this.channelService.getChannelDtoById(1L)).willReturn(channelDTO); this.mockMvc.perform(post(REQUEST_URL_POST) .param("candidateId", TEXT) .param("position.id", STRING_VALUE_ONE).param("position.name", POSITION_NAME_DEVELOPER) .param("channel.id", STRING_VALUE_ONE).param("channel.name", CHANNEL_NAME_FACEBOOK) .param("description", DESCRIPTION)) .andExpect(status().is3xxRedirection()) .andExpect(flash().attributeCount(1)) .andExpect(model().attributeDoesNotExist("candidateId")); verifyZeroInteractions(applicationsService); then(this.candidateService).should().getCandidate(null); then(this.positionService).should().getPositionDtoById(1L); then(this.channelService).should().getChannelDtoById(1L); }
Source:
private List<URL> getResources() throws IOException { List<URL> result = cachedResourceList; if(result == null) { synchronized(this) { result = cachedResourceList; if(result == null) { final ClassLoader cl = getClassLoader(); if (cl != null) { result = cachedResourceList = Collections.list(cl.getResources(JARCACHE_JSON)); } else { result = cachedResourceList = Collections.list(ClassLoader.getSystemResources(JARCACHE_JSON)); } } } } return result; }

Target:
private List<URL> getResources() throws IOException { final ClassLoader cl = getClassLoader(); final Object key = cl == null ? NULL_CLASS_LOADER : cl; List<URL> newValue = cachedResourceList.get(key); if (newValue != null) { return newValue; } if (cl != null) { newValue = Collections .unmodifiableList(Collections.list(cl.getResources(JARCACHE_JSON))); } else { newValue = Collections.unmodifiableList( Collections.list(ClassLoader.getSystemResources(JARCACHE_JSON))); } final List<URL> oldValue = cachedResourceList.putIfAbsent(key, newValue); return oldValue != null ? oldValue : newValue; }
Source:
private String getToggleTime(int toggleTime, boolean on) { long temp = (on ? 1 : 0) << 16; temp |= (toggleTime & 0x0001FFFF); temp <<= 15; String s = Long.toHexString(temp); for (int i = s.length(); i < 2; i++) s = "0" + s; return s; }

Target:
private String getToggleTime(int toggleTime, boolean on) { long temp = (on ? 1 : 0) << 16; temp |= (toggleTime & 0x0001FFFF); temp <<= 15; String s = Long.toHexString(temp); for (int i = s.length(); i < 2; i++) { s = "0" + s; } return s; }
Source:
public IStatus validate(IValidationContext ctx) { IStatus result = ctx.createSuccessStatus(); final EObject eObj = ctx.getTarget(); if (eObj instanceof ContainerMapping) { if (ctx.getCurrentConstraintId().equals(COMPARTMENT_CONTAINMENT_RULE_ID)) { result = validateCompartmentContainment(ctx, eObj); } else if (ctx.getCurrentConstraintId().equals(CONTAINER_LIST_CONTAINMENT_RULE_ID)) { result = validateContainerListContainment(ctx, eObj); } else if (ctx.getCurrentConstraintId().equals(NODES_IN_REGION_CONTAINER_RULE_ID)) { result = validateSubNodesInRegionContainer(ctx, eObj); } else if (ctx.getCurrentConstraintId().equals(BORDERED_NODES_IN_REGION_CONTAINER_RULE_ID)) { result = validateBorderedNodesInRegion(ctx, eObj); } else if (ctx.getCurrentConstraintId().equals(REGION_MAPPING_STYLE_RULE_ID)) { result = validateRegionStyle(ctx, eObj); } } if (eObj instanceof MappingFilter && ctx.getCurrentConstraintId().equals(MAPPING_FILTER_ON_REGION_MAPPING_RULE_ID)) { result = validateMappingFilterOnRegions(ctx, eObj); } return result; }

Target:
public IStatus validate(IValidationContext ctx) { IStatus result = ctx.createSuccessStatus(); final EObject eObj = ctx.getTarget(); if (eObj instanceof ContainerMapping) { if (COMPARTMENT_CONTAINMENT_RULE_ID.equals(ctx.getCurrentConstraintId())) { result = validateCompartmentContainment(ctx, eObj); } else if (CONTAINER_LIST_CONTAINMENT_RULE_ID.equals(ctx.getCurrentConstraintId())) { result = validateContainerListContainment(ctx, eObj); } else if (NODES_IN_REGION_CONTAINER_RULE_ID.equals(ctx.getCurrentConstraintId())) { result = validateSubNodesInRegionContainer(ctx, eObj); } else if (BORDERED_NODES_IN_REGION_CONTAINER_RULE_ID.equals(ctx.getCurrentConstraintId())) { result = validateBorderedNodesInRegion(ctx, eObj); } else if (REGION_MAPPING_STYLE_RULE_ID.equals(ctx.getCurrentConstraintId())) { result = validateRegionStyle(ctx, eObj); } } if (eObj instanceof MappingFilter && MAPPING_FILTER_ON_REGION_MAPPING_RULE_ID.equals(ctx.getCurrentConstraintId())) { result = validateMappingFilterOnRegions(ctx, eObj); } return result; }
Source:
public void should_load_resource_from_url_using_charset() { assertEquals(expectedContent, URLs.contentOf(sampleResourceURL, Charset.forName("UTF-8"))); }

Target:
public void should_load_resource_from_url_using_charset() { assertThat(URLs.contentOf(sampleResourceURL, Charset.forName("UTF-8"))).isEqualTo(expectedContent); }
Source:
public boolean nextRaw(List<Cell> outResults, ScannerContext scannerContext) throws IOException { if (storeHeap == null) { throw new UnknownScannerException("Scanner was closed"); } boolean moreValues = false; if (outResults.isEmpty()) { moreValues = nextInternal(outResults, scannerContext); } else { List<Cell> tmpList = new ArrayList<>(); moreValues = nextInternal(tmpList, scannerContext); outResults.addAll(tmpList); } if (!outResults.isEmpty()) { readRequestsCount.increment(); if (metricsRegion != null) { metricsRegion.updateReadRequestCount(); } } if (rsServices != null && rsServices.getMetrics() != null) { rsServices.getMetrics().updateReadQueryMeter(getRegionInfo().getTable()); } if(isFullRegionScan()) { fullScanRequestsCount.increment(); } if (!scannerContext.mayHaveMoreCellsInRow()) { resetFilters(); } if (isFilterDoneInternal()) { moreValues = false; } return moreValues; }

Target:
public boolean nextRaw(List<Cell> outResults, ScannerContext scannerContext) throws IOException { if (storeHeap == null) { throw new UnknownScannerException("Scanner was closed"); } boolean moreValues = false; if (outResults.isEmpty()) { moreValues = nextInternal(outResults, scannerContext); } else { List<Cell> tmpList = new ArrayList<>(); moreValues = nextInternal(tmpList, scannerContext); outResults.addAll(tmpList); } if (!outResults.isEmpty()) { readRequestsCount.increment(); if (metricsRegion != null) { metricsRegion.updateReadRequestCount(); } } if (rsServices != null && rsServices.getMetrics() != null) { rsServices.getMetrics().updateReadQueryMeter(getRegionInfo().getTable()); } if (!scannerContext.mayHaveMoreCellsInRow()) { resetFilters(); } if (isFilterDoneInternal()) { moreValues = false; } return moreValues; }
Source:
protected Object encodeCommand(Command command) { command.set(Command.KEY_DEVICE_PASSWORD, "000000"); if (Context.getDeviceManager() != null) { Device device = Context.getDeviceManager().getDeviceById(command.getDeviceId()); if (device != null && device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) { command.set(Command.KEY_DEVICE_PASSWORD, device.getAttributes() .get(Command.KEY_DEVICE_PASSWORD).toString()); } } switch (command.getType()) { case Command.TYPE_ENGINE_STOP: return formatCommand(command, "*{%s},025,C,1#", Command.KEY_DEVICE_PASSWORD); case Command.TYPE_ENGINE_RESUME: return formatCommand(command, "*{%s},025,C,0#", Command.KEY_DEVICE_PASSWORD); default: Log.warning(new UnsupportedOperationException(command.getType())); break; } return null; }

Target:
protected Object encodeCommand(Command command) { command.set(Command.KEY_DEVICE_PASSWORD, "000000"); Device device = Context.getIdentityManager().getDeviceById(command.getDeviceId()); if (device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) { command.set(Command.KEY_DEVICE_PASSWORD, (String) device.getAttributes() .get(Command.KEY_DEVICE_PASSWORD)); } switch (command.getType()) { case Command.TYPE_ENGINE_STOP: return formatCommand(command, "*{%s},025,C,1#", Command.KEY_DEVICE_PASSWORD); case Command.TYPE_ENGINE_RESUME: return formatCommand(command, "*{%s},025,C,0#", Command.KEY_DEVICE_PASSWORD); default: Log.warning(new UnsupportedOperationException(command.getType())); break; } return null; }
Source:
public void setStatusLineManager(IStatusLineManager statusLineManager) { if (fStatusLineManager != null && statusLineManager == null) { fStatusLineManager.setMessage(""); } fStatusLineManager = statusLineManager; }

Target:
public void setStatusLineManager(IStatusLineManager statusLineManager) { if (fStatusLineManager != null && statusLineManager == null) { fStatusLineManager.setMessage(null); } fStatusLineManager = statusLineManager; }
Source:
public KV<Object, Object> convertToSamzaMessage(SamzaSqlRelMessage relMessage) { Schema schema = computeSchema(streamName, relMessage); GenericRecord record = new GenericData.Record(schema); List<String> fieldNames = relMessage.getFieldNames(); List<Object> values = relMessage.getFieldValues(); for (int index = 0; index < fieldNames.size(); index++) { record.put(fieldNames.get(index), values.get(index)); } return new KV<>(relMessage.getKey(), record); }

Target:
public KV<Object, Object> convertToSamzaMessage(SamzaSqlRelMessage relMessage) { Schema schema = computeSchema(streamName, relMessage); return convertToSamzaMessage(relMessage, schema); }
Source:
public static PriceIndexCurveSimple fromStartOfMonth(final double[] nodeTimeKnown, final double[] indexKnown, final double[] nodeTimeOther, final double[] rate) { final int nbNode = nodeTimeKnown.length + nodeTimeOther.length; final double[] nodeTime = new double[nbNode]; System.arraycopy(nodeTimeKnown, 0, nodeTime, 0, nodeTimeKnown.length); System.arraycopy(nodeTimeOther, 0, nodeTime, nodeTimeKnown.length, nodeTimeOther.length); final double[] indexValue = new double[nbNode]; System.arraycopy(indexKnown, 0, indexValue, 0, nodeTimeKnown.length); final double[] nbYear = new double[nodeTimeOther.length]; for (int loopperiod = 0; loopperiod < nodeTimeOther.length; loopperiod++) { nbYear[loopperiod] = Math.round(nodeTimeOther[loopperiod] - nodeTimeKnown[0]); indexValue[nodeTimeKnown.length + loopperiod] = indexKnown[0] * Math.pow(1 + rate[loopperiod], nbYear[loopperiod]); } final InterpolatedDoublesCurve curve = InterpolatedDoublesCurve.from(nodeTime, indexValue, new LinearInterpolator1D()); return new PriceIndexCurveSimple(curve); }

Target:
public static PriceIndexCurveSimple fromStartOfMonth(final double[] nodeTimeKnown, final double[] indexKnown, final double[] nodeTimeOther, final double[] rate) { ArgumentChecker.notNull(nodeTimeKnown, "node times already fixed"); ArgumentChecker.notNull(indexKnown, "index values"); ArgumentChecker.notNull(nodeTimeOther, "node times"); final int nbNode = nodeTimeKnown.length + nodeTimeOther.length; final double[] nodeTime = new double[nbNode]; System.arraycopy(nodeTimeKnown, 0, nodeTime, 0, nodeTimeKnown.length); System.arraycopy(nodeTimeOther, 0, nodeTime, nodeTimeKnown.length, nodeTimeOther.length); final double[] indexValue = new double[nbNode]; System.arraycopy(indexKnown, 0, indexValue, 0, nodeTimeKnown.length); final double[] nbYear = new double[nodeTimeOther.length]; for (int loopperiod = 0; loopperiod < nodeTimeOther.length; loopperiod++) { nbYear[loopperiod] = Math.round(nodeTimeOther[loopperiod] - nodeTimeKnown[0]); indexValue[nodeTimeKnown.length + loopperiod] = indexKnown[0] * Math.pow(1 + rate[loopperiod], nbYear[loopperiod]); } final InterpolatedDoublesCurve curve = InterpolatedDoublesCurve.from(nodeTime, indexValue, new LinearInterpolator1D()); return new PriceIndexCurveSimple(curve); }
Source:
public void testRetrieveOfPreviousMultiPreparedPrimes() { MultiPrimeRequest pr = MultiPrimeRequest.request() .withWhen(when() .withQuery("select * from person where name = ?")) .withThen(then() .withVariableTypes(TEXT) .withOutcomes(outcome(match().withVariableMatchers(exactMatch().withMatcher("Chris").build()), action())) ) .build(); stubFor(get(urlEqualTo(PRIME_PREPARED_MULTI_PATH)).willReturn(aResponse().withStatus(200).withBody( "[{\"when\":{\"query\":\"select * from person where name \\u003d ?\"}," + "\"then\":{\"variable_types\":[\"text\"],\"outcomes\":[{\"criteria\":" + "{\"variable_matcher\":[{\"matcher\":\"Chris\",\"type\":\"exact\"}]},\"action\":{}}]}}]" ))); List<MultiPrimeRequest> primingRequests = underTest.retrievePreparedMultiPrimes(); assertEquals(1, primingRequests.size()); assertEquals(pr, primingRequests.get(0)); }

Target:
public void testRetrieveOfPreviousMultiPreparedPrimes() { MultiPrimeRequest pr = MultiPrimeRequest.request() .withWhen(when() .withQuery("select * from person where name = ?")) .withThen(then() .withVariableTypes(TEXT, TIMESTAMP, TIMEUUID) .withOutcomes(outcome(match().withVariableMatchers(exactMatch().withMatcher("Chris").build(), anyMatch()), action())) ) .build(); stubFor(get(urlEqualTo(PRIME_PREPARED_MULTI_PATH)).willReturn(aResponse().withStatus(200).withBody( "[{\"when\":{\"query\":\"select * from person where name \\u003d ?\"}," + "\"then\":{\"variable_types\":[\"text\", \"timestamp\", \"timeuuid\"],\"outcomes\":[{\"criteria\":" + "{\"variable_matcher\":[{\"matcher\":\"Chris\",\"type\":\"exact\"}, {\"type\":\"any\"}]},\"action\":{}}]}}]" ))); List<MultiPrimeRequest> primingRequests = underTest.retrievePreparedMultiPrimes(); assertEquals(1, primingRequests.size()); assertEquals(pr, primingRequests.get(0)); }
Source:
public void applyWayTags( OSMWay way, EdgeIteratorState edge ) { double speed = this.getSpeed(edge.getFlags()); double roadDistance = edge.getDistance(); double beelineDistance = getBeelineDistance(edge); PointList pointList = edge.fetchWayGeometry(3); if (beelineDistance < 50 || roadDistance < 100 || pointList.size() <= 2) { setBendiness(edge, 1); return; } double bendiness = beelineDistance / roadDistance; bendiness = discriminateSlowStreets(bendiness, speed); bendiness = preferSlopes(bendiness, edge); bendiness = increaseBendinessImpact(bendiness); bendiness = influenceBendinessByTags(bendiness, way); bendiness = correctErrors(bendiness); setBendiness(edge, bendiness); }

Target:
public void applyWayTags( OSMWay way, EdgeIteratorState edge ) { double speed = this.getSpeed(edge.getFlags()); double roadDistance = edge.getDistance(); double beelineDistance = getBeelineDistance(way); double bendiness = beelineDistance / roadDistance; bendiness = discriminateSlowStreets(bendiness, speed); bendiness = increaseBendinessImpact(bendiness); bendiness = correctErrors(bendiness); edge.setFlags(this.curvatureEncoder.setValue(edge.getFlags(), convertToInt(bendiness))); }
Source:
public String get() { if (SystemInfo.isWindows()) { if (volumeOptions == null) { volumeOptions="ro,Z"; } try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path path = Files.copy(Paths.get(wsAgentArchivePath), cheHome.resolve(WS_AGENT), REPLACE_EXISTING); return path.toString() + CONTAINER_TARGET + ":" + volumeOptions; } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return wsAgentArchivePath + CONTAINER_TARGET + ":" + volumeOptions; } }

Target:
public String get() { if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path path = Files.copy(Paths.get(wsAgentArchivePath), cheHome.resolve(WS_AGENT), REPLACE_EXISTING); return getTargetOptions(path.toString()); } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return getTargetOptions(wsAgentArchivePath); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_run_test); Intent intent = getIntent(); Uri data = intent.getData(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); String mv = uri.getQueryParameter("mv"); if (mv != null){ if (versionCompare(BuildConfig.VERSION_NAME, mv) >= 0) { Set<String> parameters = uri.getQueryParameterNames(); String tn = uri.getQueryParameter("tn"); String ta = uri.getQueryParameter("ta"); String td = uri.getQueryParameter("td"); String test = NetworkMeasurement.getTestName(this, tn); if (test.length() > 0){ test_name = tn; configureScreen(td, ta); } else { Alert.alertDialog(this, getString(R.string.invalid_parameter), getString(R.string.test_name) + " : " + tn); } } else { Alert.alertDialogTwoButtons(this, getString(R.string.ooniprobe_outdate), getString(R.string.ooniprobe_outdate_msg), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { final String appPackageName = getPackageName(); try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName))); } catch (android.content.ActivityNotFoundException anfe) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>" + appPackageName))); } } }); } } } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_run_test); urls = (TextView) findViewById(R.id.urls); runButton = (AppCompatButton) findViewById(R.id.run_test_button); title = (TextView) findViewById(R.id.run_test_message); testTitle = (TextView) findViewById(R.id.test_title); testImage = (ImageView) findViewById(R.id.test_logo); test_progress = (ProgressBar) findViewById(R.id.progressIndicator); testUrlList = (RecyclerView) findViewById(R.id.urlList); Intent intent = getIntent(); if (Intent.ACTION_VIEW.equals(intent.getAction())) { Uri uri = intent.getData(); String mv = uri.getQueryParameter("mv"); if (mv != null){ if (versionCompare(BuildConfig.VERSION_NAME, mv) >= 0) { String tn = uri.getQueryParameter("tn"); String ta = uri.getQueryParameter("ta"); String td = uri.getQueryParameter("td"); String test = NetworkMeasurement.getTestName(this, tn); if (test.length() > 0){ test_name = tn; configureScreen(td, ta); } else { Alert.alertDialogWithAction(this, getString(R.string.invalid_parameter), getString(R.string.test_name) + " : " + tn, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { goToMainActivity(); } }); } } else { Alert.alertDialogWithAction(this, getString(R.string.ooniprobe_outdate), getString(R.string.ooniprobe_outdate_msg), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { final String appPackageName = getPackageName(); try { openPlayStore("market://details?id=" + appPackageName); } catch (android.content.ActivityNotFoundException anfe) { openPlayStore("<LINK_0>" + appPackageName); } } }, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { goToMainActivity(); } }); } } } }
Source:
private String getDescription(long masterKeyId) { CachedPublicKeyRing cachedPublicKeyRing = mKeyRepository.getCachedPublicKeyRing(masterKeyId); String description = ""; long authSubKeyId = Constants.key.none; try { authSubKeyId = cachedPublicKeyRing.getSecretAuthenticationId(); description += cachedPublicKeyRing.getPrimaryUserId(); } catch (PgpKeyNotFoundException e) { e.printStackTrace(); } description += " ("+ Long.toHexString(authSubKeyId) +")"; return description; }

Target:
private String getDescription(long masterKeyId) throws PgpKeyNotFoundException { CachedPublicKeyRing cachedPublicKeyRing = mKeyRepository.getCachedPublicKeyRing(masterKeyId); String description = ""; long authSubKeyId = cachedPublicKeyRing.getSecretAuthenticationId(); description += cachedPublicKeyRing.getPrimaryUserId(); description += " (" + Long.toHexString(authSubKeyId) + ")"; return description; }
Source:
OrderedJsonObject toJson() { OrderedJsonObject debugState = new OrderedJsonObject(); debugState.put("packets_received", packetsReceived); debugState.put("receive_packet_rate_pps", receivePacketRate.getRate()); debugState.put("bytes_received", bytesReceived); debugState.put("receive_bitrate_bps", receiveBitRate.getRate()); debugState.put("incoming_packets_dropped", incomingPacketsDropped); debugState.put("packets_sent", packetsSent.sum()); debugState.put("send_packet_rate_pps", sendPacketRate.getRate()); debugState.put("bytes_sent", bytesSent); debugState.put("send_bitrate_bps", sendBitRate.getRate()); return debugState; }

Target:
OrderedJsonObject toJson() { OrderedJsonObject debugState = new OrderedJsonObject(); debugState.put("packets_received", packetsReceived); debugState.put("receive_packet_rate_pps", receivePacketRate.getRate()); debugState.put("bytes_received", bytesReceived); debugState.put("receive_bitrate_bps", receiveBitRate.getRate()); debugState.put("incoming_packets_dropped", incomingPacketsDropped); debugState.put("packets_sent", packetsSent.sum()); debugState.put("send_packet_rate_pps", sendPacketRate.getRate()); debugState.put("bytes_sent", bytesSent.sum()); debugState.put("send_bitrate_bps", sendBitRate.getRate()); return debugState; }
Source:
private void interpretBsh(final ReilInstruction instruction) { final Pair<Boolean, BigInteger> firstValue = loadLongValue(instruction.getFirstOperand()); final Pair<Boolean, BigInteger> secondValue = loadLongValue(instruction.getSecondOperand()); if (firstValue.first() && secondValue.first()) { final boolean isMsbSet = !(secondValue.second().and(BigInteger.valueOf(1 ).shiftLeft(instruction.getSecondOperand().getSize() .getBitSize()-1)).equals(BigInteger.ZERO)); BigInteger result = BigInteger.ZERO; if (secondValue.second().compareTo(BigInteger.ZERO) < 0) { result = firstValue.second().shiftRight(secondValue.second().negate().intValue()); } else if (isMsbSet) { result = firstValue.second().shiftRight( BigInteger.ZERO.subtract(secondValue.second()).and(BigInteger.valueOf(0xFF)) .intValue()); } else { result = firstValue.second().shiftLeft(secondValue.second().intValue()); } final String targetRegister = instruction.getThirdOperand().getValue(); final OperandSize targetSize = instruction.getThirdOperand().getSize(); setRegister(targetRegister, result, targetSize, ReilRegisterStatus.DEFINED); } else { assert false; } }

Target:
private void interpretBsh(final ReilInstruction instruction) { final Pair<Boolean, BigInteger> firstValue = loadLongValue(instruction.getFirstOperand()); final Pair<Boolean, BigInteger> secondValue = loadLongValue(instruction.getSecondOperand()); if (firstValue.first() && secondValue.first()) { final boolean isMsbSet = !(secondValue.second() .and(BigInteger.ONE .shiftLeft(instruction.getSecondOperand().getSize().getBitSize() - 1)) .equals(BigInteger.ZERO)); BigInteger result = BigInteger.ZERO; if (secondValue.second().compareTo(BigInteger.ZERO) < 0) { result = firstValue.second().shiftRight(secondValue.second().negate().intValue()); } else if (isMsbSet) { result = firstValue.second().shiftRight(BigInteger.ZERO.subtract(secondValue.second()) .and(BigInteger.valueOf(0xFF)).intValue()); } else { result = firstValue.second().shiftLeft(secondValue.second().intValue()); } final String targetRegister = instruction.getThirdOperand().getValue(); final OperandSize targetSize = instruction.getThirdOperand().getSize(); setRegister(targetRegister, result, targetSize, ReilRegisterStatus.DEFINED); } else { assert false; } }
Source:
private List<FileRef> convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response) { List<FileRef> fileRefs = new ArrayList<>(); if (response.value().segment() != null) { response.value().segment().directoryItems().forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); response.value().segment().fileItems().forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); } fileRefs.sort(Comparator.comparing(FileRef::name)); return fileRefs; }

Target:
private List<FileRef> convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response) { Set<FileRef> fileRefs = new TreeSet<>(Comparator.comparing(FileRef::name)); if (response.value().segment() != null) { response.value().segment().directoryItems() .forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); response.value().segment().fileItems() .forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); } return new ArrayList<>(fileRefs); }
Source:
public LoginResponse login(@Valid @RequestBody LoginRequest login, HttpServletRequest request) { if (login == null) { throw new HttpMessageNotReadableException("Missing login"); } if (userIs2fa()) { throw new BadCredentialsException( "two factor authentication is enabled, you cannot use /login via the RESTAPI anymore"); } return runAsSystem(() -> { UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(login.getUsername(), login.getPassword()); authToken.setDetails(new WebAuthenticationDetails(request)); Authentication authentication = authenticationManager.authenticate(authToken); if (!authentication.isAuthenticated()) { throw new BadCredentialsException("Unknown username or password"); } User user = dataService.findOne(USER, new QueryImpl<User>().eq(UserMetaData.USERNAME, authentication.getName()), User.class); SecurityContextHolder.getContext().setAuthentication(authentication); String token = tokenService.generateAndStoreToken(authentication.getName(), "Rest api login"); return new LoginResponse(token, user.getUsername(), user.getFirstName(), user.getLastName()); }); }

Target:
public LoginResponse login(@Valid @RequestBody LoginRequest login, HttpServletRequest request) { if (login == null) { throw new HttpMessageNotReadableException("Missing login"); } if (isUser2fa()) { throw new BadCredentialsException( "Login using /api/v1/login is disabled, two factor authentication is enabled"); } return runAsSystem(() -> { UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(login.getUsername(), login.getPassword()); authToken.setDetails(new WebAuthenticationDetails(request)); Authentication authentication = authenticationManager.authenticate(authToken); if (!authentication.isAuthenticated()) { throw new BadCredentialsException("Unknown username or password"); } User user = dataService.findOne(USER, new QueryImpl<User>().eq(UserMetaData.USERNAME, authentication.getName()), User.class); SecurityContextHolder.getContext().setAuthentication(authentication); String token = tokenService.generateAndStoreToken(authentication.getName(), "REST API login"); return new LoginResponse(token, user.getUsername(), user.getFirstName(), user.getLastName()); }); }
Source:
public AsyncFileAlterationObserver(File fileToObserve, ObjectPersistentStore serializer) { if (fileToObserve == null || serializer == null) { throw new IllegalArgumentException("Arguments can not be null"); } this.serializer = serializer; rootFile = new AsyncFileEntry(fileToObserve); if (LOGGER.isDebugEnabled()) { timer = new Timer(); timer.scheduleAtFixedRate(new LogProcessing(), 500, 5000); } }

Target:
public AsyncFileAlterationObserver(File fileToObserve, ObjectPersistentStore serializer) { if (fileToObserve == null || serializer == null) { throw new IllegalArgumentException("Arguments can not be null"); } this.serializer = serializer; rootFile = new AsyncFileEntry(fileToObserve); }
Source:
public boolean exists(K key) throws GoraException { LOG.debug("exists("+key+")"); try { return infinispanClient.containsKey(key); } catch (Exception e) { throw new GoraException(e); } }

Target:
public boolean exists(K key) throws GoraException { LOG.debug("exists({})", key); try { return infinispanClient.containsKey(key); } catch (Exception e) { throw new GoraException(e); } }
Source:
public String getValidityInfoForSizeCappedAlphanumericNonEmptyString(String fieldName, int maxLength, String value) { Assumption.assertTrue("Non-null value expected for "+fieldName, value != null); if (value.isEmpty()) { return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_EMPTY, fieldName, maxLength); } else if(value.length()>maxLength){ return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_TOO_LONG, fieldName, maxLength); } else if (StringHelper.isMatching(value, "^.*[^a-zA-Z0-9 ].*$")){ return String.format(ALPHANUMERIC_STRING_ERROR_MESSAGE, value, fieldName, fieldName); } return ""; }

Target:
public String getValidityInfoForSizeCappedAlphanumericNonEmptyString(String fieldName, int maxLength, String value) { Assumption.assertTrue("Non-null value expected for "+fieldName, value != null); if (value.isEmpty()) { return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_EMPTY, fieldName, maxLength); } else if (!isTrimmed(value)) { return String.format(WHITESPACE_ONLY_OR_EXTRA_WHITESPACE_ERROR_MESSAGE, fieldName); } else if(value.length()>maxLength){ return String.format(SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, value, fieldName, REASON_TOO_LONG, fieldName, maxLength); } else if (StringHelper.isMatching(value, "^.*[^a-zA-Z0-9 ].*$")){ return String.format(ALPHANUMERIC_STRING_ERROR_MESSAGE, value, fieldName, fieldName); } return ""; }
Source:
public static boolean mktextfile(String data, String path, String fileName) { File f = new File(path + "/" + fileName + ".txt"); FileOutputStream out = null; OutputStreamWriter outputWriter = null; if (f.exists()) { f.delete(); } try { f.createNewFile(); out = new FileOutputStream(f); outputWriter = new OutputStreamWriter(out); outputWriter.write(data); return true; } catch (IOException io) { Log.e(FileUtil.LOG, io.getMessage()); return false; } finally { try { outputWriter.close(); out.flush(); out.close(); } catch (IOException e) { Log.e(FileUtil.LOG, e.getMessage()); } } }

Target:
public static boolean mktextfile(String data, String path, String fileName) { File f = new File(path + "/" + fileName + ".txt"); FileOutputStream out = null; OutputStreamWriter outputWriter = null; try { f.createNewFile(); out = new FileOutputStream(f, false); outputWriter = new OutputStreamWriter(out); outputWriter.write(data); return true; } catch (IOException io) { Log.e(FileUtil.LOG, io.getMessage()); return false; } finally { try { outputWriter.close(); out.flush(); out.close(); } catch (IOException e) { Log.e(FileUtil.LOG, e.getMessage()); } } }