auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean applyDomainAttributes(Attributes attributes) throws NamingException { boolean retVal = false; Attribute attribute = attributes.get(RootDSEQueryInfo.DEFAULT_NAMING_CONTEXT_RESULT_ATTRIBUTE); if (attribute != null) { domainDN = (String) attribute.get(); ldapProviderType = LdapProviderType.activeDirectory; retVal = true; } else { Attribute namingContextAttribute = attributes.get(RootDSEQueryInfo.NAMING_CONTEXTS_RESULT_ATTRIBUTE); Attribute vendorNameAttribute = attributes.get(RootDSEQueryInfo.PROVIDER_TYPE_PROPERTY); if (namingContextAttribute != null) { domainDN = getDefaultNamingContextFromNamingContexts(namingContextAttribute); String vendorName = (String) vendorNameAttribute.get(0); if (vendorName.equals(RootDSEQueryInfo.IPA_VENDOR_NAME)) { ldapProviderType = LdapProviderType.ipa; } else if (vendorName.equals(RootDSEQueryInfo.RHDS_VENDOR_NAME)) { ldapProviderType = LdapProviderType.rhds; } retVal = true; } } return retVal; }

Target:
public boolean applyDomainAttributes(Attributes attributes) throws NamingException { boolean retVal = false; Attribute attribute = attributes.get(RootDSEQueryInfo.DEFAULT_NAMING_CONTEXT_RESULT_ATTRIBUTE); if (attribute != null) { domainDN = (String) attribute.get(); ldapProviderType = LdapProviderType.activeDirectory; retVal = true; } else { Attribute namingContextAttribute = attributes.get(RootDSEQueryInfo.NAMING_CONTEXTS_RESULT_ATTRIBUTE); Attribute vendorNameAttribute = attributes.get(RootDSEQueryInfo.PROVIDER_TYPE_PROPERTY); if (namingContextAttribute != null) { domainDN = getDefaultNamingContextFromNamingContexts(namingContextAttribute); String vendorName = (String) vendorNameAttribute.get(0); if (vendorName.equals(LdapVendorNameEnum.IPAVendorName.getName())) { ldapProviderType = LdapProviderType.ipa; } else if (vendorName.equals(LdapVendorNameEnum.RHDSVendorName.getName())) { ldapProviderType = LdapProviderType.rhds; } retVal = true; } } return retVal; }
Source:
public boolean deleteImage(String id) { try { AsyncCreateResponse deleteJob = client.getTemplateClient().deleteTemplate(id); boolean deleteComplete = jobComplete.apply(deleteJob.getJobId()); } catch (Exception e) { return false; } return true; }

Target:
public boolean deleteImage(String id) { try { AsyncCreateResponse deleteJob = client.getTemplateClient().deleteTemplate(id); jobComplete.apply(deleteJob.getJobId()); return true; } catch (Exception e) { return false; } }
Source:
private void fetchStockMedia(@Nullable String searchQuery, int page) { if (mIsFetching || !NetworkUtils.checkConnection(this)) { return; } if (TextUtils.isEmpty(searchQuery)) { mAdapter.clear(); return; } if (page == 1) { mAdapter.clear(); } showProgress(true); mIsFetching = true; showEmptyView(false); mSearchQuery = searchQuery; AppLog.d(AppLog.T.MEDIA, "Fetching stock media page " + page); StockMediaStore.FetchStockMediaListPayload payload = new StockMediaStore.FetchStockMediaListPayload(searchQuery, page); mDispatcher.dispatch(StockMediaActionBuilder.newFetchStockMediaAction(payload)); }

Target:
private void fetchStockMedia(@Nullable String searchQuery, int page) { if ((mIsFetching && page != 1) || !NetworkUtils.checkConnection(this)) { return; } mSearchQuery = searchQuery; if (mSearchQuery == null || mSearchQuery.length() < MIN_SEARCH_QUERY_SIZE) { mIsFetching = false; showProgress(false); mAdapter.clear(); showEmptyView(true); return; } if (page == 1) { mAdapter.clear(); } showProgress(true); mIsFetching = true; showEmptyView(false); AppLog.d(AppLog.T.MEDIA, "Fetching stock media page " + page); StockMediaStore.FetchStockMediaListPayload payload = new StockMediaStore.FetchStockMediaListPayload(searchQuery, page); mDispatcher.dispatch(StockMediaActionBuilder.newFetchStockMediaAction(payload)); }
Source:
protected Integer asEntity(String provided) { if (nullString == null || nullString.equals(provided)) { return null; } return provided == null ? null : Integer.parseInt(provided); }

Target:
protected Integer asEntity(String provided) { if (nullString == null || nullString.equals(provided)) { return null; } try { return provided == null ? null : Integer.parseInt(provided); } catch (NumberFormatException e) { throw new IllegalArgumentException(e); } }
Source:
public boolean hasColumn(ColumnName name) { boolean result = storageFields.containsKey(name); return result; }

Target:
public final boolean hasColumn(ColumnName name) { boolean result = storageFields.containsKey(name); return result; }
Source:
public void startScanner(final ContainerSpecKey containerSpecKey, long interval) { ServerTemplate serverTemplate = templateStorage.load(containerSpecKey.getServerTemplateKey().getId()); if (serverTemplate == null) { throw new RuntimeException("No server template found for id " + containerSpecKey.getServerTemplateKey().getId()); } org.kie.server.controller.api.model.spec.ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecKey.getId()); ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.RULE); if (containerConfig == null) { containerConfig = new RuleConfig(); containerSpec.getConfigs().put(Capability.RULE, containerConfig); } ((RuleConfig) containerConfig).setPollInterval(interval); ((RuleConfig) containerConfig).setScannerStatus(KieScannerStatus.STARTED); templateStorage.update(serverTemplate); List<Container> containers = kieServerInstanceManager.startScanner(serverTemplate, containerSpec, interval); notificationService.notify(serverTemplate, containerSpec, containers); }

Target:
public void startScanner(final ContainerSpecKey containerSpecKey, long interval) { ServerTemplate serverTemplate = templateStorage.load(containerSpecKey.getServerTemplateKey().getId()); if (serverTemplate == null) { throw new RuntimeException("No server template found for id " + containerSpecKey.getServerTemplateKey().getId()); } ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecKey.getId()); ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.RULE); if (containerConfig == null) { containerConfig = new RuleConfig(); containerSpec.getConfigs().put(Capability.RULE, containerConfig); } ((RuleConfig) containerConfig).setPollInterval(interval); ((RuleConfig) containerConfig).setScannerStatus(KieScannerStatus.STARTED); templateStorage.update(serverTemplate); List<Container> containers = kieServerInstanceManager.startScanner(serverTemplate, containerSpec, interval); notificationService.notify(serverTemplate, containerSpec, containers); }
Source:
protected void waitForResponse(Game game) { if(!recordingMacro && pullResponseFromQueue(game)) return; response.clear(); logger.debug("Waiting response from player: " + getId()); game.resumeTimer(getTurnControlledBy()); synchronized (response) { try { response.wait(); logger.debug("Got response from player: " + getId()); } catch (InterruptedException ex) { logger.error("Response error for player " + getName() + " gameId: " + game.getId(), ex); } finally { game.pauseTimer(getTurnControlledBy()); } } if (recordingMacro && !macroTriggeredSelectionFlag) { logger.debug("Adding an action " + response); actionQueueSaved.add(new PlayerResponse(response)); } }

Target:
protected void waitForResponse(Game game) { if (isExecutingMacro()) { pullResponseFromQueue(game); return; } response.clear(); logger.debug("Waiting response from player: " + getId()); game.resumeTimer(getTurnControlledBy()); synchronized (response) { try { response.wait(); logger.debug("Got response from player: " + getId()); } catch (InterruptedException ex) { logger.error("Response error for player " + getName() + " gameId: " + game.getId(), ex); } finally { game.pauseTimer(getTurnControlledBy()); } } if (recordingMacro && !macroTriggeredSelectionFlag) { logger.debug("Adding an action " + response); actionQueueSaved.add(new PlayerResponse(response)); } }
Source:
public JType generate(JCodeModel codeModel, String className, String packageName, String json) throws IOException { JPackage jpackage = codeModel._package(packageName); ObjectMapper mapper = new ObjectMapper(); JsonNode schemaNode = null; switch (ruleFactory.getGenerationConfig().getSourceType()) { case JSON: JsonNode jsonNode = mapper.readTree(json); schemaNode = schemaGenerator.schemaFromExample(jsonNode); break; default: schemaNode = mapper.readTree(json); break; } return ruleFactory.getSchemaRule().apply(className, schemaNode, jpackage, new Schema(null, schemaNode, schemaNode)); }

Target:
public JType generate(JCodeModel codeModel, String className, String packageName, String json) throws IOException { JPackage jpackage = codeModel._package(packageName); ObjectMapper mapper = new ObjectMapper(); JsonNode schemaNode = null; if (ruleFactory.getGenerationConfig().getSourceType() == SourceType.JSON) { JsonNode jsonNode = mapper.readTree(json); schemaNode = schemaGenerator.schemaFromExample(jsonNode); } else { schemaNode = mapper.readTree(json); } return ruleFactory.getSchemaRule().apply(className, schemaNode, jpackage, new Schema(null, schemaNode, schemaNode)); }
Source:
public void postProcessData(Process process, Map<URI, Object> dataMap, GroovyObject groovyObject){ for (Field field : groovyObject.getClass().getDeclaredFields()) { if (field.getAnnotation(OutputAttribute.class) != null) { field.setAccessible(true); DescriptionTypeAttribute annot = field.getAnnotation(DescriptionTypeAttribute.class); URI uri; if(annot != null && !annot.identifier().equals("")) { uri = URI.create(annot.identifier()); } else{ uri = URI.create(process.getIdentifier() + ":output:" + field.getName()); } try { dataMap.put(uri, field.get(groovyObject)); } catch (IllegalAccessException e) { dataMap.put(uri, null); LoggerFactory.getLogger(ProcessingManager.class).error(e.getMessage()); } } } ProcessingData prossData; for(Input input : process.getInput()){ if((prossData = getProcessingData(input.getDataDescription().getClass())) != null) { prossData.postProcessing(input, dataMap, toolBox); } } for(Output output : process.getOutput()){ if((prossData = getProcessingData(output.getDataDescription().getClass())) != null) { prossData.postProcessing(output, dataMap, toolBox); } } }

Target:
public void postProcessData(Process process, Map<URI, Object> dataMap, GroovyObject groovyObject){ for (Field field : groovyObject.getClass().getDeclaredFields()) { if (field.getAnnotation(OutputAttribute.class) != null) { field.setAccessible(true); DescriptionTypeAttribute annot = field.getAnnotation(DescriptionTypeAttribute.class); URI uri; if(annot != null && !annot.identifier().isEmpty()) { uri = URI.create(annot.identifier()); } else{ uri = URI.create(process.getIdentifier() + ":output:" + field.getName()); } try { dataMap.put(uri, field.get(groovyObject)); } catch (IllegalAccessException e) { dataMap.put(uri, null); LoggerFactory.getLogger(ProcessingManager.class).error(e.getMessage()); } } } ProcessingData prossData; for(Input input : process.getInput()){ if((prossData = getProcessingData(input.getDataDescription().getClass())) != null) { prossData.postProcessing(input, dataMap, toolBox); } } for(Output output : process.getOutput()){ if((prossData = getProcessingData(output.getDataDescription().getClass())) != null) { prossData.postProcessing(output, dataMap, toolBox); } } }
Source:
public static <T extends Resource> Flux<IDocumentQueryExecutionComponent<T>> createAsync( Function<String, Flux<IDocumentQueryExecutionComponent<T>>> createSourceComponentFunction, DistinctQueryType distinctQueryType, String continuationToken) { if (distinctQueryType == DistinctQueryType.Ordered) { CosmosClientException dce = new BadRequestException("Ordered distinct queries are not supported yet"); return Flux.error(dce); } Utils.ValueHolder<DistinctContinuationToken> outDistinctcontinuationtoken = new Utils.ValueHolder<>(); DistinctContinuationToken distinctContinuationToken = new DistinctContinuationToken(null , null ); if (continuationToken != null) { if (!DistinctContinuationToken.tryParse(continuationToken, outDistinctcontinuationtoken)) { return Flux.error(new BadRequestException("Invalid DistinctContinuationToken" + continuationToken)); } else { distinctContinuationToken = outDistinctcontinuationtoken.v; if (distinctQueryType != DistinctQueryType.Ordered && distinctContinuationToken.getLastHash() != null) { CosmosClientException dce = new BadRequestException("DistinctContinuationToken is malformed." + " DistinctContinuationToken can not" + " have a 'lastHash', when the query" + " type is not ordered (ex SELECT " + "DISTINCT VALUE c.blah FROM c ORDER" + " BY c.blah)."); return Flux.error(dce); } } } final String continuationTokenLastHash = distinctContinuationToken.getLastHash(); return createSourceComponentFunction.apply(distinctContinuationToken.getSourceToken()).map(component -> { return new DistinctDocumentQueryExecutionContext<T>(component, distinctQueryType, continuationTokenLastHash); }); }

Target:
public static <T extends Resource> Flux<IDocumentQueryExecutionComponent<T>> createAsync( Function<String, Flux<IDocumentQueryExecutionComponent<T>>> createSourceComponentFunction, DistinctQueryType distinctQueryType, String continuationToken) { Utils.ValueHolder<DistinctContinuationToken> outDistinctcontinuationtoken = new Utils.ValueHolder<>(); DistinctContinuationToken distinctContinuationToken = new DistinctContinuationToken(null , null ); if (continuationToken != null) { if (!DistinctContinuationToken.tryParse(continuationToken, outDistinctcontinuationtoken)) { return Flux.error(new BadRequestException("Invalid DistinctContinuationToken" + continuationToken)); } else { distinctContinuationToken = outDistinctcontinuationtoken.v; if (distinctQueryType != DistinctQueryType.ORDERED && distinctContinuationToken.getLastHash() != null) { CosmosClientException dce = new BadRequestException("DistinctContinuationToken is malformed." + " DistinctContinuationToken can not" + " have a 'lastHash', when the query" + " type is not ordered (ex SELECT " + "DISTINCT VALUE c.blah FROM c ORDER" + " BY c.blah)."); return Flux.error(dce); } } } final String continuationTokenLastHash = distinctContinuationToken.getLastHash(); return createSourceComponentFunction.apply(distinctContinuationToken.getSourceToken()).map(component -> { return new DistinctDocumentQueryExecutionContext<T>(component, distinctQueryType, continuationTokenLastHash); }); }
Source:
public static Integer getSleepScoreDurationV4(final long accountId, final float sleepDurationScoreV3, final MotionFrequency motionFrequency, final Integer timesAwake, final int agitatedSleepDuration) { final float maxMotionFreq = 0.25f; final int maxTimesAwake = 6; final int maxAgitatedSleep = 45; final float rawScore = DURATION_WEIGHTS_V4[0] + DURATION_WEIGHTS_V4[1] * sleepDurationScoreV3 + DURATION_WEIGHTS_V4[2] * Math.min(agitatedSleepDuration, maxAgitatedSleep) + DURATION_WEIGHTS_V4[3] * Math.min(motionFrequency.motionFrequencyFirstPeriod, maxMotionFreq) + DURATION_WEIGHTS_V4[4] * Math.min( motionFrequency.motionFrequencyMiddlePeriod, maxMotionFreq) + DURATION_WEIGHTS_V4[5] * Math.min(motionFrequency.motionFrequencyLastPeriod, maxMotionFreq) + DURATION_WEIGHTS_V4[6] * Math.min(timesAwake, maxTimesAwake); final int durationScorev4 = (int) Math.max(Math.min(rawScore * .95 + 21, 90), 50); LOGGER.info("action=calculated-durationscore-v4 account_id={} sleep_duration_score_v3={} motion_frequency={} awake_times={} agitated_sleep_duration={} durationscore_v4={}", accountId, sleepDurationScoreV3, motionFrequency, timesAwake, agitatedSleepDuration, durationScorev4); return durationScorev4; }

Target:
public static Integer getSleepScoreDurationV4(final long accountId, final float sleepDurationScoreV3, final MotionFrequency motionFrequency, final Integer timesAwake, final int agitatedSleepDuration) { final float maxMotionFreq = 0.25f; final int maxTimesAwake = 6; final int maxAgitatedSleep = 45; final float rawScore = DURATION_WEIGHTS_V4[0] + DURATION_WEIGHTS_V4[1] * sleepDurationScoreV3 + DURATION_WEIGHTS_V4[2] * Math.min(agitatedSleepDuration, maxAgitatedSleep) + DURATION_WEIGHTS_V4[3] * Math.min(motionFrequency.motionFrequencyFirstPeriod, maxMotionFreq) + DURATION_WEIGHTS_V4[4] * Math.min( motionFrequency.motionFrequencyMiddlePeriod, maxMotionFreq) + DURATION_WEIGHTS_V4[5] * Math.min(motionFrequency.motionFrequencyLastPeriod, maxMotionFreq) + DURATION_WEIGHTS_V4[6] * Math.min(timesAwake, maxTimesAwake); final int durationScorev4 = (int) Math.max(Math.min(rawScore * .95 + 21, 90), 50); LOGGER.trace("action=calculated-durationscore-v4 account_id={} sleep_duration_score_v3={} motion_frequency={} awake_times={} agitated_sleep_duration={} durationscore_v4={}", accountId, sleepDurationScoreV3, motionFrequency.motionFrequency, timesAwake, agitatedSleepDuration, durationScorev4); return durationScorev4; }
Source:
Statistic buildAndRegister() throws IllegalStateException; interface Simple extends StatisticBuilder { @Override Simple translation(Translation translation); @Override Simple id(String id); Simple unit(StatisticUnit unit); Simple type(StatisticType type); }

Target:
Statistic buildAndRegister() throws IllegalStateException; interface EntityStatisticBuilder extends StatisticBuilder { EntityStatisticBuilder entity(EntityType entity); @Override EntityStatisticBuilder name(String name); @Override EntityStatisticBuilder translation(Translation translation); @Override EntityStatisticBuilder format(@Nullable StatisticFormat format); @Override EntityStatisticBuilder group(StatisticGroup group); @Override EntityStatistic buildAndRegister() throws IllegalStateException; }
Source:
public CommentSecurityException() { super(); this.statusCode = SC_FORBIDDEN; }

Target:
public CommentSecurityException() { super(SC_FORBIDDEN); }
Source:
private static boolean from(final String strval) throws PSQLException { final String val = strval.trim(); if ("1".equals(val) || "true".equalsIgnoreCase(val) || "t".equalsIgnoreCase(val) || "yes".equalsIgnoreCase(val) || "y".equalsIgnoreCase(val) || "on".equalsIgnoreCase(val)) { return true; } if ("0".equals(val) || "false".equalsIgnoreCase(val) || "f".equalsIgnoreCase(val) || "no".equalsIgnoreCase(val) || "n".equalsIgnoreCase(val) || "off".equalsIgnoreCase(val)) { return false; } throw cannotCastException("String"); }

Target:
private static boolean from(final String strval) throws PSQLException { final String val = strval.trim(); if ("1".equals(val) || "true".equalsIgnoreCase(val) || "t".equalsIgnoreCase(val) || "yes".equalsIgnoreCase(val) || "y".equalsIgnoreCase(val) || "on".equalsIgnoreCase(val)) { return true; } if ("0".equals(val) || "false".equalsIgnoreCase(val) || "f".equalsIgnoreCase(val) || "no".equalsIgnoreCase(val) || "n".equalsIgnoreCase(val) || "off".equalsIgnoreCase(val)) { return false; } throw cannotCoerceException("String", val); }
Source:
public void warmup() throws InterruptedException { for (int k = 0; k < keyCount; k++) { int id = random.nextInt(); String key = StringUtils.generateString(keyLength); String name = names[random.nextInt(names.length)]; Employee value = createEmployee(id,name); map.put(key, value); } log.info("Map size is:" + map.size()); }

Target:
public void warmup() throws InterruptedException { Random random = new Random(); for (int k = 0; k < keyCount; k++) { int id = random.nextInt(); String key = StringUtils.generateString(keyLength); String name = names[random.nextInt(names.length)]; Employee value = createEmployee(id,name); map.put(key, value); } log.info("Map size is:" + map.size()); }
Source:
public int doWork() { if (OUTPUT.endsWith(".")) { OUTPUT = OUTPUT.substring(0, OUTPUT.length() - 1); } final List<SinglePassSamProgram> programs = new ArrayList<SinglePassSamProgram>(); for (final ProgramInterface program : new HashSet<ProgramInterface>(programsToRun)) { if (program.needsReferenceSequence() && REFERENCE_SEQUENCE==null) { throw new PicardException("A program you are trying to run needs a Reference Sequence, please set REFERENCE_SEQUENCE in the command line"); } final SinglePassSamProgram instance = program.makeInstance(OUTPUT, INPUT, REFERENCE_SEQUENCE); instance.INPUT = INPUT; instance.REFERENCE_SEQUENCE = REFERENCE_SEQUENCE; instance.setDefaultHeaders(getDefaultHeaders()); programs.add(instance); } SinglePassSamProgram.makeItSo(INPUT, REFERENCE_SEQUENCE, ASSUME_SORTED, STOP_AFTER, programs); return 0; }

Target:
public int doWork() { if (OUTPUT.endsWith(".")) { OUTPUT = OUTPUT.substring(0, OUTPUT.length() - 1); } final List<SinglePassSamProgram> programs = new ArrayList<SinglePassSamProgram>(); for (final ProgramInterface program : new HashSet<ProgramInterface>(programsToRun)) { if (program.needsReferenceSequence() && REFERENCE_SEQUENCE==null) { throw new PicardException("The " + program.toString() + " program needs a Reference Sequence, please set REFERENCE_SEQUENCE in the command line"); } final SinglePassSamProgram instance = program.makeInstance(OUTPUT, INPUT, REFERENCE_SEQUENCE); instance.INPUT = INPUT; instance.REFERENCE_SEQUENCE = REFERENCE_SEQUENCE; instance.setDefaultHeaders(getDefaultHeaders()); programs.add(instance); } SinglePassSamProgram.makeItSo(INPUT, REFERENCE_SEQUENCE, ASSUME_SORTED, STOP_AFTER, programs); return 0; }
Source:
protected void addProcessIdentityProcessListener(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) { final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer); descriptor.getBuilder().addEventListener( new NamedObjectModel( "mvel", "processIdentity", "new org.jbpm.kie.services.impl.IdentityProviderAwareProcessListener(ksession)" ) ); unit.setDeploymentDescriptor(descriptor); }

Target:
protected void addProcessIdentityProcessListener(final KModuleDeploymentUnit unit, final InternalKieContainer kieContainer) { final DeploymentDescriptor descriptor = getDeploymentDescriptor(unit, kieContainer); descriptor.getBuilder().addEventListener( new ObjectModel( "mvel", "new org.jbpm.kie.services.impl.IdentityProviderAwareProcessListener(ksession)" ) ); unit.setDeploymentDescriptor(descriptor); }
Source:
public void jsr107WriterGetsRegistered() { MutableConfiguration<Object, Object> configuration = new MutableConfiguration<Object, Object>(); CacheWriter<Object, Object> mock = mock(CacheWriter.class); RecordingFactory<CacheWriter<Object, Object>> factory = factoryOf(mock); configuration.setWriteThrough(true).setCacheWriterFactory(factory); merger.mergeConfigurations("cache", configuration); assertThat(factory.called, is(true)); verify(cacheLoaderWriterFactory).registerJsr107Loader(eq("cache"), ArgumentMatchers.<CacheLoaderWriter<Object, Object>>any()); }

Target:
public void jsr107WriterGetsRegistered() { MutableConfiguration<Object, Object> configuration = new MutableConfiguration<Object, Object>(); CacheWriter<Object, Object> mock = mock(CacheWriter.class); RecordingFactory<CacheWriter<Object, Object>> factory = factoryOf(mock); configuration.setWriteThrough(true).setCacheWriterFactory(factory); merger.mergeConfigurations("cache", configuration); assertThat(factory.called, is(true)); verify(cacheLoaderWriterFactory).registerJsr107Loader(eq("cache"), ArgumentMatchers.<CacheLoaderWriter<Object, Object>>isNotNull()); }
Source:
public void flush() throws IOException { buffer.flip(); ByteBuffer byteBuffer = java.nio.charset.StandardCharsets.UTF_8.encode( buffer ); out.write( byteBuffer ); buffer.clear(); }

Target:
public void flush() throws IOException { buffer.flip(); ByteBuffer byteBuffer = StandardCharsets.UTF_8.encode( buffer ); out.consume( byteBuffer ); buffer.clear(); }
Source:
public Job loadInitalJobContent(final JobId jobId) { return executeReadOnlyTransaction(session -> { long id = jobId(jobId); Query query = session.getNamedQuery("loadJobContent").setLong("id", id); if (query.uniqueResult() == null) { throw new DatabaseManagerException("Invalid job id: " + jobId); } JobContent jobContent = (JobContent) query.uniqueResult(); return jobContent.getInitJobContent(); }); }

Target:
public Job loadInitalJobContent(final JobId jobId) { return executeReadOnlyTransaction(session -> { long id = jobId(jobId); Query query = session.getNamedQuery("loadJobContent").setLong("id", id); if (query.uniqueResult() == null) { throw new DatabaseManagerException("Invalid job id: " + jobId.value()); } JobContent jobContent = (JobContent) query.uniqueResult(); final TaskFlowJob initJobContent = jobContent.getInitJobContent(); if (initJobContent == null) { throw new DatabaseManagerException("Job content should not be null for job id: " + jobId.value()); } return initJobContent; }); }
Source:
public static Builder builder(URL endpoint) { return new Builder(endpoint, AuthSchemes.BASIC); }

Target:
public static Builder builder(URL endpoint) { return new Builder(endpoint, AuthSchemes.NTLM); }
Source:
public void invite(final String friend) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO friend (bout, alias, subscription) VALUES (?, ?, ?)") .set(this.bout) .set(friend) .set(1) .insert(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } }

Target:
public void invite(final String friend) throws IOException { try { new JdbcSession(this.sql.source()) .sql("INSERT INTO friend (bout, alias, subscription) VALUES (?, ?, ?)") .set(this.bout) .set(friend) .set(true) .insert(Outcome.VOID); } catch (final SQLException ex) { throw new IOException(ex); } }
Source:
public RecordWriter getRecordWriter(final HdfsSinkConnectorConfig conf, final String filename) { try { return new RecordWriter() { final Path path = new Path(filename); final OutputStream out = FileSystem.newInstance(path.toUri(), conf.getHadoopConfiguration()).create(path); final JsonGenerator writer = mapper.getFactory() .createGenerator(out) .setRootValueSeparator(null); @Override public void write(SinkRecord record) { log.trace("Sink record: {}", record.toString()); try { Object value = record.value(); if (value instanceof Struct) { byte[] rawJson = converter.fromConnectData( record.topic(), record.valueSchema(), value ); out.write(rawJson); out.write(LINE_SEPARATOR_BYTES); } else { writer.writeObject(value); writer.writeRaw(LINE_SEPARATOR); } } catch (IOException e) { throw new ConnectException(e); } } @Override public void commit() @Override public void close() { try { writer.close(); out.close(); } catch (IOException e) { throw new ConnectException(e); } } }; } catch (IOException e) { throw new ConnectException(e); } }

Target:
public RecordWriter getRecordWriter(final HdfsSinkConnectorConfig conf, final String filename) { try { return new RecordWriter() { final Path path = new Path(filename); final FileSystem fs = FileSystem.newInstance(path.toUri(), conf.getHadoopConfiguration()); final OutputStream out = fs.create(path); final JsonGenerator writer = mapper.getFactory() .createGenerator(out) .setRootValueSeparator(null); @Override public void write(SinkRecord record) { log.trace("Sink record: {}", record.toString()); try { Object value = record.value(); if (value instanceof Struct) { byte[] rawJson = converter.fromConnectData( record.topic(), record.valueSchema(), value ); out.write(rawJson); out.write(LINE_SEPARATOR_BYTES); } else { writer.writeObject(value); writer.writeRaw(LINE_SEPARATOR); } } catch (IOException e) { throw new ConnectException(e); } } @Override public void commit() @Override public void close() { IOException error = null; try { writer.close(); } catch (IOException e) { error = e; throw new ConnectException(e); } finally { try { fs.close(); } catch (IOException e) { if (error == null) { throw new ConnectException(e); } } } } }; } catch (IOException e) { throw new ConnectException(e); } }
Source:
public void shouldReenrollSubject() throws IOException { try { fakeNow(newDateTime(2015, 8, 1, 0, 0, 0)); InputStream inputStream = getClass().getResourceAsStream("/enroll1.csv"); raveImportService.importCsv(new InputStreamReader(inputStream), "/enroll1.csv"); inputStream.close(); Subject subject = createSubjectWithRequireData("1"); subjectService.createOrUpdateForZetes(subject); SubjectEnrollments subjectEnrollments = subjectEnrollmentsDataService.findEnrollmentBySubjectId(subject.getSubjectId()); assertEquals(9, subjectEnrollments.getEnrollments().size()); checkEnrollmentServiceContent(subject); for(Visit visit : subjectEnrollments.getSubject().getVisits()) { ebodacEnrollmentService.reenrollSubject(visit); } subjectEnrollments = subjectEnrollmentsDataService.findEnrollmentBySubjectId(subject.getSubjectId()); checkEnrollmentsStatus(EnrollmentStatus.ENROLLED, EnrollmentStatus.ENROLLED, subjectEnrollments.getSubject()); } finally { stopFakingTime(); } }

Target:
public void shouldReenrollSubject() throws IOException { try { fakeNow(newDateTime(2015, 8, 1, 0, 0, 0)); Subject subject = createSubjectWithRequireData("1"); InputStream inputStream = getClass().getResourceAsStream("/enrollSimple.csv"); raveImportService.importCsv(new InputStreamReader(inputStream), "/enrollSimple.csv"); inputStream.close(); List<Enrollment> enrollmentList = enrollmentDataService.findEnrollmentsBySubjectId("1"); for(Enrollment enrollment : enrollmentList) { assertEquals(new LocalDate(2015, 10, 10), enrollment.getReferenceDate()); } subject = subjectService.findSubjectBySubjectId("1"); for(Visit visit : subject.getVisits()) { visit.setMotechProjectedDate(new LocalDate(2015, 10, 11)); ebodacEnrollmentService.reenrollSubject(visit); } SubjectEnrollments subjectEnrollments = subjectEnrollmentsDataService.findEnrollmentBySubjectId("1"); for( Enrollment enrollment : subjectEnrollments.getEnrollments()) { assertEquals(new LocalDate(2015, 10, 11), enrollment.getReferenceDate()); } } finally { stopFakingTime(); } }
Source:
private void checkIndex(int index) { if ((index - offset) < 0 || (index - offset) >= array.length) { throw new ArrayIndexOutOfBoundsException("The requested index is out of counter bounds."); } }

Target:
private void checkIndex(int index) { if ((index - offset) < 0 || (index - offset) >= array.length) { throw new ArrayIndexOutOfBoundsException("The requested index " + index + " is out of counter bounds. " + "Possible cause of exception can be wrong READ_LENGTH parameter (much smaller than actual read length)"); } }
Source:
private void fillValues(final Repository repository) throws IOException { gitDir.setText(repository.getDirectory().getAbsolutePath()); branch.setText(repository.getBranch()); workDir.setText(repository.getWorkTree().getAbsolutePath()); state.setText(repository.getRepositoryState().getDescription()); final ObjectId objectId = repository .resolve(repository.getFullBranch()); if (objectId == null) { if (repository.getAllRefs().size() == 0) headLink.setText(UIText.GitProjectPropertyPage_ValueEmptyRepository); else headLink.setText(UIText.GitProjectPropertyPage_ValueUnbornBranch); } else { headLink.setText(objectId.name()); headLink.setUnderlined(true); headLink.setFont(JFaceResources.getDialogFont()); headLink.setForeground(JFaceColors.getHyperlinkText(headLink .getDisplay())); headLink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { RepositoryCommit commit = getCommit(repository, objectId); if(commit != null) { CommitEditor.openQuiet(commit); } } }); } }

Target:
private void fillValues(final Repository repository) throws IOException { gitDir.setText(repository.getDirectory().getAbsolutePath()); branch.setText(repository.getBranch()); workDir.setText(repository.getWorkTree().getAbsolutePath()); state.setText(repository.getRepositoryState().getDescription()); }
Source:
public void formFinishedLoading() { if (currentState == BackgroundLocationState.NOT_APPLICABLE) { if (helper.currentFormCollectsBackgroundLocation()) { currentState = BackgroundLocationState.APPLICABLE; } } }

Target:
public void formFinishedLoading() { switch (currentState) { case NO_BACKGROUND_LOCATION_NEEDED: if (helper.currentFormCollectsBackgroundLocation()) { currentState = BackgroundLocationState.PENDING_PRECONDITION_CHECKS; } } }
Source:
public void getAllChannelsShouldReturnEmptyListWhenThereAreNoChannels() { given(channelRepository.findAll()).willReturn(EMPTY_CHANNEL_ENTITY_LIST); given(modelMapper.map(EMPTY_CHANNEL_ENTITY_LIST, CHANNEL_DTO_LIST_TYPE)) .willReturn(EMPTY_CHANNEL_DTO_LIST); Collection<ChannelDTO> channels = channelService.getAllChannels(); assertThat(channels, notNullValue()); assertTrue(channels.isEmpty()); then(channelRepository).should(times(1)).findAll(); }

Target:
public void getAllChannelsShouldReturnEmptyListWhenThereAreNoChannels() { given(channelRepository.findAll()).willReturn(EMPTY_CHANNEL_ENTITY_LIST); given(modelMapper.map(EMPTY_CHANNEL_ENTITY_LIST, CHANNEL_DTO_LIST_TYPE)) .willReturn(EMPTY_CHANNEL_DTO_LIST); Collection<ChannelDTO> channels = channelService.getAllChannels(); assertThat(channels, notNullValue()); assertTrue(channels.isEmpty()); then(channelRepository).should().findAll(); then(modelMapper).should().map(EMPTY_CHANNEL_ENTITY_LIST, CHANNEL_DTO_LIST_TYPE); }
Source:
public abstract Item doCreateItem( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException; public Categories doCategories(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { return ItemGroupMixIn.getCategories(Jenkins.getAuthentication(), Jenkins.getInstance()); }

Target:
public abstract Item doCreateItem( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException; @Restricted(DoNotUse.class) public Categories doCategories(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { Categories categories = new Categories(); int order = 0; for (TopLevelItemDescriptor descriptor : DescriptorVisibilityFilter.apply(getOwnerItemGroup(), Items.all(Jenkins.getAuthentication(), getOwnerItemGroup()))) { ItemCategory ic = ItemCategory.getCategory(descriptor); Map<String, Serializable> metadata = new HashMap<String, Serializable>(); metadata.put("class", descriptor.getId()); metadata.put("order", ++order); metadata.put("displayName", descriptor.getDisplayName()); metadata.put("description", descriptor.getDescription()); metadata.put("iconFilePathPattern", descriptor.getIconFilePathPattern()); Category category = categories.getItem(ic.getId()); if (category != null) { category.getItems().add(metadata); } else { List<Map<String, Serializable>> temp = new ArrayList<Map<String, Serializable>>(); temp.add(metadata); category = new Category(ic.getId(), ic.getDisplayName(), ic.getDescription(), ic.getOrder(), ic.getMinToShow(), temp); categories.getItems().add(category); } } return categories; }
Source:
@Test public void showRedaction() throws Exception { ScopedSpan span = tracing.tracer().startScopedSpan("auditor"); try { span.tag("a", "1"); span.tag("b", "912-23-1433"); span.annotate("SSN=912-23-1433"); span.tag("c", "3"); } finally { span.finish(); } Span finished = spans.take(); assertThat(finished.tags()).containsExactly( entry("a", "1"), entry("c", "3") ); assertThat(finished.annotations()).flatExtracting(Annotation::value).containsExactly( "SSN=xxx-xx-xxxx" ); tracing.tracer().toSpan(span.context()).tag("d", "SSN=912-23-1433"); span = null; blockOnGC(); tracing.tracer().nextSpan().start().finish(); Span leaked = spans.take(); assertThat(leaked.tags()).containsExactly( entry("d", "SSN=xxx-xx-xxxx") ); assertThat(leaked.annotations()).flatExtracting(Annotation::value).containsExactly( "brave.flush" ); }

Target:
@Test public void showRedaction() throws Exception { ScopedSpan span = tracing.tracer().startScopedSpan("auditor"); try { span.tag("a", "1"); span.tag("b", "4121-2319-1483-3421"); span.annotate("cc=4121-2319-1483-3421"); span.tag("c", "3"); } finally { span.finish(); } Span finished = spans.take(); assertThat(finished.tags()).containsExactly( entry("a", "1"), entry("c", "3") ); assertThat(finished.annotations()).flatExtracting(Annotation::value).containsExactly( "cc=xxxx-xxxx-xxxx-xxxx" ); tracing.tracer().toSpan(span.context()).tag("d", "cc=4121-2319-1483-3421"); span = null; blockOnGC(); tracing.tracer().nextSpan().abandon(); Span leaked = spans.take(); assertThat(leaked.tags()).containsExactly( entry("d", "cc=xxxx-xxxx-xxxx-xxxx") ); assertThat(leaked.annotations()).flatExtracting(Annotation::value).containsExactly( "brave.flush" ); }
Source:
public void writePacket(byte[] buf, int pos, int len) throws IOException { formatLength(len + 4); out.write(lenbuffer, 0, 4); out.write(buf, pos, len); log.debug("git> " + RawParseUtils.decode(Constants.CHARSET, buf, pos, len)); }

Target:
public void writePacket(byte[] buf, int pos, int len) throws IOException { formatLength(len + 4); out.write(lenbuffer, 0, 4); out.write(buf, pos, len); if (log.isDebugEnabled()) { String s = RawParseUtils.decode(Constants.CHARSET, buf, pos, len); log.debug("git> " + s); } }
Source:
public void forward() { content.setConstraintX(SizeValue.px(content.getConstraintX().getValueAsInt(1.f) + 64)); }

Target:
public void forward() { int cX = content.getConstraintX().getValueAsInt(1.f); if (cX < 0) { content.setConstraintX(SizeValue.px(cX + stepSize)); content.getParent().layoutElements(); } }
Source:
private void replicateDiskFinish(Guid srcDomain, Guid dstDomain) { DiskImage diskImage = diskImageDao.get(getParameters().getDestinationImageId()); StorageType storageType = diskImage.getStorageTypes().get(0); String diskType = null; if (storageType == StorageType.GLUSTERFS && FeatureSupported.libgfApiSupported(getVm().getCompatibilityVersion())) { diskType = VdsProperties.NETWORK; } VmReplicateDiskParameters migrationStartParams = new VmReplicateDiskParameters(getParameters().getVdsId(), getParameters().getVmId(), getParameters().getStoragePoolId(), srcDomain, dstDomain, getParameters().getImageGroupID(), getParameters().getDestinationImageId(), diskType); VDSReturnValue ret = resourceManager.runVdsCommand( VDSCommandType.VmReplicateDiskFinish, migrationStartParams); if (!ret.getSucceeded()) { throw new EngineException(ret.getVdsError().getCode(), ret.getVdsError().getMessage()); } }

Target:
private void replicateDiskFinish(Guid srcDomain, Guid dstDomain) { VmReplicateDiskParameters migrationStartParams = new VmReplicateDiskParameters(getParameters().getVdsId(), getParameters().getVmId(), getParameters().getStoragePoolId(), srcDomain, dstDomain, getParameters().getImageGroupID(), getParameters().getDestinationImageId(), null); VDSReturnValue ret = resourceManager.runVdsCommand( VDSCommandType.VmReplicateDiskFinish, migrationStartParams); if (!ret.getSucceeded()) { throw new EngineException(ret.getVdsError().getCode(), ret.getVdsError().getMessage()); } }
Source:
public String getOSRecommendedFolder() { try { return _get_os_recommended_folder(); } catch (UnsatisfiedLinkError e) { if (!libraryLoaded) { loadLibrary(); return _get_os_recommended_folder(); } return null; } }

Target:
public String getOSRecommendedFolder() { try { return _get_os_recommended_folder(); } catch (UnsatisfiedLinkError e) { if (!libraryLoaded) { loadLibrary(); return getOSRecommendedFolder(); } return null; } }
Source:
public void refreshConditionsWidget(final List<CompositeColumn<? extends BaseColumn>> conditionColumns) { getConditionsConfigWidget().clear(); if (conditionColumns == null || conditionColumns.isEmpty()) { getAccordion().getItem(GuidedDecisionTableAccordionItem.Type.CONDITION).setOpen(false); getConditionsConfigWidget().add(blankSlate()); return; } getConditionsConfigWidget().add(getConditionsPanel()); final Map<String, List<BaseColumn>> columnGroups = conditionColumns.stream().collect( Collectors.groupingBy( column -> DecisionTableColumnViewUtils.getColumnManagementGroupTitle(column), Collectors.toList() ) ); getConditionsPanel().renderColumns(columnGroups); }

Target:
public void refreshConditionsWidget(final List<CompositeColumn<? extends BaseColumn>> conditionColumns) { getConditionsConfigWidget().clear(); if (conditionColumns == null || conditionColumns.isEmpty()) { getAccordion().getItem(GuidedDecisionTableAccordionItem.Type.CONDITION).setOpen(false); getConditionsConfigWidget().add(blankSlate()); return; } getConditionsConfigWidget().add(getConditionsPanel()); final Map<String, List<BaseColumn>> columnGroups = conditionColumns.stream().collect( Collectors.groupingBy( DecisionTableColumnViewUtils::getColumnManagementGroupTitle, Collectors.toList() ) ); getConditionsPanel().renderColumns(columnGroups); }
Source:
private void fullTest(int size, int[] fuzz, String distributionName) { PerformanceMeter pMinsertion = perf.createPerformanceMeter(distributionName + " Insertion: " + fName); PerformanceMeter pMiterate = perf.createPerformanceMeter(distributionName + " Iterate: " + fName); PerformanceMeter pMiterateStart = perf.createPerformanceMeter(distributionName + " Iterate Start: " + fName); PerformanceMeter pMiterateEnd = perf.createPerformanceMeter(distributionName + " Iterate End: " + fName); PerformanceMeter pMiterateDuration = perf.createPerformanceMeter(distributionName + " Iterate Length: " + fName); for (int i = 0; i < DEFAULT_LOOP_COUNT; i++) { fSegStore.clear(); pMinsertion.start(); populate(size, fuzz, fSegStore, getSegmentStoreSize()); pMinsertion.stop(); pMiterate.start(); iterate(fSegStore); pMiterate.stop(); pMiterateStart.start(); iterate(fSegStore.iterator(SegmentComparators.INTERVAL_START_COMPARATOR)); pMiterateStart.stop(); pMiterateEnd.start(); iterate(fSegStore.iterator(SegmentComparators.INTERVAL_END_COMPARATOR)); pMiterateEnd.stop(); pMiterateDuration.start(); iterate(fSegStore.iterator(SegmentComparators.INTERVAL_LENGTH_COMPARATOR)); pMiterateDuration.stop(); } pMinsertion.commit(); pMiterate.commit(); pMiterateStart.commit(); pMiterateEnd.commit(); pMiterateDuration.commit(); }

Target:
private void fullTest(int size, int[] fuzz, String distributionName) { PerformanceMeter pMinsertion = perf.createPerformanceMeter(distributionName + " Insertion: " + fName); PerformanceMeter pMiterateStart = perf.createPerformanceMeter(distributionName + " Iterate sorted by start: " + fName); PerformanceMeter pMiterateEnd = perf.createPerformanceMeter(distributionName + " Iterate sorted by end: " + fName); PerformanceMeter pMiterateDuration = perf.createPerformanceMeter(distributionName + " Iterate sorted by length: " + fName); for (int i = 0; i < DEFAULT_LOOP_COUNT; i++) { fSegStore.clear(); pMinsertion.start(); populate(size, fuzz, fSegStore, getSegmentStoreSize()); pMiterateStart.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_START_COMPARATOR); pMiterateStart.stop(); pMiterateEnd.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_END_COMPARATOR); pMiterateEnd.stop(); pMiterateDuration.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_LENGTH_COMPARATOR); pMiterateDuration.stop(); } pMinsertion.commit(); pMiterateStart.commit(); pMiterateEnd.commit(); pMiterateDuration.commit(); }
Source:
public void name_requires_either_component_or_defaults() throws Exception { thrown.expect(BadRequestException.class); thrown.expectMessage("The name parameter requires either projectKey or defaults to be set."); SearchWsRequest request = new SearchWsRequest() .setProfileName("bla"); SearchDataLoader.validateRequest(request); }

Target:
public void name_requires_either_component_or_defaults() throws Exception { SearchWsRequest request = new SearchWsRequest() .setProfileName("bla"); thrown.expect(BadRequestException.class); thrown.expectMessage("The name parameter requires either projectKey or defaults to be set."); SearchDataLoader.validateRequest(request); }
Source:
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) { EObject objectToControl = getRequest().getTargetObject(); EMFHelper.getUsages(objectToControl); Resource newNotationResource = getRequest().getTargetResource(NotationModel.NOTATION_FILE_EXTENSION); if (newNotationResource == null) { return CommandResult.newErrorCommandResult(CREATION_RESOURCE_ERROR); } List<Diagram> diagrams = getDiagrams(); if (!diagrams.isEmpty()) { newNotationResource.getContents().addAll(diagrams); addMovedDiagramToRequest(diagrams); } Collection<Setting> crossReferences = EMFHelper.getUsages(objectToControl); if (!crossReferences.isEmpty()) { Resource oldNotationResource = getOldNotationResource(); if (oldNotationResource != null && !oldNotationResource.isModified()) { oldNotationResource.setModified(true); } if (!newNotationResource.isModified()) { newNotationResource.setModified(true); } } return CommandResult.newOKCommandResult(newNotationResource); }

Target:
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) { EObject objectToControl = getRequest().getTargetObject(); Resource newNotationResource = getRequest().getTargetResource(NotationModel.NOTATION_FILE_EXTENSION); if (newNotationResource == null) { return CommandResult.newErrorCommandResult(CREATION_RESOURCE_ERROR); } List<Diagram> diagrams = getDiagrams(); if (!diagrams.isEmpty()) { newNotationResource.getContents().addAll(diagrams); addMovedDiagramToRequest(diagrams); } Collection<Setting> crossReferences = EMFHelper.getUsages(objectToControl); if (!crossReferences.isEmpty()) { Resource oldNotationResource = getOldNotationResource(); if (oldNotationResource != null && !oldNotationResource.isModified()) { oldNotationResource.setModified(true); } if (!newNotationResource.isModified()) { newNotationResource.setModified(true); } } return CommandResult.newOKCommandResult(newNotationResource); }
Source:
public PatternMatcher(TermContext context) { this.termContext = context; multiSubstitutions = new ArrayList<java.util.Collection<Map<Variable, Term>>>(); }

Target:
private PatternMatcher(TermContext context) { this.termContext = context; multiSubstitutions = new ArrayList<Collection<Map<Variable, Term>>>(); }
Source:
public void InteractiveMaps_032_PalantirSetAndRemovePlayerPosition() { InteractiveMapPageObject selectedMap = new InteractiveMapPageObject(driver); selectedMap.openMap(wikiURL, 3); selectedMap.verifyMapOpened(); PalantirComponentObject poi = new PalantirComponentObject(driver); PalantirContent handle = new PalantirContent(); handle = poi.setAndVerifyPlayerPosition(-40, -10, 3, true); poi.verifyCorrectPlayerPos(handle.success, handle.responseCode, handle.message); poi.verifyPoiAppearOnMap(); handle = poi.deletePlayerPosition(); poi.verifyPlayerPosDeleted(handle.success, handle.responseCode, handle.message); poi.verifyPoiNotAppearOnMap(); }

Target:
public void InteractiveMaps_032_PalantirSetAndRemovePlayerPosition() { InteractiveMapsPageObject specialMap = new InteractiveMapsPageObject(driver); InteractiveMapPageObject selectedMap = specialMap.openMap(wikiURL, PalantirContent.PALANTIR_MAP); selectedMap.verifyMapOpened(); PalantirComponentObject poi = new PalantirComponentObject(driver); PalantirContent handle = poi.setAndVerifyPlayerPosition(-40, -10, 3, true); poi.verifyCorrectPlayerPos(handle); poi.verifyPoiAppearOnMap(); handle = poi.deletePlayerPosition(); poi.verifyPlayerPosDeleted(handle); poi.verifyPoiNotAppearOnMap(); }
Source:
private UpdateMavenConfigurationJob() { super("Update Maven projects configuration"); this.toProcess = new HashSet<IProject>(); this.setUser(true); }

Target:
private UpdateMavenConfigurationJob() { super("Update Maven projects configuration"); this.toProcess = Collections.synchronizedSet(new HashSet<IProject>()); this.setUser(true); }
Source:
static void deleteStaleTestDatabases(String instanceId, String baseDbId) { Timestamp now = Timestamp.now(); Pattern pattern = getTestDbIdPattern(baseDbId); for (Database db : dbClient.listDatabases(instanceId).iterateAll()) { if (db.getCreateTime().getSeconds() > 0 && TimeUnit.HOURS .convert(now.getSeconds() - db.getCreateTime().getSeconds(), TimeUnit.SECONDS) > 24) { if (pattern.matcher(toComparableId(baseDbId, db.getId().getDatabase())).matches()) { db.drop(); } } } }

Target:
static void deleteStaleTestDatabases(String instanceId, String baseDbId) { Timestamp now = Timestamp.now(); Pattern samplePattern = getTestDbIdPattern(baseDbId); Pattern restoredPattern = getTestDbIdPattern("restored"); for (Database db : dbClient.listDatabases(instanceId).iterateAll()) { if (TimeUnit.HOURS.convert(now.getSeconds() - db.getCreateTime().getSeconds(), TimeUnit.SECONDS) > 24) { if (db.getId().getDatabase().length() >= DBID_LENGTH) { if (samplePattern.matcher(toComparableId(baseDbId, db.getId().getDatabase())).matches()) { db.drop(); } if (restoredPattern.matcher(toComparableId("restored", db.getId().getDatabase())) .matches()) { db.drop(); } } } } }