auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean validateTimeRange() { boolean isEmpty = fStartTimeRangeText.getText().isEmpty() || fEndTimeRangeText.getText().isEmpty(); return !isEmpty && parseTimeRange() && fStartTimestamp.compareTo(fEndTimestamp) <= 0; }

Target:
private boolean validateTimeRange() { boolean isEmpty = fStartTimeRangeText.getText().isEmpty() || fEndTimeRangeText.getText().isEmpty(); return !isEmpty && parseTimeRange() && fStartTimestamp.compareTo(fEndTimestamp) < 0; }
Source:
DictIdSeeker( IntBuffer dimConversions ) { this.dimConversions = dimConversions; this.currIndex = 0; this.currVal = -1; this.lastVal = -1; }

Target:
DictIdSeeker( IntBuffer dimConversions ) { this.dimConversions = dimConversions; this.currIndex = 0; this.currVal = NOT_INIT; this.lastVal = NOT_INIT; }
Source:
public ProtocolInfoAttribute getAttribute( ProtocolInfoAttributeName attributeName, String attributeValue ) throws ParseException { if (DLNAOrgOperations.NAME.equals(attributeName)) { throw new IllegalArgumentException( "Cannot get DLNA.ORG_FLAGS instance because protocol information is needed " + "- use an overloaded version of this method which takes a protocol arguement"); } return getAttribute(attributeName, attributeValue, null); }

Target:
public ProtocolInfoAttribute getAttribute( ProtocolInfoAttributeName attributeName, String attributeValue ) throws ParseException { if (DLNAOrgOperations.NAME.equals(attributeName)) { throw new IllegalArgumentException( "Cannot get DLNA.ORG_FLAGS instance because protocol information is needed " + "- use an overloaded version of this method which takes a protocol argument"); } return getAttribute(attributeName, attributeValue, null); }
Source:
private void runInParentContainer(final CloneOperation op) { Runnable runInParentContainer = new Runnable() { public void run() { try { parentContainer.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { executeCloneOperation(op, monitor); } }); } catch (InvocationTargetException e) { Activator.handleError(e.getMessage(), e, true); } catch (InterruptedException e) { } } }; Display.getCurrent().asyncExec(runInParentContainer); }

Target:
private void runInParentContainer(final CloneOperation op) { Runnable runInParentContainer = new Runnable() { public void run() { try { parentContainer.run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { executeCloneOperation(op, monitor); } }); } catch (InvocationTargetException e) { Activator.handleError(UIText.GitCloneWizard_failed, e.getCause(), true); } catch (InterruptedException e) { } } }; Display.getCurrent().asyncExec(runInParentContainer); }
Source:
SetSesssionSoftLimitCommandParameters() { super(); }

Target:
SetSesssionSoftLimitCommandParameters() { }
Source:
public MainDesktop() throws URISyntaxException { this.injector = Guice.createInjector(this); Client client = new Client("localhost", this.configureRendererProtocol()); RenderController cntrl = this.injector.getInstance(RenderController.class); cntrl.setClient(client); client.setController(cntrl); this.eventDispatcher = this.injector.getInstance(EventDispatcher.class); this.setupGraphics(); client.connect(); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } AnimalAddedEvent ev; for (int i = 0; i < 5; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } ev = new AnimalAddedEvent(); ev.setAnimal(i); ev.setTeam(i % 2); this.eventDispatcher.dispatch(ev); } this.eventDispatcher.dispatch(new GameAboutToStartEvent()); this.eventDispatcher.dispatch(new GameStartedEvent()); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public MainDesktop() throws URISyntaxException { this.injector = Guice.createInjector(this); Client client = new Client("localhost", this.configureRendererProtocol()); RenderController cntrl = this.injector.getInstance(RenderController.class); cntrl.setClient(client); client.setController(cntrl); this.eventDispatcher = this.injector.getInstance(EventDispatcher.class); this.setupGraphics(); client.connect(); }
Source:
public Node visitFunctionCall(SqlBaseParser.FunctionCallContext context) { var window = visitIfPresent(context.over(), Window.class); var filter = visitIfPresent(context.filter(), Expression.class); if (filter.isPresent() && window.isPresent()) { throw new UnsupportedOperationException( "The filter clause in window function calls is not supported"); } return new FunctionCall( getQualifiedName(context.qname()), isDistinct(context.setQuant()), visitCollection(context.expr(), Expression.class), window, filter ); }

Target:
public Node visitFunctionCall(SqlBaseParser.FunctionCallContext context) { return new FunctionCall( getQualifiedName(context.qname()), isDistinct(context.setQuant()), visitCollection(context.expr(), Expression.class), visitIfPresent(context.over(), Window.class), visitIfPresent(context.filter(), Expression.class) ); }
Source:
@Test public void getItemsPredicate() throws IOException { final Folder d = r.jenkins.createProject(Folder.class, "d"); final FreeStyleProject p1 = d.createProject(FreeStyleProject.class, "p1"); FreeStyleProject p2 = d.createProject(FreeStyleProject.class, "p2"); FreeStyleProject c1 = d.createProject(FreeStyleProject.class, "c1"); assertThat(d.getItems(p -> p.getDisplayName().startsWith("p")), containsInAnyOrder(p1, p2)); }

Target:
@Test public void getItemsPredicate() throws IOException { final Folder d = r.jenkins.createProject(Folder.class, "d"); final FreeStyleProject p1 = d.createProject(FreeStyleProject.class, "p1"); final FreeStyleProject p2 = d.createProject(FreeStyleProject.class, "p2"); final FreeStyleProject c1 = d.createProject(FreeStyleProject.class, "c1"); assertThat(d.getItems(p -> p.getDisplayName().startsWith("p")), containsInAnyOrder(p1, p2)); }
Source:
public void testNotificationManager() throws Exception { manager.changeNotificationSetting(courseId1, channelId1, false); manager.checkCourseEnrollment(new ArrayList<EnrolledCoursesResponse>()); manager.isSubscribedByCourseId(courseId1); manager.resubscribeAll( ); manager.subscribeAndUnsubscribeToServer(channelId1,true); manager.unsubscribeAll(); manager.syncWithServer(); }

Target:
public void testNotificationManager() throws Exception { final String courseId1 = "course_id_1"; final String channelId1 = "channel_id_1"; manager.changeNotificationSetting(courseId1, channelId1, false); manager.checkCourseEnrollment(new ArrayList<EnrolledCoursesResponse>()); manager.isSubscribedByCourseId(courseId1); manager.resubscribeAll( ); manager.subscribeAndUnsubscribeToServer(channelId1,true); manager.unsubscribeAll(); manager.syncWithServer(); }
Source:
public void tagRouterRuleParseTest(){ String tagRouterRuleConfig = "---\n" + "force: false\n" + "runtime: true\n" + "enabled: false\n" + "priority: 1\n" + "key: demo-provider\n" + "tags:\n" + " - name: tag1\n" + " addresses: null\n" + " - name: tag2\n" + " addresses: [\"30.5.120.37:20880\"]\n" + " - name: tag3\n" + " addresses: []\n" + " - name: tag4\n" + " addresses: ~\n" + "..."; TagRouterRule tagRouterRule = TagRuleParser.parse(tagRouterRuleConfig); assert tagRouterRule.getTagNames().contains("tag1"); assert tagRouterRule.getTagNames().contains("tag2"); assert tagRouterRule.getTagNames().contains("tag3"); assert tagRouterRule.getTagNames().contains("tag4"); assert tagRouterRule.getAddresses().contains("30.5.120.37:20880"); assert tagRouterRule.getTagnameToAddresses().get("tag1")==null; assert tagRouterRule.getTagnameToAddresses().get("tag2").size()==1; assert tagRouterRule.getTagnameToAddresses().get("tag3")==null; assert tagRouterRule.getTagnameToAddresses().get("tag4")==null; }

Target:
public void tagRouterRuleParseTest(){ String tagRouterRuleConfig = "---\n" + "force: false\n" + "runtime: true\n" + "enabled: false\n" + "priority: 1\n" + "key: demo-provider\n" + "tags:\n" + " - name: tag1\n" + " addresses: null\n" + " - name: tag2\n" + " addresses: [\"30.5.120.37:20880\"]\n" + " - name: tag3\n" + " addresses: []\n" + " - name: tag4\n" + " addresses: ~\n" + "..."; TagRouterRule tagRouterRule = TagRuleParser.parse(tagRouterRuleConfig); assert tagRouterRule.getTagNames().contains("tag1"); assert tagRouterRule.getTagNames().contains("tag2"); assert tagRouterRule.getTagNames().contains("tag3"); assert tagRouterRule.getTagNames().contains("tag4"); assert tagRouterRule.getAddresses().contains("30.5.120.37:20880"); assert tagRouterRule.getTagnameToAddresses().get("tag1")==null; assert tagRouterRule.getTagnameToAddresses().get("tag2").size()==1; assert tagRouterRule.getTagnameToAddresses().get("tag3")==null; assert tagRouterRule.getTagnameToAddresses().get("tag4")==null; assert tagRouterRule.getAddresses().size()==1; }
Source:
public static PeriodGranularity toPeriodGranularity( final Expr periodArg, final Expr originArg, final Expr timeZoneArg, final Expr.ObjectBinding bindings ) { final Period period = new Period(periodArg.eval(bindings).asString()); final DateTime origin; final DateTimeZone timeZone; if (timeZoneArg == null) { timeZone = null; } else { final String value = timeZoneArg.eval(bindings).asString(); timeZone = value != null ? DateTimeZone.forID(value) : null; } Chronology chronology = timeZone == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(timeZone); if (originArg == null) { origin = null; } else { final Object value = originArg.eval(bindings).value(); origin = value != null ? new DateTime(value, chronology) : null; } return new PeriodGranularity(period, origin, timeZone); }

Target:
public static PeriodGranularity toPeriodGranularity( final Expr periodArg, final Expr originArg, final Expr timeZoneArg, final Expr.ObjectBinding bindings ) { final Period period = new Period(periodArg.eval(bindings).asString()); final DateTime origin; final DateTimeZone timeZone; if (timeZoneArg == null) { timeZone = null; } else { final String value = timeZoneArg.eval(bindings).asString(); timeZone = value != null ? DateTimeZone.forID(value) : null; } if (originArg == null) { origin = null; } else { Chronology chronology = timeZone == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(timeZone); final Object value = originArg.eval(bindings).value(); origin = value != null ? new DateTime(value, chronology) : null; } return new PeriodGranularity(period, origin, timeZone); }
Source:
public void doesNotFire() { RuleApplication ruleApplication = applyRule(); if (ruleApplication.wasRuleApplied()) { fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), inTransaction(session -> textLogicalPlan(plan, ruleApplication.types, metadata.getFunctionRegistry(), new StatsAndCosts(ImmutableMap.of(), ImmutableMap.of()), session, 2)))); } }

Target:
public void doesNotFire() { RuleApplication ruleApplication = applyRule(); if (ruleApplication.wasRuleApplied()) { fail(String.format( "Expected %s to not fire for:\n%s", rule.getClass().getName(), inTransaction(session -> textLogicalPlan(plan, ruleApplication.types, metadata.getFunctionRegistry(), StatsAndCosts.empty(), session, 2)))); } }
Source:
public static QuotaModeType map(QuotaEnforcementTypeEnum type) { switch (type) { case DISABLED: return QuotaModeType.DISABLED; case HARD_ENFORCEMENT: return QuotaModeType.ENABLED; case SOFT_ENFORCEMENT: return QuotaModeType.AUDIT; default: return null; } }

Target:
public static QuotaModeType map(QuotaEnforcementTypeEnum type) { switch (type) { case DISABLED: return QuotaModeType.DISABLED; case HARD_ENFORCEMENT: return QuotaModeType.ENABLED; case SOFT_ENFORCEMENT: return QuotaModeType.AUDIT; default: throw new IllegalArgumentException("Unknown quota enforcement type \"" + type + "\""); } }
Source:
@Override public EnumerableCorrelate copy(RelTraitSet traitSet, RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, JoinRelType joinType) { ImmutableList<RelCollation> newCollations = ImmutableList.copyOf( RelMdCollation.enumerableCorrelate( getCluster().getMetadataQuery(), left, right, joinType)); if (!newCollations.isEmpty()) { traitSet = traitSet.replace(newCollations); } return new EnumerableCorrelate(getCluster(), traitSet, left, right, correlationId, requiredColumns, joinType); }

Target:
@Override public EnumerableCorrelate copy(RelTraitSet traitSet, RelNode left, RelNode right, CorrelationId correlationId, ImmutableBitSet requiredColumns, JoinRelType joinType) { return new EnumerableCorrelate(getCluster(), traitSet, left, right, correlationId, requiredColumns, joinType); }
Source:
public Trigger orphanMemberTrigger(String tenantId, String memberId) throws Exception { if (isEmpty(tenantId)) { throw new IllegalArgumentException("TenantId must be not null"); } if (isEmpty(memberId)) { throw new IllegalArgumentException("TriggerId must be not null"); } checkTenantId(tenantId, memberId); Trigger member = getTrigger(tenantId, memberId); if (null == member) { throw new NotFoundException(Trigger.class.getName(), tenantId, memberId); } if (!member.isMember()) { throw new IllegalArgumentException("Trigger is not a member trigger: [" + tenantId + "/" + memberId + "]"); } if (member.isOrphan()) { throw new IllegalArgumentException("Trigger is already an orphan: [" + tenantId + "/" + memberId + "]"); } member.setOrphan(true); return updateTrigger(member); }

Target:
public Trigger orphanMemberTrigger(String tenantId, String memberId) throws Exception { if (isEmpty(tenantId)) { throw new IllegalArgumentException("TenantId must be not null"); } if (isEmpty(memberId)) { throw new IllegalArgumentException("TriggerId must be not null"); } Trigger member = getTrigger(tenantId, memberId); if (null == member) { throw new NotFoundApplicationException(Trigger.class.getName(), tenantId, memberId); } if (!member.isMember()) { throw new IllegalArgumentException("Trigger is not a member trigger: [" + tenantId + "/" + memberId + "]"); } if (member.isOrphan()) { throw new IllegalArgumentException("Trigger is already an orphan: [" + tenantId + "/" + memberId + "]"); } member.setOrphan(true); return updateTrigger(member); }
Source:
public void updateRoutingTable(final EMRoutingTable routingTable) { final Map<Integer, List<Integer>> storeIdToBlockIds = routingTable.getStoreIdToBlockIds(); numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, List<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } initialized = true; synchronized (this) { notify(); } }

Target:
public void updateRoutingTable(final EMRoutingTable routingTable) { final Map<Integer, List<Integer>> storeIdToBlockIds = routingTable.getStoreIdToBlockIds(); numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, List<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } initialized = true; synchronized (this) { this.notify(); } }
Source:
private TagName saveToCase(SleuthkitCase caseDb) { TagName tagName = null; try { tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted); } catch (TskCoreException ex) { Exceptions.printStackTrace(ex); } return tagName; }

Target:
private TagName saveToCase(SleuthkitCase caseDb) { TagName tagName = null; try { tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted); } catch (TskCoreException ex) { LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex); } return tagName; }
Source:
public GenericRecord transform(StructuredRecord structuredRecord) throws IOException { co.cask.cdap.api.data.schema.Schema structuredRecordSchema = structuredRecord.getSchema(); Schema avroSchema; if (outputAvroSchema != null) { avroSchema = outputAvroSchema; } else { int hashCode = structuredRecordSchema.hashCode(); if (schemaCache.containsKey(hashCode)) { avroSchema = schemaCache.get(hashCode); } else { avroSchema = new Schema.Parser().parse(structuredRecordSchema.toString()); schemaCache.put(hashCode, avroSchema); } } GenericRecordBuilder recordBuilder = new GenericRecordBuilder(avroSchema); for (Schema.Field field : avroSchema.getFields()) { String fieldName = field.name(); co.cask.cdap.api.data.schema.Schema.Field schemaField = structuredRecordSchema.getField(fieldName); if (schemaField == null) { throw new IllegalArgumentException("Input record does not contain the " + fieldName + " field."); } if (schemaField.getSchema().getType() == co.cask.cdap.api.data.schema.Schema.Type.RECORD) { recordBuilder.set(fieldName, new StructuredToAvroTransformer(field.schema().toString()) .transform((StructuredRecord) structuredRecord.get(fieldName))); } else { recordBuilder.set(fieldName, convertField(structuredRecord.get(fieldName), schemaField.getSchema())); } } return recordBuilder.build(); }

Target:
public GenericRecord transform(StructuredRecord structuredRecord) throws IOException { return transform(structuredRecord, outputCDAPSchema == null ? structuredRecord.getSchema() : outputCDAPSchema); }
Source:
public double getMedian() { return median; }

Target:
private double getMedian() { return median; }
Source:
public void before(){ browser.navigate().refresh(); Graphene.goTo(TransactionsMetricsPage.class); browser.manage().window().maximize(); Console.withBrowser(browser).waitUntilLoaded(); }

Target:
public void before() { browser.navigate().refresh(); Graphene.goTo(TransactionsMetricsPage.class); Console.withBrowser(browser).maximizeWindow().waitUntilLoaded(); }
Source:
public static <T> LinkedBindingBuilder<T> bind(Binder binder, TypeLiteral<T> type) { return binder.bind(type).annotatedWith(UniqueAnnotations.create()); }

Target:
public static <T> LinkedBindingBuilder<T> bind(Binder binder, TypeLiteral<T> type) { return binder.bind(type); }
Source:
public Control post(@Valid MetricCollection metricCollection, @Context HttpServletRequest request) { try { List<Metric> metrics = metricCollection.getMetrics(); log.debug("POST: metrics/store: len(metrics)={}", (metrics == null) ? -1 : metrics.size()); if (metrics != null) { metricService.incrementReceived(metrics.size()); } log.debug("Tagging metrics with http parameter prefixes: {}", configuration.getHttpParameterTags()); Utils.tagMetrics(request, metrics, configuration.getHttpParameterTags()); if (configuration.isAuthEnabled()) { Subject subject = security.getSubject(); ZenossTenant tenant = subject.getPrincipals().oneByType(ZenossTenant.class); log.debug("Tagging metrics with tenant-id: {}", tenant.id()); Utils.injectTag("zenoss_tenant_id", tenant.id(), metrics); } Utils.filterMetricTags(metrics, configuration.getTagWhiteList()); String remoteIp = Utils.remoteAddress(request); return metricService.push(metrics, remoteIp, null); } catch (Exception e) { log.info("post(metricCollection={}, request={}", metricCollection, request); log.error("Unexpected exception: " + e.getMessage(), e); return Control.error(e.getMessage()); } }

Target:
public Control post(@Valid MetricCollection metricCollection, @Context HttpServletRequest request) throws Exception { try { List<Metric> metrics = metricCollection.getMetrics(); log.debug("POST: metrics/store: len(metrics)={}", (metrics == null) ? -1 : metrics.size()); if (metrics != null) { metricService.incrementReceived(metrics.size()); } log.debug("Tagging metrics with http parameter prefixes: {}", configuration.getHttpParameterTags()); Utils.tagMetrics(request, metrics, configuration.getHttpParameterTags()); if (configuration.isAuthEnabled()) { Subject subject = security.getSubject(); ZenossTenant tenant = subject.getPrincipals().oneByType(ZenossTenant.class); log.debug("Tagging metrics with tenant-id: {}", tenant.id()); Utils.injectTag("zenoss_tenant_id", tenant.id(), metrics); } Utils.filterMetricTags(metrics, configuration.getTagWhiteList()); String remoteIp = Utils.remoteAddress(request); return metricService.push(metrics, remoteIp, null); } catch (Exception e) { log.info("post(metricCollection={}, request={}", metricCollection, request); log.error("Unexpected exception: " + e.getMessage(), e); throw(e); } }
Source:
public LiveServers apply(final InputStream inputStream) { final Load load = new Load(new LoadSettingsBuilder().build()); final Map<?, ?> yamlProps; try { yamlProps = (Map<?, ?>) load.loadFromInputStream(inputStream); } catch (final ClassCastException e) { throw new IllegalArgumentException("Invalid yaml format"); } if (yamlProps == null) { throw new IllegalArgumentException("Invalid yaml file"); } final String latest = (String) Optional.ofNullable(yamlProps.get("latest")) .orElseThrow( () -> new IllegalArgumentException("No 'latest' property found: " + yamlProps)); final List<ServerProperties> serverProperties = ((List<Map<String, String>>) yamlProps.get("servers")) .stream().map(this::mapToServerProperties).collect(Collectors.toList()); return LiveServers.builder() .latestEngineVersion(new Version(latest)) .servers(serverProperties) .build(); }

Target:
public LiveServers apply(final InputStream inputStream) { final Load load = new Load(new LoadSettingsBuilder().build()); final Map<?, ?> yamlProps; try { yamlProps = (Map<?, ?>) load.loadFromInputStream(inputStream); } catch (final ClassCastException e) { throw new IllegalArgumentException("Invalid yaml format"); } if (yamlProps == null) { throw new IllegalArgumentException("Invalid yaml file"); } final String latest = Optional.ofNullable((String) yamlProps.get("latest")) .orElseThrow( () -> new IllegalArgumentException("No 'latest' property found: " + yamlProps)); final List<ServerProperties> serverProperties = ((List<Map<String, String>>) yamlProps.get("servers")) .stream().map(this::mapToServerProperties).collect(Collectors.toList()); return LiveServers.builder() .latestEngineVersion(new Version(latest)) .servers(serverProperties) .build(); }
Source:
public void serverPublishUnserialize(DataInputStream stream) { Block sixNodeCacheBlockOld = sixNodeCacheBlock; super.serverPublishUnserialize(stream); try { sixNodeCacheBlock = Block.getBlockById(stream.readInt()); sixNodeCacheBlockMeta = stream.readByte(); int idx; for (idx = 0; idx < 6; idx++) { short id = stream.readShort(); if (id == 0) { elementRenderIdList[idx] = (short) 0; elementRenderList[idx] = null; } else { if (id != elementRenderIdList[idx]) { elementRenderIdList[idx] = id; SixNodeDescriptor descriptor = Eln.sixNodeItem.getDescriptor(id); elementRenderList[idx] = (SixNodeElementRender) descriptor.RenderClass.getConstructor(SixNodeEntity.class, Direction.class, SixNodeDescriptor.class).newInstance(this, Direction.fromInt(idx), descriptor); } elementRenderList[idx].publishUnserialize(stream); } } } catch (IOException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } if (sixNodeCacheBlock != sixNodeCacheBlockOld) { Chunk chunk = worldObj.getChunkFromBlockCoords(pos); chunk.generateHeightMap(); Utils.updateSkylight(chunk); chunk.generateSkylightMap(); Utils.updateAllLightTypes(worldObj, xCoord, yCoord, zCoord); } }

Target:
public void serverPublishUnserialize(DataInputStream stream) { super.serverPublishUnserialize(stream); try { sixNodeCacheBlock = Block.getBlockById(stream.readInt()); sixNodeCacheBlockMeta = stream.readByte(); int idx; for (idx = 0; idx < 6; idx++) { short id = stream.readShort(); if (id == 0) { elementRenderIdList[idx] = (short) 0; elementRenderList[idx] = null; } else { if (id != elementRenderIdList[idx]) { elementRenderIdList[idx] = id; SixNodeDescriptor descriptor = null; elementRenderList[idx] = (SixNodeElementRender) descriptor.RenderClass.getConstructor(SixNodeEntity.class, Direction.class, SixNodeDescriptor.class).newInstance(this, Direction.fromInt(idx), descriptor); } elementRenderList[idx].publishUnserialize(stream); } } } catch (IOException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { e.printStackTrace(); } }
Source:
public void initialize(AdvancedCache<?, ?> cache) { if (hsQuery == null) { QueryEngine<?> queryEngine = getQueryEngine(cache); HsQueryRequest hsQueryRequest; if (indexedType != null && sortableFields != null) { IndexedTypeMap<CustomTypeMetadata> metadata = createMetadata(); hsQueryRequest = queryEngine.createHsQuery(queryString, metadata, namedParameters); } else { hsQueryRequest = queryEngine.createHsQuery(queryString, null, namedParameters); } hsQuery = hsQueryRequest.getHsQuery(); sort = hsQueryRequest.getSort(); hsQuery.projection(hsQueryRequest.getProjections()); } hsQuery.firstResult(firstResult); hsQuery.maxResults(maxResults); }

Target:
public void initialize(AdvancedCache<?, ?> cache) { if (hsQuery == null) { QueryEngine<?> queryEngine = getQueryEngine(cache); HsQueryRequest hsQueryRequest; if (indexedType != null && sortableFields != null) { IndexedTypeMap<CustomTypeMetadata> metadata = createMetadata(); hsQueryRequest = queryEngine.createHsQuery(queryString, metadata, namedParameters); } else { hsQueryRequest = queryEngine.createHsQuery(queryString, null, namedParameters); } hsQuery = hsQueryRequest.getHsQuery(); sort = hsQueryRequest.getSort(); hsQuery.projection(hsQueryRequest.getProjections()); hsQuery.firstResult(firstResult); hsQuery.maxResults(maxResults); } }
Source:
public void waitForPageToLoad() { waitFor(driver -> { JavascriptExecutor javascriptExecutor = (JavascriptExecutor) checkNotNull(driver); return "complete".equals(javascriptExecutor.executeScript("return document.readyState")); }); }

Target:
public void waitForPageToLoad() { browser.waitForPageLoad(); }
Source:
public void testRocksDBKeyMayExistApi() throws Exception { try (RDBStore newStore = new RDBStore(folder.newFolder(), options, configSet)) { RocksDB db = newStore.getDb(); for (int i = 0; i < 100; i++) { db.put(StringUtils.getBytesUtf16("key" + i), StringUtils.getBytesUtf16("Value" + i)); } long start = System.nanoTime(); for (int i = 0; i < 50; i++) { Assert.assertTrue(db.get( StringUtils.getBytesUtf16("key" + i))!= null); } long end = System.nanoTime(); long keyGetLatency = end - start; start = System.nanoTime(); for (int i = 50; i < 100; i++) { Assert.assertTrue(db.get( StringUtils.getBytesUtf16("key" + i))!= null); } end = System.nanoTime(); long keyMayExistLatency = end - start; Assert.assertTrue(keyMayExistLatency < keyGetLatency); } }

Target:
public void testRocksDBKeyMayExistApi() throws Exception { try (RDBStore newStore = new RDBStore(folder.newFolder(), options, configSet)) { RocksDB db = newStore.getDb(); long start = System.nanoTime(); for (int i = 0; i < 50; i++) { Assert.assertTrue(db.get( StringUtils.getBytesUtf16("key" + i))== null); } long end = System.nanoTime(); long keyGetLatency = end - start; start = System.nanoTime(); for (int i = 0; i < 50; i++) { Assert.assertFalse(db.keyMayExist( StringUtils.getBytesUtf16("key" + i), new StringBuilder())); } end = System.nanoTime(); long keyMayExistLatency = end - start; Assert.assertTrue(keyMayExistLatency < keyGetLatency); } }
Source:
public boolean match(final ChangeData object) throws OrmException { for (PatchSetApproval p : object.currentApprovals(dbProvider)) { if (p.getCategoryId().equals(category)) { short psVal = p.getValue(); if (test.match(psVal, expVal)) { try { ChangeControl cc = ccFactory.controlFor(object.change(dbProvider), userFactory.create(dbProvider, p.getAccountId())); if (!cc.isVisible()) { continue; } psVal = cc.normalize(category, psVal); } catch (NoSuchChangeException e) { continue; } if (test.match(psVal, expVal)) { return true; } } } } return false; }

Target:
public boolean match(final ChangeData object) throws OrmException { for (PatchSetApproval p : object.currentApprovals(dbProvider)) { if (p.getCategoryId().equals(category)) { short psVal = p.getValue(); if (test.match(psVal, expVal)) { Change c = object.change(dbProvider); IdentifiedUser user = userFactory.create(dbProvider, p.getAccountId()); ChangeControl cc = object.projectState(dbProvider, projectCache).controlFor(user) .controlFor(c); if (!cc.isVisible()) { continue; } psVal = cc.normalize(category, psVal); if (test.match(psVal, expVal)) { return true; } } } } return false; }
Source:
private static SimpleBlobStore createHttp(RemoteOptions options, Credentials creds) { Preconditions.checkNotNull(options.remoteCache, "remoteCache"); Preconditions.checkArgument(options.remoteCache.startsWith("http"), "remoteCache should start with http"); try { URI uri = URI.create(options.remoteCache); if (options.remoteCacheProxy != null) { if (options.remoteCacheProxy.startsWith("unix:")) { return HttpBlobStore.create( new DomainSocketAddress(options.remoteCacheProxy.replaceFirst("^unix:", "")), uri, options.remoteTimeout, options.remoteMaxConnections, creds); } else { throw new Exception("Remote cache proxy unsupported: " + options.remoteCacheProxy); } } else { return HttpBlobStore.create( uri, options.remoteTimeout, options.remoteMaxConnections, creds); } } catch (Exception e) { throw new RuntimeException(e); } }

Target:
private static SimpleBlobStore createHttp(RemoteOptions options, Credentials creds) { Preconditions.checkNotNull(options.remoteCache, "remoteCache"); Preconditions.checkArgument(options.remoteCache.toLowerCase().startsWith("http"), "remoteCache should start with http"); try { URI uri = URI.create(options.remoteCache); if (options.remoteCacheProxy != null) { if (options.remoteCacheProxy.startsWith("unix:")) { return HttpBlobStore.create( new DomainSocketAddress(options.remoteCacheProxy.replaceFirst("^unix:", "")), uri, options.remoteTimeout, options.remoteMaxConnections, creds); } else { throw new Exception("Remote cache proxy unsupported: " + options.remoteCacheProxy); } } else { return HttpBlobStore.create( uri, options.remoteTimeout, options.remoteMaxConnections, creds); } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public synchronized ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore() { checkConnected(); if (_helixPropertyStore == null) { String path = PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, _clusterName); String fallbackPath = String.format("/%s/%s", _clusterName, "PROPERTYSTORE"); _helixPropertyStore = new AutoFallbackPropertyStore<ZNRecord>(new ZkBaseDataAccessor<ZNRecord>(_zkclient), path, fallbackPath); } return _helixPropertyStore; }

Target:
public synchronized ZkHelixPropertyStore<ZNRecord> getHelixPropertyStore() { checkConnected(); if (_helixPropertyStore == null) { String path = PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, _clusterName); String fallbackPath = String.format("/%s/%s", _clusterName, "HELIX_PROPERTYSTORE"); _helixPropertyStore = new AutoFallbackPropertyStore<ZNRecord>(new ZkBaseDataAccessor<ZNRecord>(_zkclient), path, fallbackPath); } return _helixPropertyStore; }
Source:
public void testRegionServerPort() throws Exception { final TableName tableName = TableName.valueOf(name.getMethodName()); initTableRegions(tableName); MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getHostname(); final int PORT = 16021; Configuration conf = TEST_UTIL.getConfiguration(); String originalPort = conf.get(HConstants.REGIONSERVER_PORT); conf.set(HConstants.REGIONSERVER_PORT, Integer.toString(PORT)); RegionMoverBuilder rmBuilder = new RegionMoverBuilder(rsName, conf); assertEquals(PORT, rmBuilder.port); if (originalPort != null) { conf.set(HConstants.REGIONSERVER_PORT, originalPort); } TEST_UTIL.getAdmin().disableTable(tableName); TEST_UTIL.getAdmin().deleteTable(tableName); }

Target:
public void testRegionServerPort() throws Exception { MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster(); HRegionServer regionServer = cluster.getRegionServer(0); String rsName = regionServer.getServerName().getHostname(); final int PORT = 16021; Configuration conf = TEST_UTIL.getConfiguration(); String originalPort = conf.get(HConstants.REGIONSERVER_PORT); conf.set(HConstants.REGIONSERVER_PORT, Integer.toString(PORT)); RegionMoverBuilder rmBuilder = new RegionMoverBuilder(rsName, conf); assertEquals(PORT, rmBuilder.port); if (originalPort != null) { conf.set(HConstants.REGIONSERVER_PORT, originalPort); } }
Source:
public DatasetSourceTarget(URI uri, AvroType<E> avroType) { this(Datasets.<E, View<E>>load(uri), avroType); }

Target:
public DatasetSourceTarget(URI uri, AvroType<E> avroType) { this(Datasets.load(uri, avroType.getTypeClass()), avroType); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final String authorization = ((HttpServletRequest) request).getHeader("Authorization"); if (isValidAuthorizationHeader(authorization)) { try { chain.doFilter(request, response); } finally { MDC.remove(GATEWAY_ACCOUNT_ID); } } else { ((HttpServletResponse) response).sendError(UNAUTHORIZED.getStatusCode(), UNAUTHORIZED.getReasonPhrase()); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final String authorization = ((HttpServletRequest) request).getHeader("Authorization"); if (isValidAuthorizationHeader(authorization)) { chain.doFilter(request, response); } else { ((HttpServletResponse) response).sendError(UNAUTHORIZED.getStatusCode(), UNAUTHORIZED.getReasonPhrase()); } }
Source:
private void updateParentContainerStructureFrom(CollectionElementVariable2 elemVar, ConstraintVariable2 v1) { ConstraintVariable2 elemContainer= elemVar.getParentConstraintVariable(); ParametricStructure elemContainerStructure= elemStructure(elemContainer); if (elemContainerStructure == ParametricStructure.NONE) return; if (elemContainerStructure == null) { elemContainerStructure= newParametricType(elemContainer.getType()); setStructureAndPush(elemContainer, elemContainerStructure); } ParametricStructure v1Structure= elemStructure(v1); int parmIdx= elemVar.getDeclarationTypeVariableIndex(); if (parmIdx == CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX) return; if (elemContainerStructure == v1Structure || containsSubStructure(v1Structure, elemContainerStructure)) { if ((elemStructure(elemVar) != ParametricStructure.NONE)) setStructureAndPush(elemVar, ParametricStructure.NONE); if (elemContainerStructure.getParameters()[parmIdx] == null) { elemContainerStructure.getParameters()[parmIdx]= ParametricStructure.NONE; fWorkList2.push(elemContainer); } } else if (updateStructureOfIthParamFrom(elemContainerStructure, parmIdx, v1Structure)) { setStructureAndPush(elemVar, elemContainerStructure.getParameters()[parmIdx]); fWorkList2.push(elemContainer); if (DEBUG_INITIALIZATION) System.out.println(" updated structure of " + elemContainer + " to " + elemContainerStructure); } }

Target:
private void updateParentContainerStructureFrom(CollectionElementVariable2 elemVar, ConstraintVariable2 v1) { ConstraintVariable2 elemContainer= elemVar.getParentConstraintVariable(); ParametricStructure elemContainerStructure= elemStructure(elemContainer); if (elemContainerStructure == ParametricStructure.NONE) return; if (elemContainerStructure == null) { elemContainerStructure= newParametricType(elemContainer.getType()); setStructureAndPush(elemContainer, elemContainerStructure); } ParametricStructure v1Structure= elemStructure(v1); int parmIdx= elemVar.getDeclarationTypeVariableIndex(); if (parmIdx == CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX) return; if (elemContainerStructure == v1Structure || containsSubStructure(v1Structure, elemContainerStructure)) { if (elemStructure(elemVar) != ParametricStructure.NONE) setStructureAndPush(elemVar, ParametricStructure.NONE); if (elemContainerStructure.getParameters()[parmIdx] == null) { elemContainerStructure.getParameters()[parmIdx]= ParametricStructure.NONE; fWorkList2.push(elemContainer); } } else if (updateStructureOfIthParamFrom(elemContainerStructure, parmIdx, v1Structure)) { setStructureAndPush(elemVar, elemContainerStructure.getParameters()[parmIdx]); fWorkList2.push(elemContainer); if (DEBUG_INITIALIZATION) System.out.println(" updated structure of " + elemContainer + " to " + elemContainerStructure); } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { onCreateAware(savedInstanceState); } catch (SessionUnavailableException e) { SessionActivityRegistration.redirectToLogin(this); } }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { onCreateSessionSafe(savedInstanceState); } catch (SessionUnavailableException e) { SessionActivityRegistration.redirectToLogin(this); } }
Source:
public void testDownloadVersion() throws Exception { File[] files = HazelcastVersionLocator.locateVersion("4.0", folder.getRoot(), true); assertHash(files[HAZELCAST_JAR_INDEX], "bc409b12b96ece6d05c3bd1e99b202bb", "OS"); assertHash(files[1], "220509ece9fc152525c91ba7c75ce600", "OS tests"); assertHash(files[2], "765816e628ca4ca57d5bd7387e761eaa", "EE"); assertHash(files[3], "162bcb2412570845e6fd91ee61b54f94", "EE tests"); }

Target:
public void testDownloadVersion() throws Exception { File[] files = HazelcastVersionLocator.locateVersion("4.0", folder.getRoot(), true); assertHash(files[HAZELCAST_JAR_INDEX], "bc409b12b96ece6d05c3bd1e99b202bb", "OS"); assertHash(files[HAZELCAST_TESTS_JAR_INDEX], "220509ece9fc152525c91ba7c75ce600", "OS tests"); assertHash(files[HAZELCAST_EE_JAR_INDEX], "765816e628ca4ca57d5bd7387e761eaa", "EE"); assertHash(files[HAZELCAST_EE_TESTS_JAR_INDEX], "162bcb2412570845e6fd91ee61b54f94", "EE tests"); }
Source:
public void addDrugReferenceMap(DrugReferenceMap drugReferenceMap) { if (drugReferenceMap != null && !drugReferenceMaps.contains(drugReferenceMap)) { drugReferenceMap.setDrug(this); if (drugReferenceMap.getConceptMapType() == null) { drugReferenceMap.setConceptMapType(Context.getConceptService().getDefaultConceptMapType()); } drugReferenceMaps.add(drugReferenceMap); } }

Target:
public void addDrugReferenceMap(DrugReferenceMap drugReferenceMap) { if (drugReferenceMap != null && !getDrugReferenceMaps().contains(drugReferenceMap)) { drugReferenceMap.setDrug(this); if (drugReferenceMap.getConceptMapType() == null) { drugReferenceMap.setConceptMapType(Context.getConceptService().getDefaultConceptMapType()); } getDrugReferenceMaps() .add(drugReferenceMap); } }
Source:
private void deleteCachedFileIfNeeded(Path filePath) { try { if (Files.isDirectory(filePath)) { return; } FileTime lastAccessTime = Files.readAttributes(filePath, BasicFileAttributes.class).lastAccessTime(); if (lastAccessTime.toMillis() + cacheLifeTime < calendar.getTimeInMillis()) { System.out.println("deleting: " + filePath.toString()); Files.deleteIfExists(filePath); } } catch (IOException e) { e.printStackTrace(); } }

Target:
private void deleteCachedFileIfNeeded(Path filePath) { try { ResourceLocks.acquireDiskLock(); FileTime lastAccessTime = Files.readAttributes(filePath, BasicFileAttributes.class).lastAccessTime(); OffsetDateTime comparableLastAccessTime = OffsetDateTime.ofInstant(lastAccessTime.toInstant(), ZoneId.systemDefault()); final boolean olderThanCacheTime = comparableLastAccessTime.plusDays(preferencesService.getPreferences().getCacheLifeTimeInDays()).isBefore(OffsetDateTime.now()); final boolean gameDataCacheActivated = preferencesService.getPreferences().isGameDataCacheActivated(); if (olderThanCacheTime || !gameDataCacheActivated) { log.debug("Deleting cached file ''{}'' ", filePath.toString()); Files.deleteIfExists(filePath); } } catch (IOException e) { log.error("Exception during deleting the cache files", e); } finally { ResourceLocks.freeDiskLock(); } }
Source:
public ImageTemplate buildImageTemplateFromNode(String name, String id) { Droplet droplet = null; try { droplet = api.getDropletApi().get(Integer.valueOf(id)); } catch (Exception ex) { throw new NoSuchElementException("Cannot find droplet with id: " + id); } if (droplet == null) { throw new NoSuchElementException("Cannot find droplet with id: " + id); } return new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build(); }

Target:
public ImageTemplate buildImageTemplateFromNode(String name, String id) { Droplet droplet = api.getDropletApi().get(Integer.valueOf(id)); if (droplet == null) { throw new NoSuchElementException("Cannot find droplet with id: " + id); } return new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build(); }
Source:
private StaticAnalysisConfiguration() { List<Preferences.Preference> defaults = new ArrayList<>(Arrays.asList( new Preference("global-enable", "on", Type.BOOLEAN, "This globally enables static analysis. If this is off," + " the static analysis module will not be run, though existing compile errors will still" + " be enabled regardless.", 0) )); prefs = new Preferences(Implementation.GetServerType().getBranding(), Logger.getLogger(StaticAnalysisConfiguration.class.getName()), defaults, "This file controls the static analysis options. As this is a major change, we have" + " provided this configuration file to allow disabling the static analysis entirely," + " or just individual parts, so that in the event you find a bug with your code," + " you do not have to downgrade. Please note that this is a temporary measure in place," + " eventually all static analysis will be a mandatory part of code execution, so if you" + " find bugs, it is essential that you report them before disabling this. Future versions" + " of " + Implementation.GetServerType().getBranding() + " will forcibly reset the" + " configuration you have set here, once known bugs are fixed."); }

Target:
private StaticAnalysisConfiguration() { List<Preferences.Preference> defaults = new ArrayList<>(Arrays.asList( new Preference("global-enable", "off", Type.BOOLEAN, "This globally enables static analysis." + " If this is off, the static analysis module will not be run, though existing compile errors will" + " still be enabled regardless.", 0) )); prefs = new Preferences(Implementation.GetServerType().getBranding(), Logger.getLogger(StaticAnalysisConfiguration.class.getName()), defaults, "This file controls the static analysis options. As this is a major change, we have" + " provided this configuration file to allow disabling the static analysis entirely," + " or just individual parts, so that in the event you find a bug with your code," + " you do not have to downgrade. Please note that this is a temporary measure in place," + " eventually all static analysis will be a mandatory part of code execution, so if you" + " find bugs, it is essential that you report them before disabling this. Future versions" + " of " + Implementation.GetServerType().getBranding() + " will forcibly reset the" + " configuration you have set here, once known bugs are fixed."); }
Source:
@Override protected PluginProvider<?> getPluginProvider(String name){ return new TestAttributeSecurityPluginProvider(name, null, ALLOW_ALL, globalAuth, true, new Consumer<AuthenticationContext>() { @Override public void accept(AuthenticationContext actx) { userAttrs = actx.nodeAttributes(); } }, clientData()); }

Target:
@Override protected PluginProvider<?> getPluginProvider(String name) { return new TestAuthenticationContextSecurityPluginProvider(name, null, ALLOW_ALL, globalAuth, true, (ctx) -> userAttrs = ctx.nodeAttributes(), clientData()); }
Source:
public void processEvent(final CloudTrailEvent event) { List<String> instanceIds = CloudtrailEventSupport.getInstanceIds(event); for (String instanceId : instanceIds) { String applicationName = getApplicationName(event, instanceId); if (applicationName == null) { return; } RestTemplate restTemplate = new RestTemplate(); ResponseEntity<JsonNode> response = restTemplate.exchange(get( fromHttpUrl(kioApplicationUrl).buildAndExpand( applicationName).toUri()).accept(APPLICATION_JSON).build(), JsonNode.class); if (!response.getStatusCode().is2xxSuccessful()) { LOG.info("Application: is not registered in kio.", applicationName); } } }

Target:
public void processEvent(final CloudTrailEvent event) { List<String> instanceIds = CloudtrailEventSupport.getInstanceIds(event); for (String instanceId : instanceIds) { String applicationName = getApplicationName(event, instanceId); if (applicationName == null) { return; } RestTemplate restTemplate = new RestTemplate(); ResponseEntity<JsonNode> response = restTemplate.exchange(get( fromHttpUrl(kioApplicationUrl).buildAndExpand( applicationName).toUri()).accept(APPLICATION_JSON).build(), JsonNode.class); if (!response.getStatusCode().is2xxSuccessful()) { violationStore.save(format("Application: %s is not registered in kio.",applicationName)); } } }
Source:
public FluentIterable<TYPE> last(int count) {return new LazyFluentIterable<TYPE>() { @Override public Iterator<TYPE> iterator() { return new DecoratingIterator<TYPE>(iterable.iterator()) { int currentIndex = 0; @Override public TYPE computeNext() { List<TYPE> list = new ArrayList<>(); Iterator<TYPE> newIterator = iterable.iterator(); while(newIterator.hasNext()) { list.add(newIterator.next()); } int totalElementsCount = list.size(); int stopIndex = totalElementsCount - count; TYPE candidate = null; while(currentIndex < stopIndex && fromIterator.hasNext()) { currentIndex++; fromIterator.next(); } if(currentIndex >= stopIndex && fromIterator.hasNext()) { candidate = fromIterator.next(); } return candidate; } }; } }; }

Target:
public FluentIterable<TYPE> last(int count) { return new LazyFluentIterable<TYPE>() { @Override public Iterator<TYPE> iterator() { return new DecoratingIterator<TYPE>(iterable.iterator()) { private int stopIndex; private int totalElementsCount; private List<TYPE> list; private int currentIndex = 0; @Override public TYPE computeNext() { initialize(); TYPE candidate = null; while (currentIndex < stopIndex && fromIterator.hasNext()) { currentIndex++; fromIterator.next(); } if (currentIndex >= stopIndex && fromIterator.hasNext()) { candidate = fromIterator.next(); } return candidate; } private void initialize() { if (list == null) { list = new ArrayList<>(); Iterator<TYPE> newIterator = iterable.iterator(); while (newIterator.hasNext()) { list.add(newIterator.next()); } totalElementsCount = list.size(); stopIndex = totalElementsCount - count; } } }; } }; }