auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updatingWithNonRecentValueDoesNotAffectCache() throws InvalidAcceptorCacheKeyException { Map<Client, Long> before = ImmutableMap.<Client, Long>builder() .put(Client.of("client1"), 5L) .put(Client.of("client2"), 6L) .put(Client.of("client3"), 7L) .build(); AcceptorCache cache = cache(before); AcceptorCacheDigest digest = cache.getAllUpdates(); cache.updateSequenceNumbers(ImmutableSet.of( WithSeq.of(10L, Client.of("client1")), WithSeq.of(3L, Client.of("client2")))); AcceptorCacheDigest secondDigest = cache.updatesSinceCacheKey(digest.newCacheKey()).get(); assertThat(secondDigest.updates()) .containsEntry(Client.of("client1"), 10L); cache.updateSequenceNumbers(ImmutableSet.of(WithSeq.of(5L, Client.of("client3")))); assertThat(cache.updatesSinceCacheKey(secondDigest.newCacheKey())) .as("there are no actionable changes, cache is the same") .isEmpty(); assertThat(cache.updatesSinceCacheKey(digest.newCacheKey())) .as("no actionable changes => this is no different from calling updatesSinceCacheKey twice") .contains(secondDigest); }

Target:
public void updatingWithNonRecentValueDoesNotAffectCache() throws InvalidAcceptorCacheKeyException { Map<Client, Long> before = ImmutableMap.<Client, Long>builder() .put(Client.of("client1"), 5L) .put(Client.of("client2"), 6L) .put(Client.of("client3"), 7L) .build(); AcceptorCache cache = cache(before); AcceptorCacheDigest digest = cache.getAllUpdates(); cache.updateSequenceNumbers(ImmutableSet.of( WithSeq.of(10L, Client.of("client1")), WithSeq.of(3L, Client.of("client2")))); AcceptorCacheDigest secondDigest = cache.updatesSinceCacheKey(digest.newCacheKey()).get(); assertThat(secondDigest.updates()) .containsOnly(entry(Client.of("client1"), 10L)); cache.updateSequenceNumbers(ImmutableSet.of(WithSeq.of(5L, Client.of("client3")))); assertThat(cache.updatesSinceCacheKey(secondDigest.newCacheKey())) .as("there are no actionable changes, cache is the same") .isEmpty(); assertThat(cache.updatesSinceCacheKey(digest.newCacheKey())) .as("no actionable changes => this is no different from calling updatesSinceCacheKey twice") .contains(secondDigest); }
Source:
private DBObject insertDBObject(EntityKeyMetadata entityKeyMetadata, Tuple tuple, WriteConcern writeConcern) { if ( columnNamesAllowBatchInsert( tuple.getColumnNames() ) ) { DBObject dbObject = objectForInsert( tuple, new BasicDBObject( tuple.getColumnNames().size() ) ); getCollection( entityKeyMetadata ).insert( dbObject, writeConcern ); return dbObject; } else { BasicDBObject idObject = new BasicDBObject(); getCollection( entityKeyMetadata ).insert( idObject, writeConcern ); DBObject updater = objectForUpdate( tuple, idObject ); getCollection( entityKeyMetadata ).update( idObject, updater, true, false, writeConcern ); return idObject; } }

Target:
private DBObject insertDBObject(EntityKeyMetadata entityKeyMetadata, Tuple tuple, WriteConcern writeConcern) { DBObject dbObject = objectForInsert( tuple, new BasicDBObject( tuple.getColumnNames().size() ) ); getCollection( entityKeyMetadata ).insert( dbObject, writeConcern ); return dbObject; }
Source:
public List<ValidationProvider<?>> getValidationProviders() { List<ValidationProvider<?>> validationProviderList = new ArrayList<ValidationProvider<?>>(); ClassLoader classloader = GetClassLoader.fromContext(); if ( getCachedValidationProviders( classloader ) != null ) { return getCachedValidationProviders( classloader ); } ServiceLoader<ValidationProvider> loader = ServiceLoader.load( ValidationProvider.class, classloader ); Iterator<ValidationProvider> providerIterator = loader.iterator(); if ( !providerIterator.hasNext() ) { classloader = GetClassLoader.fromClass( DefaultValidationProviderResolver.class ); if ( getCachedValidationProviders( classloader ) != null ) { return getCachedValidationProviders( classloader ); } loader = ServiceLoader.load( ValidationProvider.class, classloader ); providerIterator = loader.iterator(); } while ( providerIterator.hasNext() ) { try { validationProviderList.add( providerIterator.next() ); } catch ( ServiceConfigurationError e ) { throw new ValidationException( "Unable to load Bean Validation provider non.existent.ValidationProvider", e ); } } cacheValidationProviders( classloader, validationProviderList ); return validationProviderList; }

Target:
public List<ValidationProvider<?>> getValidationProviders() { return GetValidationProviderList.getValidationProviderList(); }
Source:
public void populateDAG(DAG dag, Configuration conf) { BlockWriter blockWriter = dag.addOperator("BlockWriter", new BlockWriter()); Synchronizer synchronizer = dag.addOperator("BlockSynchronizer", new Synchronizer()); dag.setInputPortAttribute(blockWriter.input, PortContext.PARTITION_PARALLEL, true); dag.setInputPortAttribute(blockWriter.blockMetadataInput, PortContext.PARTITION_PARALLEL, true); dag.addStream("CompletedBlockmetadata", blockWriter.blockMetadataOutput, synchronizer.blocksMetadataInput); HDFSFileMerger merger = new HDFSFileMerger(); merger = dag.addOperator("FileMerger", merger); dag.addStream("MergeTrigger", synchronizer.trigger, merger.input); merger.setFilePath(outputDirectoryPath); merger.setOverwriteOnConflict(overwriteOnConflict); filesMetadataInput.set(synchronizer.filesMetadataInput); blocksMetadataInput.set(blockWriter.blockMetadataInput); blockData.set(blockWriter.input); }

Target:
public void populateDAG(DAG dag, Configuration conf) { BlockWriter blockWriter = dag.addOperator("BlockWriter", new BlockWriter()); Synchronizer synchronizer = dag.addOperator("BlockSynchronizer", new Synchronizer()); dag.setInputPortAttribute(blockWriter.input, PortContext.PARTITION_PARALLEL, true); dag.setInputPortAttribute(blockWriter.blockMetadataInput, PortContext.PARTITION_PARALLEL, true); dag.addStream("CompletedBlockmetadata", blockWriter.blockMetadataOutput, synchronizer.blocksMetadataInput); HDFSFileMerger merger = new HDFSFileMerger(); merger = dag.addOperator("FileMerger", merger); dag.addStream("MergeTrigger", synchronizer.trigger, merger.input); merger.setFilePath(outputDirectoryPath); merger.setOverwriteOnConflict(overwriteOnConflict); blockWriter.setBlocksDirectory(blocksDirectory); merger.setBlocksDirectory(blocksDirectory); filesMetadataInput.set(synchronizer.filesMetadataInput); blocksMetadataInput.set(blockWriter.blockMetadataInput); blockData.set(blockWriter.input); }
Source:
private void flush(OutputBuffer outputBuffer) { if (bufferedRowCount == 0) { return; } SliceOutput output = new DynamicSliceOutput(getSerializedBuffersSizeInBytes()); output.writeInt(blockEncodingBuffers.length); for (int i = 0; i < blockEncodingBuffers.length; i++) { blockEncodingBuffers[i].serializeTo(output); } SerializedPage serializedPage = serde.serialize(output.slice(), bufferedRowCount); outputBuffer.enqueue(lifespan, partition, Collections.singletonList(serializedPage)); pagesAdded.incrementAndGet(); rowsAdded.addAndGet(bufferedRowCount); bufferedRowCount = 0; }

Target:
private void flush(OutputBuffer outputBuffer) { if (bufferedRowCount == 0) { return; } SliceOutput output = new DynamicSliceOutput(toIntExact(getSerializedBuffersSizeInBytes())); output.writeInt(channelCount); for (int i = 0; i < channelCount; i++) { blockEncodingBuffers[i].serializeTo(output); } SerializedPage serializedPage = serde.serialize(output.slice(), bufferedRowCount); outputBuffer.enqueue(lifespan, partition, ImmutableList.of(serializedPage)); pagesAdded.incrementAndGet(); rowsAdded.addAndGet(bufferedRowCount); if (blockEncodingBuffers != null) { for (int i = 0; i < blockEncodingBuffers.length; i++) { blockEncodingBuffers[i].resetBuffers(); } } bufferedRowCount = 0; }
Source:
AzkabanProjectLoader(final Props props, final ProjectLoader projectLoader, final StorageManager storageManager) { this.props = requireNonNull(props, "Props is null"); this.projectLoader = requireNonNull(projectLoader, "project Loader is null"); this.storageManager = requireNonNull(storageManager, "Storage Manager is null"); tempDir = new File(props.getString("project.temp.dir", "temp")); if (!tempDir.exists()) { log.info("Using temp dir: " + tempDir.getAbsolutePath()); tempDir.mkdirs(); } else { log.info("Creating temp dir: " + tempDir.getAbsolutePath()); } projectVersionRetention = props.getInt("project.version.retention", 3); log.info("Project version retention is set to " + projectVersionRetention); }

Target:
AzkabanProjectLoader(final Props props, final ProjectLoader projectLoader, final StorageManager storageManager) { this.props = requireNonNull(props, "Props is null"); this.projectLoader = requireNonNull(projectLoader, "project Loader is null"); this.storageManager = requireNonNull(storageManager, "Storage Manager is null"); this.tempDir = new File(props.getString(ConfigurationKeys.PROJECT_TEMP_DIR, "temp")); if (!this.tempDir.exists()) { log.info("Creating temp dir: " + this.tempDir.getAbsolutePath()); this.tempDir.mkdirs(); } else { log.info("Using temp dir: " + this.tempDir.getAbsolutePath()); } this.projectVersionRetention = props.getInt("project.version.retention", 3); log.info("Project version retention is set to " + this.projectVersionRetention); }
Source:
public void start() { for (int i = 0; i < numProcessingQueues; i++) { processingExecutor.scheduleAtFixedRate( new SegmentChangeProcessor(segmentProcessingQueues[i]), 0, config.getCuratorCreateZkNodesRepeatDelay().getMillis(), TimeUnit.MILLISECONDS ); } }

Target:
public void start() { }
Source:
public Map<String, Integer> countEvalGroupsForNodes(String[] nodeIds) { Map<String, Integer> m = new HashMap<String, Integer>(); if (evalHierarchyProvider != null) { m = evalHierarchyProvider.countEvalGroupsForNodes(nodeIds); } for( String nodeId : nodeIds ) { if( !m.containsKey( nodeId ) ) { m.put( nodeId, 0 ); } } Map<String, Set<String>> nodeGroupsMap = getEvalGroupsForNodes( nodeIds ); for( String nodeID : nodeGroupsMap.keySet() ) { m.put( nodeID, nodeGroupsMap.get( nodeID ).size() ); } return m; }

Target:
public Map<String, Integer> countEvalGroupsForNodes(String[] nodeIds) { Map<String, Integer> nodeGroupSizeMap; if (evalHierarchyProvider != null) { nodeGroupSizeMap = evalHierarchyProvider.countEvalGroupsForNodes(nodeIds); } else { nodeGroupSizeMap = new HashMap<>(); } for( String nodeId : nodeIds ) { if( !nodeGroupSizeMap.containsKey( nodeId ) ) { nodeGroupSizeMap.put( nodeId, 0 ); } } Map<String, Set<String>> nodeGroupsMap = getEvalGroupsForNodes( nodeIds ); for( String nodeID : nodeGroupsMap.keySet() ) { nodeGroupSizeMap.put( nodeID, nodeGroupsMap.get( nodeID ).size() ); } return nodeGroupSizeMap; }
Source:
public ProjectAggregate withUncommittedEvents(ProjectId id) { ProjectAggregate aggregate = Given.aggregateOfClass(ProjectAggregate.class) .withId(id) .build(); AggCreateProject.Builder createProject = builderForType(AggCreateProject.class); createProject.setProjectId(id); AggAddTask.Builder addTask = builderForType(AggAddTask.class); addTask.setProjectId(id); AggStartProject.Builder startProject = builderForType(AggStartProject.class); startProject.setProjectId(id); dispatchCommand(aggregate, repository, env(createProject.build())); dispatchCommand(aggregate, repository, env(addTask.build())); dispatchCommand(aggregate, repository, env(startProject.build())); return aggregate; }

Target:
public ProjectAggregate withUncommittedEvents(ProjectId id) { ProjectAggregate givenProject = Given.aggregateOfClass(ProjectAggregate.class) .withId(id) .build(); AggCreateProject.Builder createProject = builderForType(AggCreateProject.class); createProject.setProjectId(id); AggAddTask.Builder addTask = builderForType(AggAddTask.class); addTask.setProjectId(id); AggStartProject.Builder startProject = builderForType(AggStartProject.class); startProject.setProjectId(id); new ToProject(givenProject) .dispatch(createProject.build()) .dispatch(addTask.build()) .dispatch(startProject.build()); return givenProject; }
Source:
private static boolean removeVideoDevice(VmDeviceType whenGraphicsExists, VmDeviceType videoToRemove, Map<Guid, VmDevice> managedDevicesMap) { for (Map.Entry<Guid, VmDevice> videoDevice : managedDevicesMap.entrySet()) { if (whenGraphicsExists.getName().equals(videoDevice.getValue().getDevice())) { for (Map.Entry<Guid, VmDevice> graphicsDevice : managedDevicesMap.entrySet()) { if (videoToRemove.getName().equals(graphicsDevice.getValue().getDevice())) { managedDevicesMap.remove(graphicsDevice.getKey()); return true; } } } } return false; }

Target:
private static boolean removeVideoDevice(VmDeviceType whenGraphicsExists, VmDeviceType videoToRemove, Map<Guid, VmDevice> managedDevicesMap) { if (VmDeviceCommonUtils.isVmDeviceExists(managedDevicesMap, whenGraphicsExists)) { Guid key = null; for (Map.Entry<Guid, VmDevice> graphicsDevice : managedDevicesMap.entrySet()) { if (videoToRemove.getName().equals(graphicsDevice.getValue().getDevice())) { key = graphicsDevice.getKey(); break; } } if (key != null) { managedDevicesMap.remove(key); return true; } } return false; }
Source:
public void bind(int position) { UploadableFile uploadableFile = uploadableFiles.get(position); Uri uri = uploadableFile.getMediaUri(); background.setImageURI(Uri.fromFile(new File(String.valueOf(uri)))); if (position == callback.getCurrentSelectedFilePosition()) { GradientDrawable border = new GradientDrawable(); border.setShape(GradientDrawable.RECTANGLE); border.setStroke(10, context.getResources().getColor(R.color.primaryColor)); rlContainer.setEnabled(true); rlContainer.setClickable(true); rlContainer.setAlpha(1.0f); rlContainer.setForeground(border); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { rlContainer.setElevation(10); } } else { rlContainer.setEnabled(false); rlContainer.setClickable(false); rlContainer.setAlpha(0.7f); rlContainer.setForeground(null); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { rlContainer.setElevation(0); } } }

Target:
public void bind(int position) { UploadableFile uploadableFile = uploadableFiles.get(position); Uri uri = uploadableFile.getMediaUri(); background.setImageURI(Uri.fromFile(new File(String.valueOf(uri)))); if (position == callback.getCurrentSelectedFilePosition()) { GradientDrawable border = new GradientDrawable(); border.setShape(GradientDrawable.RECTANGLE); border.setStroke(8, context.getResources().getColor(R.color.primaryColor)); rlContainer.setEnabled(true); rlContainer.setClickable(true); rlContainer.setAlpha(1.0f); rlContainer.setBackground(border); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { rlContainer.setElevation(10); } } else { rlContainer.setEnabled(false); rlContainer.setClickable(false); rlContainer.setAlpha(0.7f); rlContainer.setBackground(null); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { rlContainer.setElevation(0); } } }
Source:
public String getAlgorithm() { return "ED25519-SK"; }

Target:
public String getAlgorithm() { return ALGORITHM; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { onBackPressed(); return true; } else if (mFollowMenuItem != null && item.equals(mFollowMenuItem)) { toggleFollowStatus(); } return super.onOptionsItemSelected(item); }

Target:
public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == android.R.id.home) { onBackPressed(); return true; } else if (item.equals(mFollowMenuItem)) { toggleFollowStatus(); } return super.onOptionsItemSelected(item); }
Source:
public void bundleChanged(BundleEvent event) { int eventType = event.getType(); synchronized (this) { if (eventType == BundleEvent.STARTED) { progressMonitor.split(4); String symbolicName = event.getBundle().getSymbolicName(); String taskName = NLS.bind(WorkbenchMessages.Startup_Loading, symbolicName); progressMonitor.subTask(taskName); } } }

Target:
public void bundleChanged(BundleEvent event) { int eventType = event.getType(); if (eventType == BundleEvent.STARTED) { progressMonitor.split(10); String symbolicName = event.getBundle().getSymbolicName(); String taskName = NLS.bind(WorkbenchMessages.Startup_Loading, symbolicName); progressMonitor.subTask(taskName); } }
Source:
public AccessDatastore(String name, String filename) { super(name); if(filename == null){ throw new NullPointerException("dilename cannot be null"); } _filename = filename; }

Target:
public AccessDatastore(String name, String filename) { super(name); if(filename == null){ throw new NullPointerException("Filename cannot be null"); } _filename = filename; }
Source:
public StatusDTO status() { StatusCache statusCache = candlepinCache.getStatusCache(); StatusDTO cached = statusCache.getStatus(); if (cached != null) { return cached; } boolean good = true; try { rulesCurator.getUpdatedFromDB(); } catch (Exception e) { log.error("Error checking database connection", e); good = false; } CandlepinModeChange modeChange = modeManager.getLastCandlepinModeChange(); CandlepinModeChange.Mode mode = modeChange.getMode(); Iterator<CandlepinModeChange.Reason> reasonItr = modeChange.getReasons().iterator(); CandlepinModeChange.Reason modeChangeReason = reasonItr.hasNext() ? reasonItr.next() : null; if (mode != CandlepinModeChange.Mode.NORMAL) { good = false; } CandlepinCapabilities caps = CandlepinCapabilities.getCapabilities(); RulesSourceEnum rulesSource = jsProvider.getRulesSource(); StatusDTO status = new StatusDTO() .setResult(good) .setVersion(version) .setRelease(release) .setStandalone(standalone) .setRulesVersion(jsProvider.getRulesVersion()) .setRulesSource(rulesSource != null ? rulesSource.toString() : null) .setMode(mode != null ? mode.toString() : null) .setModeReason(modeChangeReason != null ? modeChangeReason.toString() : null) .setModeChangeTime(modeChange.getChangeTime()) .setManagerCapabilities(caps) .setTimeUTC(new Date()) .setResource(resource) .setAuthUrl(authUrl) .setRealm(realm); statusCache.setStatus(status); return status; }

Target:
public StatusDTO status() { StatusCache statusCache = candlepinCache.getStatusCache(); StatusDTO cached = statusCache.getStatus(); if (cached != null) { return cached; } boolean good = true; try { rulesCurator.getUpdatedFromDB(); } catch (Exception e) { log.error("Error checking database connection", e); good = false; } CandlepinModeChange modeChange = modeManager.getLastCandlepinModeChange(); CandlepinModeChange.Mode mode = modeChange.getMode(); Iterator<CandlepinModeChange.Reason> reasonItr = modeChange.getReasons().iterator(); CandlepinModeChange.Reason modeChangeReason = reasonItr.hasNext() ? reasonItr.next() : null; if (mode != CandlepinModeChange.Mode.NORMAL) { good = false; } CandlepinCapabilities caps = CandlepinCapabilities.getCapabilities(); RulesSourceEnum rulesSource = jsProvider.getRulesSource(); StatusDTO status; if (keycloakEnabled) { AdapterConfig adapterConfig = keycloakConfig.getAdapterConfig(); status = new KeycloakStatusDTO() .setKeycloakResource(adapterConfig.getResource()) .setKeycloakAuthUrl(adapterConfig.getAuthServerUrl()) .setKeycloakRealm(adapterConfig.getRealm()); } else { status = new StatusDTO(); } status .setResult(good) .setVersion(version) .setRelease(release) .setStandalone(standalone) .setRulesVersion(jsProvider.getRulesVersion()) .setRulesSource(rulesSource != null ? rulesSource.toString() : null) .setMode(mode != null ? mode.toString() : null) .setModeReason(modeChangeReason != null ? modeChangeReason.toString() : null) .setModeChangeTime(modeChange.getChangeTime()) .setManagerCapabilities(caps) .setTimeUTC(new Date()); statusCache.setStatus(status); return status; }
Source:
protected GuidedDecisionTableEditorPresenter getPresenter() { return new GuidedDecisionTableEditorPresenter(view, dtServiceCaller, docks, mock(PerspectiveManager.class), notification, decisionTableSelectedEvent, validationPopup, resourceType, editMenuBuilder, viewMenuBuilder, insertMenuBuilder, radarMenuBuilder, modeller, beanManager, placeManager, columnsPage, saveAndRenameCommandBuilder, alertsButtonMenuItemBuilder, downloadMenuItem) { @Override protected Command getSaveAndRenameCommand() { return mock(Command.class); } }; }

Target:
protected GuidedDecisionTableEditorPresenter getPresenter() { return new GuidedDecisionTableEditorPresenter(view, dtServiceCaller, docks, perspectiveManager, notification, decisionTableSelectedEvent, validationPopup, resourceType, editMenuBuilder, viewMenuBuilder, insertMenuBuilder, radarMenuBuilder, modeller, beanManager, placeManager, columnsPage, saveAndRenameCommandBuilder, alertsButtonMenuItemBuilder, downloadMenuItem) { @Override protected Command getSaveAndRenameCommand() { return mock(Command.class); } }; }
Source:
public static Tree findAncestorWithKind(Tree tree, Collection<Tree.Kind> kinds) { Tree parent = tree; while (parent != null && !kinds.contains(parent.getKind())) { parent = parent.getParent(); } if (parent != null) { return parent; } return null; }

Target:
public static Tree findAncestorWithKind(Tree tree, Collection<Tree.Kind> kinds) { Tree parent = tree; while (parent != null && !kinds.contains(parent.getKind())) { parent = parent.getParent(); } return parent; }
Source:
public final boolean classicNotification() { return mPreferences.getBoolean(CLASSIC_NOTIFICATION, true); }

Target:
public final boolean classicNotification() { return mPreferences.getBoolean(CLASSIC_NOTIFICATION, false); }
Source:
public void testGetOutOfDateRowsForViewSqlFileView() { long viewTypeMask = ViewTypeMask.File.getMask() ; String sql = SQLUtils.getOutOfDateRowsForViewSql(tableId, viewTypeMask); String expected = "WITH DELTAS (ID, MISSING) AS (" + " SELECT R.OBJECT_ID, V.ROW_ID FROM OBJECT_REPLICATION R" + " LEFT JOIN T999 V ON (" + " R.OBJECT_TYPE = :objectType" + " AND R.OBJECT_ID = V.ROW_ID" + " AND R.ETAG = V.ROW_ETAG" + " AND R.BENEFACTOR_ID = V.ROW_BENEFACTOR)" + " WHERE R.OBJECT_TYPE = :objectType AND R.PARENT_ID IN (:scopeIds) AND R.SUBTYPE IN ('file')" + " UNION ALL" + " SELECT V.ROW_ID, R.OBJECT_ID FROM OBJECT_REPLICATION R" + " RIGHT JOIN T999 V ON (" + " R.OBJECT_TYPE = :objectType" + " AND R.OBJECT_ID = V.ROW_ID" + " AND R.ETAG = V.ROW_ETAG" + " AND R.BENEFACTOR_ID = V.ROW_BENEFACTOR" + " AND R.PARENT_ID IN (:scopeIds) AND R.SUBTYPE IN ('file'))" + ")" + "SELECT ID FROM DELTAS WHERE MISSING IS NULL ORDER BY ID DESC LIMIT :limitParam"; assertEquals(expected, sql); }

Target:
public void testGetOutOfDateRowsForViewSqlFileView() { long viewTypeMask = ViewTypeMask.File.getMask() ; String sql = SQLUtils.getOutOfDateRowsForViewSql(tableId, viewTypeMask); String expected = "WITH DELTAS (ID, MISSING) AS (" + " SELECT R.OBJECT_ID, V.ROW_ID FROM OBJECT_REPLICATION R" + " LEFT JOIN T999 V ON (" + " R.OBJECT_ID = V.ROW_ID" + " AND R.ETAG = V.ROW_ETAG" + " AND R.BENEFACTOR_ID = V.ROW_BENEFACTOR)" + " WHERE R.OBJECT_TYPE = :objectType AND R.PARENT_ID IN (:scopeIds) AND R.SUBTYPE IN ('file')" + " UNION ALL" + " SELECT V.ROW_ID, R.OBJECT_ID FROM OBJECT_REPLICATION R" + " RIGHT JOIN T999 V ON (" + " R.OBJECT_TYPE = :objectType" + " AND R.OBJECT_ID = V.ROW_ID" + " AND R.ETAG = V.ROW_ETAG" + " AND R.BENEFACTOR_ID = V.ROW_BENEFACTOR" + " AND R.PARENT_ID IN (:scopeIds) AND R.SUBTYPE IN ('file'))" + ")" + "SELECT ID FROM DELTAS WHERE MISSING IS NULL ORDER BY ID DESC LIMIT :limitParam"; assertEquals(expected, sql); }
Source:
public void flush() throws IOException { if (started.get()) { Future future = exec.schedule(new ConsumerRunnable(), 0, TimeUnit.MILLISECONDS); try { future.get(FLUSH_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { if (e instanceof InterruptedException) { throw new RuntimeException("interrupted flushing elements from queue", e); } log.error(e, e.getMessage()); } } }

Target:
public void flush() throws IOException { synchronized (started) { if (started.get()) { Future future = exec.schedule(new ConsumerRunnable(), 0, TimeUnit.MILLISECONDS); try { future.get(DEFAULT_FLUSH_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { if (e instanceof InterruptedException) { throw new RuntimeException("interrupted flushing elements from queue", e); } } } } }
Source:
public void onStartup(final ServletContext servletContext) throws ServletException { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Context initialContext; try { initialContext = new InitialContext(); final String logLocation = (String) initialContext .lookup("java:comp/env/osgp/AdapterDomainCore/log-config"); LogbackConfigurer.initLogging(logLocation); } catch (final NameNotFoundException | FileNotFoundException | JoranException e) { LOGGER.info("Using classpath logback.xml"); } catch (final NamingException e) { throw new ServletException("naming exception", e); } final AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(ApplicationContext.class); servletContext.addListener(new ContextLoaderListener(rootContext)); }

Target:
public void onStartup(final ServletContext servletContext) throws ServletException { startUp(servletContext); }
Source:
public static String reflogComments(List<ReflogEntry> entries) { StringBuffer b = new StringBuffer(); for (ReflogEntry e : entries) { b.append(e.getComment()).append(";"); } return b.toString(); }

Target:
private static String reflogComments(List<ReflogEntry> entries) { StringBuffer b = new StringBuffer(); for (ReflogEntry e : entries) { b.append(e.getComment()).append(";"); } return b.toString(); }
Source:
public Points getDataToRollup(final Locator locator, RollupType rollupType, Range range, String columnFamilyName) throws IOException, CacheException { Timer.Context ctx = Instrumentation.getReadTimerContext(columnFamilyName); try { DAbstractMetricIO io; if( columnFamilyName.equals( CassandraModel.CF_METRICS_FULL_NAME) ) { io = simpleIO; } else io = rollupTypeToIO.get(rollupType); Table<Locator, Long, Object> locatorTimestampRollup = io.getRollupsForLocator(locator, columnFamilyName, range); Points points = new Points(); for (Table.Cell<Locator, Long, Object> cell : locatorTimestampRollup.cellSet()) { points.add( createPoint( cell.getColumnKey(), cell.getValue())); } return points; } finally { ctx.stop(); } }

Target:
public Points getDataToRollup(final Locator locator, RollupType rollupType, Range range, String columnFamilyName) throws IOException { Timer.Context ctx = Instrumentation.getReadTimerContext(columnFamilyName); try { DAbstractMetricIO io = getIO( rollupType.name().toLowerCase(), CassandraModel.getGranularity( columnFamilyName ) ); Table<Locator, Long, Object> locatorTimestampRollup = io.getRollupsForLocator( locator, columnFamilyName, range ); Points points = new Points(); for (Table.Cell<Locator, Long, Object> cell : locatorTimestampRollup.cellSet()) { points.add( createPoint( cell.getColumnKey(), cell.getValue())); } return points; } catch( Exception e ) { Instrumentation.markReadError(); LOG.error( String.format( "Unable to read locator=%s rolluptype=%s columnFamilyName=%s for rollup", locator, rollupType.name(), columnFamilyName ), e ); throw new IOException( e ); } finally { ctx.stop(); } }
Source:
public void testImportUnrelatedDeploymentChangesWhilePushing() throws Exception { System.out.println("Deployment changes that don't affect importers should not result in them restarting."); CountDownLatch dataGenerationAwaiter = asyncPushDataToImporters(4000, 3); updateDeploymentFile(true, true); Thread.sleep(1000); updateDeploymentFile(true, false); dataGenerationAwaiter.await(); verifyData(m_client, 12000); }

Target:
public void testImportUnrelatedDeploymentChangesWhilePushing() throws Exception { System.out.println("Deployment changes that don't affect importers should not result in them restarting."); asyncPushDataToImporters(0, 3); updateDeploymentFile(true, true); updateDeploymentFile(true, false); waitForData(); }
Source:
public byte[] get(String key) { byte[] aggregatedZNodeValues = new byte[0]; for (int segmentIndex = 0;; ++segmentIndex) { String zkPath = getZkPath(key, segmentIndex); byte[] zNodeValue = zkClient.readData(zkPath, true); if (zNodeValue == null) { break; } aggregatedZNodeValues = Bytes.concat(aggregatedZNodeValues, zNodeValue); } if (aggregatedZNodeValues.length > 0) { byte[] value = ArrayUtils.subarray(aggregatedZNodeValues, 0, aggregatedZNodeValues.length - CHECKSUM_SIZE_IN_BYTES); byte[] checkSum = ArrayUtils.subarray(aggregatedZNodeValues, aggregatedZNodeValues.length - CHECKSUM_SIZE_IN_BYTES, aggregatedZNodeValues.length); byte[] expectedCheckSum = getCRCChecksum(value); if (!Arrays.equals(checkSum, expectedCheckSum)) { throw new IllegalStateException("Expected checksum of value did not match the actual checksum"); } return value; } return null; }

Target:
public byte[] get(String key) { byte[] aggregatedZNodeValues = new byte[0]; for (int segmentIndex = 0;; ++segmentIndex) { String zkPath = getZkPath(key, segmentIndex); byte[] zNodeValue = zkClient.readData(zkPath, true); if (zNodeValue == null) { break; } aggregatedZNodeValues = Bytes.concat(aggregatedZNodeValues, zNodeValue); } if (aggregatedZNodeValues.length > 0) { byte[] value = ArrayUtils.subarray(aggregatedZNodeValues, 0, aggregatedZNodeValues.length - CHECKSUM_SIZE_IN_BYTES); byte[] checkSum = ArrayUtils.subarray(aggregatedZNodeValues, aggregatedZNodeValues.length - CHECKSUM_SIZE_IN_BYTES, aggregatedZNodeValues.length); byte[] expectedChecksum = getCRCChecksum(value); if (!Arrays.equals(checkSum, expectedChecksum)) { String exceptionMessage = String.format("Expected checksum: %s did not match the actual checksum: %s for value: %s", Arrays.toString(expectedChecksum), Arrays.toString(value), Arrays.toString(checkSum)); LOG.error(exceptionMessage); throw new IllegalStateException(exceptionMessage); } return value; } return null; }
Source:
private WebElement getCategory(List<WebElement> categoryList, final String categoryName) { List<WebElement> foundCategories = categoryList.stream() .filter(element -> element .getAttribute("innerText") .trim() .equalsIgnoreCase(categoryName) ) .collect(Collectors.toList()); if (foundCategories.isEmpty()) { return null; } else if (foundCategories.size() == 1) { return foundCategories.get(0) ; } else { return foundCategories .stream() .filter(WebElement::isDisplayed) .collect(Collectors.toList()) .get(0); } }

Target:
private WebElement getCategory(List<WebElement> categoryList, final String categoryName) throws NotFoundException { List<WebElement> foundCategories = categoryList.stream() .filter(element -> element .getAttribute("innerText") .trim() .equalsIgnoreCase(categoryName) ) .collect(Collectors.toList()); if (foundCategories.isEmpty()) { throw new NotFoundException("Could not find any categories on the list"); } else if (foundCategories.size() == 1) { return foundCategories.get(0) ; } else { return foundCategories .stream() .filter(WebElement::isDisplayed) .collect(Collectors.toList()) .get(0); } }
Source:
public void modifyAST(IIndex index, IMarker marker) { try { IASTTranslationUnit ast = getTranslationUnitViaEditor(marker).getAST(index, ITranslationUnit.AST_SKIP_INDEXED_HEADERS); int markerStart = marker.getAttribute(IMarker.CHAR_START, -1); int markerEnd = marker.getAttribute(IMarker.CHAR_END, -1); if (markerStart == -1 || markerEnd == -1 || markerStart >= markerEnd) return; IASTNodeSelector nodeSelector = ast.getNodeSelector(null); IASTNode containedNode = nodeSelector.findEnclosingNode(markerStart, markerEnd - markerStart); if (containedNode instanceof IASTBinaryExpression) { IASTBinaryExpression expr = (IASTBinaryExpression) containedNode; IASTNodeLocation[] leftSubexprLocations = expr.getOperand1().getNodeLocations(); if (leftSubexprLocations.length != 1) return; IASTNodeLocation leftSubexprLocation = leftSubexprLocations[0]; int leftSubexprEnd = leftSubexprLocation.getNodeOffset() + leftSubexprLocation.getNodeLength(); FindReplaceDocumentAdapter dad = new FindReplaceDocumentAdapter(getDocument()); dad.find(leftSubexprEnd, "=", true, false, false, false); dad.replace("==", false ); } } catch (CoreException e) { CheckersUiActivator.log(e); } catch (BadLocationException e) { CheckersUiActivator.log(e); } }

Target:
public void modifyAST(IIndex index, IMarker marker) { try { IASTTranslationUnit ast = getTranslationUnitViaEditor(marker).getAST(index, ITranslationUnit.AST_SKIP_INDEXED_HEADERS); int markerStart = marker.getAttribute(IMarker.CHAR_START, -1); int markerEnd = marker.getAttribute(IMarker.CHAR_END, -1); if (markerStart == -1 || markerEnd == -1 || markerStart >= markerEnd) return; IASTNodeSelector nodeSelector = ast.getNodeSelector(null); IASTNode containedNode = nodeSelector.findEnclosingNode(markerStart, markerEnd - markerStart); if (containedNode instanceof IASTBinaryExpression) { IASTBinaryExpression expr = (IASTBinaryExpression) containedNode; IASTNodeLocation[] leftSubexprLocations = expr.getOperand1().getNodeLocations(); if (leftSubexprLocations.length != 1) return; IASTNodeLocation leftSubexprLocation = leftSubexprLocations[0]; int leftSubexprEnd = leftSubexprLocation.getNodeOffset() + leftSubexprLocation.getNodeLength(); FindReplaceDocumentAdapter adapter = new FindReplaceDocumentAdapter(getDocument()); adapter.find(leftSubexprEnd, "=", true, false, false, false); adapter.replace("==", false ); } } catch (CoreException e) { CheckersUiActivator.log(e); } catch (BadLocationException e) { CheckersUiActivator.log(e); } }
Source:
protected void appendChangeTimestampToDescription(StringBuilder description, JiraSite site, long timestamp) { DateFormat df = null; if (!StringUtils.isBlank(site.getDateTimePattern())) { df = new SimpleDateFormat(site.getDateTimePattern()); } else { df = new SimpleDateFormat("d/M/yy hh:mm a", Locale.getDefault()); } Date changeDate = new Date(timestamp); String dateTimeString = df.format(changeDate); description.append(dateTimeString); }

Target:
protected void appendChangeTimestampToDescription(StringBuilder description, JiraSite site, long timestamp) { DateFormat df = null; if (StringUtils.isBlank(site.getDateTimePattern())) { df = new SimpleDateFormat("d/M/yy hh:mm a", Locale.getDefault()); } else { df = new SimpleDateFormat(site.getDateTimePattern()); } Date changeDate = new Date(timestamp); String dateTimeString = df.format(changeDate); description.append(dateTimeString); }
Source:
public void testWith() throws DatabaseEngineException { if (this.engine instanceof MySqlEngine) { return; } test5Columns(); engine.persist("TEST", entry().set("COL1", 1).set("COL5", "manuel") .build()); engine.persist("TEST", entry().set("COL1", 2).set("COL5", "ana") .build()); engine.persist("TEST", entry().set("COL1", 3).set("COL5", "rita") .build()); engine.persist("TEST", entry().set("COL1", 4).set("COL5", "rui") .build()); final With with = with("friends", select(all()) .from(table("TEST"))) .then( select(column("COL5").alias("name")) .from(table("friends")) .where(eq(column("COL1"), k(1)))); final List<Map<String, ResultColumn>> result = engine.query(with); assertEquals("Name must be 'manuel'", "manuel", result.get(0).get("name").toString()); }

Target:
public void testWith() throws DatabaseEngineException { test5Columns(); engine.persist("TEST", entry().set("COL1", 1).set("COL5", "manuel") .build()); engine.persist("TEST", entry().set("COL1", 2).set("COL5", "ana") .build()); engine.persist("TEST", entry().set("COL1", 3).set("COL5", "rita") .build()); engine.persist("TEST", entry().set("COL1", 4).set("COL5", "rui") .build()); final With with = with("friends", select(all()) .from(table("TEST"))) .then( select(column("COL5").alias("name")) .from(table("friends")) .where(eq(column("COL1"), k(1)))); if (config.engine.contains("MySqlEngine")) { exception.expect(OperationNotSupportedRuntimeException.class);; } final List<Map<String, ResultColumn>> result = engine.query(with); assertEquals("Name must be 'manuel'", "manuel", result.get(0).get("name").toString()); }
Source:
private void addSubscriptions(String... notifications) { NuxeoPrincipal principal = session.getPrincipal(); String subscriber = NotificationConstants.USER_PREFIX + principal.getName(); for (String notif : notifications) { notificationService.addSubscription(subscriber, notif, commentedDocumentModel, false, principal, notif); } }

Target:
protected void addSubscriptions(String... notifications) { NuxeoPrincipal principal = session.getPrincipal(); String subscriber = NotificationConstants.USER_PREFIX + principal.getName(); for (String notif : notifications) { notificationService.addSubscription(subscriber, notif, commentedDocumentModel, false, principal, notif); } }
Source:
private K processConjuncts(ConjunctiveFormula conjunct) { if (conjunct.klabel().toString().equals(KLabels.AND)) { List<K> kList = conjunct.items(); List<K> flatList = new ArrayList(); flattenList(kList, flatList); flatList = flatList.stream().map(this::kApplyConversion).collect(Collectors.toList()); return flatList.stream().reduce(BoolToken.TRUE, (x, y) -> KORE.KApply(KORE.KLabel(KLabels.AND), x, y)); } return KORE.KApply(KORE.KLabel(KLabels.AND), kApplyConversion(conjunct.toKore()), BoolToken.TRUE); }

Target:
private K processConjuncts(ConjunctiveFormula conjunct) { if (conjunct.klabel().name().equals(KLabels.AND)) { List<K> kList = conjunct.items(); List<K> flatList = new ArrayList(); flattenList(kList, flatList); flatList = flatList.stream().map(this::kApplyConversion).collect(Collectors.toList()); return flatList.stream().reduce(KORE.KApply(KORE.KLabel(KLabels.ML_TRUE)), (x, y) -> KORE.KApply(KORE.KLabel(KLabels.ML_AND), x, y)); } return KORE.KApply(KORE.KLabel(KLabels.ML_AND), kApplyConversion(conjunct.toKore()), KORE.KApply(KORE.KLabel(KLabels.ML_TRUE))); }
Source:
public void setStatus(int sc, String sm) { if (super.getStatus() == OK) { super.setStatus(sc, sm); } status = sc; }

Target:
public void setStatus(int sc, String sm) { status = sc; }
Source:
Class getClassWithName(String classname) { for (String pkg : packages) { String name; if (pkg.isEmpty()) { name = classname; } else { name = pkg + '.' + classname; } try { return Class.forName(name); } catch (ClassNotFoundException e) { } } System.out.println( "Could not load class '" + classname + "'; looked in the following packages: " + packages); return null; }

Target:
Class getClassWithName(String classname) { for (String pkg : packages) { String name; if (pkg.isEmpty()) { name = classname; } else { name = pkg + '.' + classname; } try { return Class.forName(name); } catch (ClassNotFoundException e) { } } Util.fatalError( "Could not load class '" + classname + "'; looked in the following packages: " + packages); return null; }
Source:
public static Stream getByName(ZulipApp app, String name) { Stream stream = null; try { RuntimeExceptionDao<Stream, Object> streams = app.getDao(Stream.class); stream = streams.queryBuilder().where() .eq(Stream.NAME_FIELD, new SelectArg(name)).queryForFirst(); if (stream == null) { Log.w("Stream.getByName", "We received a stream message for a stream we don't have data for. Fake it until you make it."); stream = app.getDao(Stream.class).createIfNotExists(new Stream(name)); } } catch (SQLException e) { throw new RuntimeException(e); } return stream; }

Target:
public static Stream getByName(ZulipApp app, String name) { Stream stream = null; try { RuntimeExceptionDao<Stream, Object> streams = app.getDao(Stream.class); stream = streams.queryBuilder().where() .eq(Stream.NAME_FIELD, new SelectArg(name)).queryForFirst(); if (stream == null) { Log.w("Stream.getByName", "We received a stream message for a stream we don't have data for. Fake it until you make it."); stream = new Stream(name); app.getDao(Stream.class).createIfNotExists(stream); } } catch (SQLException e) { throw new RuntimeException(e); } return stream; }
Source:
public static CommentInfo createRange(String path, Side side, int line, String in_reply_to, String message, CommentRange range) { CommentInfo info = createFile(path, side, in_reply_to, message); info.setLine(line); info.setRange(range); return info; }

Target:
public static CommentInfo createRange(String path, Side side, int line, String in_reply_to, String message, CommentRange range) { CommentInfo info = createFile(path, side, in_reply_to, message); info.setRange(range); info.setLine(range == null ? line : range.end_line()); return info; }
Source:
public Asset getAsset(final String assetId) throws IOException, BadVersionException, RequestFailureException { Asset ass = readJson(assetId); ass.set_id(assetId); WlpInformation wlpInfo = ass.getWlpInformation(); if (wlpInfo == null) { wlpInfo = new WlpInformation(); ass.setWlpInformation(wlpInfo); } if (wlpInfo.getAppliesToFilterInfo() == null) { wlpInfo.setAppliesToFilterInfo(Collections.<AppliesToFilterInfo> emptyList()); } return ass; }

Target:
public Asset getAsset(final String assetId) throws IOException, BadVersionException, RequestFailureException { return getAsset(new File(assetId)); }
Source:
private void updateReceivedMediaStreamStats( RTCPPacket[] in) { MediaStreamStatsImpl streamStats = mediaStream.getMediaStreamStats(); for (RTCPPacket rtcp : in) { switch (rtcp.type) { case RTCPFBPacket.PSFB: if (rtcp instanceof RTCPREMBPacket) { RTCPREMBPacket remb = (RTCPREMBPacket) rtcp; if (logger.isTraceEnabled()) { logger.trace( "remb,stream=" + mediaStream.hashCode() + " bps=" + remb.getBitrate() + ",dest=" + Arrays.toString(remb.getDest())); } streamStats.rembReceived(remb); } break; case RTCPPacket.SR: if (rtcp instanceof RTCPSRPacket) { streamStats.srReceived((RTCPSRPacket) rtcp); } case RTCPPacket.RR: { RTCPReport report; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); rtcp.assemble(new DataOutputStream(baos)); byte[] buf = baos.toByteArray(); report = parseRTCPReport(rtcp.type, buf, 0, buf.length); } catch (IOException ioe) { logger.error("Failed to assemble an RTCP report: " + ioe); report = null; } if (report != null) { streamStats.getRTCPReports().rtcpReportReceived(report); } } break; case RTCPFBPacket.RTPFB: if (rtcp instanceof NACKPacket) { NACKPacket nack = (NACKPacket) rtcp; streamStats.nackReceived(nack); } break; case RTCPExtendedReport.XR: if (rtcp instanceof RTCPExtendedReport) { streamStats.getRTCPReports().rtcpExtendedReportReceived( (RTCPExtendedReport) rtcp); } break; default: break; } } }

Target:
private void updateReceivedMediaStreamStats( RTCPPacket[] in) { MediaStreamStatsImpl streamStats = mediaStream.getMediaStreamStats(); for (RTCPPacket rtcp : in) { switch (rtcp.type) { case RTCPFBPacket.PSFB: if (rtcp instanceof RTCPREMBPacket) { RTCPREMBPacket remb = (RTCPREMBPacket) rtcp; if (logger.isTraceEnabled()) { logger.trace("remb_received,stream=" + mediaStream.hashCode() + " bps=" + remb.getBitrate() + ",dest=" + Arrays.toString(remb.getDest())); } streamStats.rembReceived(remb); } break; case RTCPPacket.SR: if (rtcp instanceof RTCPSRPacket) { streamStats.srReceived((RTCPSRPacket) rtcp); } case RTCPPacket.RR: { RTCPReport report; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); rtcp.assemble(new DataOutputStream(baos)); byte[] buf = baos.toByteArray(); report = parseRTCPReport(rtcp.type, buf, 0, buf.length); } catch (IOException ioe) { logger.error("Failed to assemble an RTCP report: " + ioe); report = null; } if (report != null) { streamStats.getRTCPReports().rtcpReportReceived(report); } } break; case RTCPFBPacket.RTPFB: if (rtcp instanceof NACKPacket) { NACKPacket nack = (NACKPacket) rtcp; streamStats.nackReceived(nack); } break; case RTCPExtendedReport.XR: if (rtcp instanceof RTCPExtendedReport) { streamStats.getRTCPReports().rtcpExtendedReportReceived( (RTCPExtendedReport) rtcp); } break; default: break; } } }
Source:
protected void init() { super.init(); setVmId(getParameters().getContainerId()); setStoragePoolId(getParameters().getStoragePoolId()); imageToDestinationDomainMap = getParameters().getImageToDestinationDomainMap(); if (getParameters().getVm() != null && getVm().getDiskMap() != null) { getVm().getDiskMap().values().stream().filter(DisksFilter.ONLY_IMAGES) .map(DiskImage.class::cast).collect(Collectors.toList()); } ensureDomainMap(imageList, getParameters().getDestDomainId()); }

Target:
protected void init() { super.init(); setVmId(getParameters().getContainerId()); setStoragePoolId(getParameters().getStoragePoolId()); imageToDestinationDomainMap = getParameters().getImageToDestinationDomainMap(); if (getParameters().getVm() != null && getVm().getDiskMap() != null) { imageList = getVm().getDiskMap().values().stream().filter(DisksFilter.ONLY_IMAGES) .map(DiskImage.class::cast).collect(Collectors.toList()); } ensureDomainMap(imageList, getParameters().getDestDomainId()); }
Source:
public HttpSocialNetworkServer(SocialNetwork social, MutablePointers mutable, InetSocketAddress address) throws IOException { this.address = address; if (address.getHostName().contains("local")) server = HttpServer.create(address, CONNECTION_BACKLOG); else server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), address.getPort()), CONNECTION_BACKLOG); ch = new SocialHandler(social); server.createContext("/" + SOCIAL_URL, ch); server.createContext("/" + HttpMutablePointerServer.MUTABLE_POINTERS_URL, new HttpMutablePointerServer.MutationHandler(mutable)); server.setExecutor(Executors.newFixedThreadPool(HANDLER_THREAD_COUNT)); }

Target:
public HttpSocialNetworkServer(SocialNetwork social, MutablePointers mutable, InetSocketAddress address) throws IOException { this.address = address; if (address.getHostName().toLowerCase().contains("local")) server = HttpServer.create(address, CONNECTION_BACKLOG); else server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), address.getPort()), CONNECTION_BACKLOG); ch = new SocialHandler(social); server.createContext("/" + SOCIAL_URL, ch); server.createContext("/" + HttpMutablePointerServer.MUTABLE_POINTERS_URL, new HttpMutablePointerServer.MutationHandler(mutable)); server.setExecutor(Executors.newFixedThreadPool(HANDLER_THREAD_COUNT)); }
Source:
public ActivationKey updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, ActivationKey key) { ActivationKey toUpdate = activationKeyCurator.verifyAndLookupKey(activationKeyId); if (key.getName() != null) { toUpdate.setName(key.getName()); } String serviceLevel = key.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner(), serviceLevel); toUpdate.setServiceLevel(serviceLevel); } if (key.getReleaseVer() != null) { toUpdate.setReleaseVer(key.getReleaseVer()); } if (key.getDescription() != null) { toUpdate.setDescription(key.getDescription()); } toUpdate.setAutoAttach(key.isAutoAttach()); activationKeyCurator.merge(toUpdate); return toUpdate; }

Target:
public ActivationKey updateActivationKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, ActivationKey key) { ActivationKey toUpdate = activationKeyCurator.verifyAndLookupKey(activationKeyId); if (key.getName() != null) { toUpdate.setName(key.getName()); } String serviceLevel = key.getServiceLevel(); if (serviceLevel != null) { serviceLevelValidator.validate(toUpdate.getOwner(), serviceLevel); toUpdate.setServiceLevel(serviceLevel); } if (key.getReleaseVer() != null) { toUpdate.setReleaseVer(key.getReleaseVer()); } if (key.getDescription() != null) { toUpdate.setDescription(key.getDescription()); } if (key.isAutoAttach() != null) { toUpdate.setAutoAttach(key.isAutoAttach()); } activationKeyCurator.merge(toUpdate); return toUpdate; }
Source:
private static boolean isValidHostName(String name) { return isIPv4Address(name) || isIPv6Address(name) || isRFC3986HostName(name); }

Target:
private static boolean isValidHostName(String name) { return isIPv6Address(name) || isRFC3986HostName(name); }
Source:
public void run() { LOG.info(getName() + " thread started"); synchronized (this) { started = true; this.notifyAll(); } try { runLoop(); } finally { try { watchService.close(); } catch (IOException e) { LOG.warn("Error closing watch service", e); } LOG.info(getName() + " thread finished"); } }

Target:
public void run() { try { LOG.info(getName() + " thread started"); if (!compareAndSetState( FileChangeWatcher.State.STARTING, FileChangeWatcher.State.RUNNING)) { FileChangeWatcher.State state = FileChangeWatcher.this.getState(); if (state != FileChangeWatcher.State.STOPPING) { throw new IllegalStateException("Unexpected state: " + state); } return; } runLoop(); } catch (Exception e) { LOG.warn("Error in runLoop()", e); throw e; } finally { try { watchService.close(); } catch (IOException e) { LOG.warn("Error closing watch service", e); } LOG.info(getName() + " thread finished"); FileChangeWatcher.this.setState(FileChangeWatcher.State.STOPPED); } }