auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Socket createSocket(final String host, final int port, final InetAddress localAddress, final int localPort, final HttpConnectionParams params) throws IOException, UnknownHostException, ConnectTimeoutException { if (params == null) { throw new IllegalArgumentException("Parameters may not be null"); } int timeout = params.getConnectionTimeout(); if (timeout == 0) { InetAddress hostAddress = getCachedMisconfiguredHost(host, port); if (hostAddress != null) { return clientSSLSockFactory.createSocket(hostAddress, port, localAddress, localPort); } try { SSLSocket sslSocket = (SSLSocket) clientSSLSockFactory.createSocket(host, port, localAddress, localPort); try { sslSocket.startHandshake(); } catch (SSLException ex) { String errHandshakeFailHelpMsg = Constant.messages.getString("network.sslconnector.handshake.error.help", Constant.messages.getString("network.sslconnector.handshake.error.help.url")); logger.warn("An exception occurred while attempting to connect to: " + sslSocket.getInetAddress()); logger.warn("The exception was: " + ex.getMessage()); logger.warn(errHandshakeFailHelpMsg); if (logger.isDebugEnabled()) { logger.debug(ex, ex); } throw ex; } return sslSocket; } catch (SSLException e) { if (!e.getMessage().contains(CONTENTS_UNRECOGNIZED_NAME_EXCEPTION)) { throw e; } hostAddress = InetAddress.getByName(host); cacheMisconfiguredHost(host, port, hostAddress); return clientSSLSockFactory.createSocket(hostAddress, port, localAddress, localPort); } } Socket socket = clientSSLSockFactory.createSocket(); SocketAddress localAddr = new InetSocketAddress(localAddress, localPort); socket.bind(localAddr); SocketAddress remoteAddr = new InetSocketAddress(host, port); socket.connect(remoteAddr, timeout); return socket; }

Target:
public Socket createSocket(final String host, final int port, final InetAddress localAddress, final int localPort, final HttpConnectionParams params) throws IOException, UnknownHostException, ConnectTimeoutException { if (params == null) { throw new IllegalArgumentException("Parameters may not be null"); } int timeout = params.getConnectionTimeout(); if (timeout == 0) { InetAddress hostAddress = getCachedMisconfiguredHost(host, port); if (hostAddress != null) { return clientSSLSockFactory.createSocket(hostAddress, port, localAddress, localPort); } try { SSLSocket sslSocket = (SSLSocket) clientSSLSockFactory.createSocket(host, port, localAddress, localPort); sslSocket.startHandshake(); return sslSocket; } catch (SSLException e) { if (!e.getMessage().contains(CONTENTS_UNRECOGNIZED_NAME_EXCEPTION)) { throw e; } hostAddress = InetAddress.getByName(host); cacheMisconfiguredHost(host, port, hostAddress); return clientSSLSockFactory.createSocket(hostAddress, port, localAddress, localPort); } } Socket socket = clientSSLSockFactory.createSocket(); SocketAddress localAddr = new InetSocketAddress(localAddress, localPort); socket.bind(localAddr); SocketAddress remoteAddr = new InetSocketAddress(host, port); socket.connect(remoteAddr, timeout); return socket; }
Source:
public IncrementalIndexAdapter( Interval dataInterval, IncrementalIndex<?> index, BitmapFactory bitmapFactory ) { this.dataInterval = dataInterval; this.index = index; this.hasNullValueDimensions = Sets.newHashSet(); final List<IncrementalIndex.DimensionDesc> dimensions = index.getDimensions(); indexers = Maps.newHashMapWithExpectedSize(dimensions.size()); for (IncrementalIndex.DimensionDesc dimension : dimensions) { indexers.put(dimension.getName(), new DimensionIndexer(dimension)); } int rowNum = 0; for (IncrementalIndex.TimeAndDims timeAndDims : index.getFacts().keySet()) { final int[][] dims = timeAndDims.getDims(); for (IncrementalIndex.DimensionDesc dimension : dimensions) { final int dimIndex = dimension.getIndex(); DimensionIndexer indexer = indexers.get(dimension.getName()); if (indexer == null || dims == null) { log.error("bitmapIndexes and dims are null!"); continue; } if (dimIndex >= dims.length || dims[dimIndex] == null) { hasNullValueDimensions.add(dimension.getName()); continue; } final IncrementalIndex.DimDim values = dimension.getValues(); if (hasNullValue(values, dims[dimIndex])) { hasNullValueDimensions.add(dimension.getName()); } final MutableBitmap[] bitmapIndexes = indexer.invertedIndexes; for (int dimIdx : dims[dimIndex]) { if (bitmapIndexes[dimIdx] == null) { bitmapIndexes[dimIdx] = bitmapFactory.makeEmptyMutableBitmap(); } try { bitmapIndexes[dimIdx].add(rowNum); } catch (Exception e) { log.info(e.toString()); } } } ++rowNum; } }

Target:
public IncrementalIndexAdapter( Interval dataInterval, IncrementalIndex<?> index, BitmapFactory bitmapFactory ) { this.dataInterval = dataInterval; this.index = index; this.hasNullValueDimensions = Sets.newHashSet(); final List<IncrementalIndex.DimensionDesc> dimensions = index.getDimensions(); indexers = Maps.newHashMapWithExpectedSize(dimensions.size()); for (IncrementalIndex.DimensionDesc dimension : dimensions) { indexers.put(dimension.getName(), new DimensionIndexer(dimension)); } int rowNum = 0; for (IncrementalIndex.TimeAndDims timeAndDims : index.getFacts().keySet()) { final int[][] dims = timeAndDims.getDims(); for (IncrementalIndex.DimensionDesc dimension : dimensions) { final int dimIndex = dimension.getIndex(); DimensionIndexer indexer = indexers.get(dimension.getName()); if (dimIndex >= dims.length || dims[dimIndex] == null) { hasNullValueDimensions.add(dimension.getName()); continue; } final IncrementalIndex.DimDim values = dimension.getValues(); if (hasNullValue(values, dims[dimIndex])) { hasNullValueDimensions.add(dimension.getName()); } final MutableBitmap[] bitmapIndexes = indexer.invertedIndexes; for (int dimIdx : dims[dimIndex]) { if (bitmapIndexes[dimIdx] == null) { bitmapIndexes[dimIdx] = bitmapFactory.makeEmptyMutableBitmap(); } try { bitmapIndexes[dimIdx].add(rowNum); } catch (Exception e) { log.info(e.toString()); } } } ++rowNum; } }
Source:
ChangeAndCommit(@Nullable Change change, @Nullable PatchSet ps, RevCommit c) throws RepositoryNotFoundException, IOException, OrmException { if (change != null) { changeId = change.getKey().get(); _changeNumber = change.getChangeId(); _revisionNumber = ps != null ? ps.getPatchSetId() : null; PatchSet.Id curr = change.currentPatchSetId(); _currentRevisionNumber = curr != null ? curr.get() : null; } commit = new CommitInfo(); commit.commit = c.name(); commit.parents = Lists.newArrayListWithCapacity(c.getParentCount()); for (int i = 0; i < c.getParentCount(); i++) { CommitInfo p = new CommitInfo(); p.commit = c.getParent(i).name(); commit.parents.add(p); } commit.author = toGitPerson(c.getAuthorIdent()); commit.subject = c.getShortMessage(); IncludedInDetail detail = new IncludedInDetail(); detail = resolveBranches(c); branches = detail.getBranches().size() != 0 ? detail.getBranches() : null; }

Target:
ChangeAndCommit(@Nullable Change change, @Nullable PatchSet ps, RevCommit c) throws RepositoryNotFoundException, IOException, OrmException { if (change != null) { changeId = change.getKey().get(); _changeNumber = change.getChangeId(); _revisionNumber = ps != null ? ps.getPatchSetId() : null; PatchSet.Id curr = change.currentPatchSetId(); _currentRevisionNumber = curr != null ? curr.get() : null; } commit = new CommitInfo(); commit.commit = c.name(); commit.parents = Lists.newArrayListWithCapacity(c.getParentCount()); for (int i = 0; i < c.getParentCount(); i++) { CommitInfo p = new CommitInfo(); p.commit = c.getParent(i).name(); commit.parents.add(p); } commit.author = toGitPerson(c.getAuthorIdent()); commit.subject = c.getShortMessage(); IncludedInDetail detail = resolveBranches(c); branches = detail.getBranches().size() != 0 ? detail.getBranches() : null; }
Source:
protected void executeCommand() { SessionDataContainer.getInstance().setData( getParameters().getSessionId(), SessionDataContainer.SOFT_LIMIT_INTERVAL_PARAMETER_NAME, getParameters().getSoftLimit()); setSucceeded(true); }

Target:
protected void executeCommand() { T params = getParameters(); String sessionId = params.getSessionId(); if (SessionDataContainer.getInstance().isSessionExists(sessionId)) { SessionDataContainer.getInstance().setSoftLimitInterval(sessionId, params.getSoftLimit()); setSucceeded(true); } else { setSucceeded(false); } }
Source:
public void constructor() { String namespace = "an-namespace-test"; String entity = "an-entity-name"; String trackingId = "a-tracking-id"; Integer credits = -10; LinkErrorContext context = new LinkErrorContext(namespace, entity, trackingId, credits); Assertions.assertEquals(namespace, context.getNamespace()); Assertions.assertEquals(entity, context.getEntityPath()); Assertions.assertEquals(trackingId, context.getTrackingId()); Assertions.assertEquals(credits, context.getLinkCredit()); Assertions.assertEquals(context.toString(),context.toString()); }

Target:
public void constructor() { String namespace = "an-namespace-test"; String entity = "an-entity-name"; String trackingId = "a-tracking-id"; Integer credits = -10; LinkErrorContext context = new LinkErrorContext(namespace, entity, trackingId, credits); Assertions.assertEquals(namespace, context.getNamespace()); Assertions.assertEquals(entity, context.getEntityPath()); Assertions.assertEquals(trackingId, context.getTrackingId()); Assertions.assertEquals(credits, context.getLinkCredit()); }
Source:
public VmTemplate getVmTemplate() { if (vmTemplateFromConfiguration == null) { initUnregisteredTemplate(); } return vmTemplateFromConfiguration; }

Target:
public VmTemplate getVmTemplate() { return vmTemplateFromConfiguration; }
Source:
private void sendAndReceiveFastGuts(boolean tempQueue) { try { this.template.execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return null; } }); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(this.template.getConnectionFactory()); container.setQueueNames(ROUTE); final AtomicReference<String> replyToWas = new AtomicReference<String>(); MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(new Object() { @SuppressWarnings("unused") public Message handleMessage(Message message) { replyToWas.set(message.getMessageProperties().getReplyTo()); return new Message(new String(message.getBody()).toUpperCase().getBytes(), message.getMessageProperties()); } }); messageListenerAdapter.setMessageConverter(null); container.setMessageListener(messageListenerAdapter); container.start(); this.template.setQueue(ROUTE); this.template.setRoutingKey(ROUTE); Object result = this.template.convertSendAndReceive("foo"); container.stop(); assertEquals("FOO", result); if (tempQueue) { assertThat(replyToWas.get(), not(startsWith(Address.AMQ_RABBITMQ_REPLY_TO))); } else { assertThat(replyToWas.get(), startsWith(Address.AMQ_RABBITMQ_REPLY_TO)); } } catch (Exception e) { e.printStackTrace(); assertThat(e.getCause().getCause().getMessage(), containsString("404")); logger.info("Broker does not support fast replies; test skipped " + e.getMessage()); } }

Target:
private void sendAndReceiveFastGuts(boolean tempQueue) { try { this.template.execute(new ChannelCallback<Void>() { @Override public Void doInRabbit(Channel channel) throws Exception { channel.queueDeclarePassive(Address.AMQ_RABBITMQ_REPLY_TO); return null; } }); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(this.template.getConnectionFactory()); container.setQueueNames(ROUTE); final AtomicReference<String> replyToWas = new AtomicReference<String>(); MessageListenerAdapter messageListenerAdapter = new MessageListenerAdapter(new Object() { @SuppressWarnings("unused") public Message handleMessage(Message message) { replyToWas.set(message.getMessageProperties().getReplyTo()); return new Message(new String(message.getBody()).toUpperCase().getBytes(), message.getMessageProperties()); } }); messageListenerAdapter.setMessageConverter(null); container.setMessageListener(messageListenerAdapter); container.start(); this.template.setQueue(ROUTE); this.template.setRoutingKey(ROUTE); Object result = this.template.convertSendAndReceive("foo"); container.stop(); assertEquals("FOO", result); if (tempQueue) { assertThat(replyToWas.get(), not(startsWith(Address.AMQ_RABBITMQ_REPLY_TO))); } else { assertThat(replyToWas.get(), startsWith(Address.AMQ_RABBITMQ_REPLY_TO)); } } catch (Exception e) { assertThat(e.getCause().getCause().getMessage(), containsString("404")); logger.info("Broker does not support fast replies; test skipped " + e.getMessage()); } }
Source:
public void setUp() { setInitializationStatus(false, false, false, false); manager = getManagerWithCallback(true, mockCallback); }

Target:
public void setUp() { nothingInitialized(); manager = getManagerWithCallback(true, mockCallback); when(mockKvs.getClusterAvailabilityStatus()).thenReturn(ClusterAvailabilityStatus.ALL_AVAILABLE); }
Source:
public int compareTo(SequencingParameters other) { if (!(other instanceof SequencingParameters)) return -1; if (name.startsWith("v4")) { if ("v4 2×126".equals(name)) return -1; if ("v4 2×126".equals(other.name)) return 1; if (other.name.startsWith("v4")) return other.name.compareTo(name); return -1; } else if (name.startsWith("Rapid Run")) { if (other.name.startsWith("v4")) return 1; if (other.name.startsWith("Rapid Run")) return other.name.compareTo(name); return -1; } else if (name.startsWith("10X")) { if (other.name.startsWith("v4") || other.name.startsWith("Rapid Run")) return 1; if (other.name.startsWith("10X")) return other.name.compareTo(name); return -1; } else if (name.startsWith("v3")) { if (other.name.startsWith("v4") || other.name.startsWith("Rapid Run") || other.name.startsWith("10X")) return 1; if (other.name.startsWith("v3")) return other.name.compareTo(name); return -1; } else { return other.name.compareTo(name); } }

Target:
public int compareTo(SequencingParameters other) { Integer thisSortKey = null; for (int i = 0; i < sortOrder.size(); i++) { if (name.startsWith(sortOrder.get(i))) { thisSortKey = i; break; } } if (thisSortKey == null) thisSortKey = 100; Integer otherSortKey = null; for (int i = 0; i < sortOrder.size(); i++) { if (other.name.startsWith(sortOrder.get(i))) { otherSortKey = i; break; } } if (otherSortKey == null) otherSortKey = 100; if (thisSortKey == otherSortKey) { return name.compareTo(other.name); } else { return thisSortKey - otherSortKey; } }
Source:
public void testNormalScheme() { Assert.assertEquals("ftp", UriParser.extractSupportedScheme(schemes,"ftp://user:pass@host/some/path/some:file")); }

Target:
public void testNormalScheme() { Assert.assertEquals("ftp", UriParser.extractScheme(schemes,"ftp://user:pass@host/some/path/some:file")); }
Source:
public static Module getParentModule(ITestContext context) { if (isStringNotEmpty(context.getSuite().getParentModule())) { Class<?> parentModule = ClassHelper.forName(context.getSuite().getParentModule()); if (parentModule == null) { throw new TestNGException( "Cannot load parent Guice module class: " + context.getSuite().getParentModule()); } if (!Module.class.isAssignableFrom(parentModule)) { throw new TestNGException("Provided class is not a Guice module: " + parentModule.getName()); } try { Constructor<?> moduleConstructor = parentModule.getDeclaredConstructor(ITestContext.class); return (Module)InstanceCreator.newInstance(moduleConstructor, context); } catch (NoSuchMethodException e) { return (Module)InstanceCreator.newInstance(parentModule); } } return null; }

Target:
private static Module getParentModule(ITestContext context) { if (isStringEmpty(context.getSuite().getParentModule())) { return null; } Class<?> parentModule = ClassHelper.forName(context.getSuite().getParentModule()); if (parentModule == null) { throw new TestNGException( "Cannot load parent Guice module class: " + context.getSuite().getParentModule()); } if (!Module.class.isAssignableFrom(parentModule)) { throw new TestNGException("Provided class is not a Guice module: " + parentModule.getName()); } try { Constructor<?> moduleConstructor = parentModule.getDeclaredConstructor(ITestContext.class); return (Module)InstanceCreator.newInstance(moduleConstructor, context); } catch (NoSuchMethodException e) { return (Module)InstanceCreator.newInstance(parentModule); } }
Source:
private boolean rangeHeaderExists(HttpServletRequest httpRequest) { boolean response = false; if (null != httpRequest && null != httpRequest.getHeader(HEADER_RANGE)) { response = true; } return response; }

Target:
private boolean rangeHeaderExists(HttpServletRequest httpRequest) { boolean response = false; if (httpRequest != null && httpRequest.getHeader(HEADER_RANGE) != null) { response = true; } return response; }
Source:
private boolean parentModuleIsForcedZip(IModule[] moduleTree) { ArrayList<IModule> tmp = new ArrayList<IModule>(); tmp.addAll(Arrays.asList(moduleTree)); tmp.remove(tmp.size()-1); while( tmp.size() > 0 ) { IModule[] tmpArray = tmp.toArray(new IModule[tmp.size()]); if( forceZipModule(tmpArray) ) { return true; } tmp.remove(tmp.size()-1); } return false; }

Target:
private boolean parentModuleIsForcedZip(IModule[] moduleTree) { ArrayList<IModule> tmp = new ArrayList(Arrays.asList(moduleTree)); tmp.remove(tmp.size()-1); while( tmp.size() > 0 ) { IModule[] tmpArray = tmp.toArray(new IModule[tmp.size()]); if( forceZipModule(tmpArray) ) { return true; } tmp.remove(tmp.size()-1); } return false; }
Source:
public String getWorkflowDag(@ApiParam(hidden = true) @Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkOptionalAuthRead(user, workflow); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); if (mainDescriptor != null) { Map<String, String> secondaryDescContent = extractDescriptorAndSecondaryFiles(workflowVersion); LanguageHandlerInterface lInterface = LanguageHandlerFactory.getInterface(workflow.getFileType()); return cleanDAG(lInterface.getContent(workflowVersion.getWorkflowPath(), mainDescriptor.getContent(), secondaryDescContent, LanguageHandlerInterface.Type.DAG, toolDAO)); } return null; }

Target:
public String getWorkflowDag(@ApiParam(hidden = true) @Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkOptionalAuthRead(user, workflow); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); if (mainDescriptor != null) { Map<String, String> secondaryDescContent = extractDescriptorAndSecondaryFiles(workflowVersion); LanguageHandlerInterface lInterface = LanguageHandlerFactory.getInterface(workflow.getFileType()); return lInterface.getCleanDAG(workflowVersion.getWorkflowPath(), mainDescriptor.getContent(), secondaryDescContent, LanguageHandlerInterface.Type.DAG, toolDAO); } return null; }
Source:
private void resetOptionSettings(IHoldsOptions holder) { IOption[] opts = holder.getOptions(); for (IOption opt : opts) { Object val = opt.getDefaultValue(); if (val != null) { if (val instanceof Boolean) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (Boolean)val); } else if (val instanceof String[]) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String[])val); } else { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String)val); } } } }

Target:
private void resetOptionSettings(IHoldsOptions holder) { IOption[] opts = holder.getOptions(); for (IOption opt : opts) { Object val = opt.getDefaultValue(); if (val instanceof Boolean) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (Boolean)val); } else if (val instanceof String[]) { ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String[])val); } else if (val instanceof String){ ManagedBuildManager.setOption(toolChain.getParent(), holder, opt, (String)val); } } }
Source:
int getActualDPI () { long screen = OS.gdk_screen_get_default(); int monitor = OS.gdk_screen_get_primary_monitor(screen); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry(screen, monitor, dest); int widthMM = OS.gdk_screen_get_monitor_width_mm(screen, monitor); return Compatibility.round (254 * dest.width, widthMM * 10); }

Target:
int getActualDPI () { long screen = OS.gdk_screen_get_default(); Rectangle rect = getBounds(); int monitor = OS.gdk_screen_get_monitor_at_point(screen, rect.x, rect.y); GdkRectangle dest = new GdkRectangle (); OS.gdk_screen_get_monitor_geometry(screen, monitor, dest); int widthMM = OS.gdk_screen_get_monitor_width_mm(screen, monitor); return Compatibility.round (254 * dest.width, widthMM * 10); }
Source:
public void visitSwitchStatement(SwitchStatementTree tree) { reportIssue((tree).switchKeyword(), "Refactor the code to eliminate this nested \"switch\"."); }

Target:
public void visitSwitchStatement(SwitchStatementTree tree) { reportIssue(tree.switchKeyword(), "Refactor the code to eliminate this nested \"switch\"."); }
Source:
private void processPropertyUpdated(String instance, String property, State state) { updateIfChanged(instance, property, state); if (property.startsWith("SI")) { updateInputProperties(instance, property); } }

Target:
private void processPropertyUpdated(String instance, String property, State state) { updateIfChanged(instance, property, state); if (property.startsWith(SWITCH_INPUT)) { updateInputProperties(instance, property); } }
Source:
protected boolean canDoAction() { DetachNetworkClusterValidator validator = new DetachNetworkClusterValidator(getParameters().getNetwork(), getParameters().getNetworkCluster()); return validate(validator.notManagementNetwork()) && validate(validator.clusterNetworkNotUsedByVms()) && validate(validator.clusterNetworkNotUsedByTemplates()); }

Target:
protected boolean canDoAction() { DetachNetworkValidator validator = new DetachNetworkValidator(getParameters().getNetwork(), getParameters().getNetworkCluster()); return validate(validator.notManagementNetwork()) && validate(validator.clusterNetworkNotUsedByVms()) && validate(validator.clusterNetworkNotUsedByTemplates()); }
Source:
public void isDefaultPort_Scheme_NULL() { assertTrue(HttpServletRequestUtils.isDefaultPort(null, 443)); }

Target:
public void isDefaultPort_Scheme_NULL() { HttpServletRequestUtils.isDefaultPort(null, 443); }
Source:
public void deleteExchanges(String... exchanges) { ConnectionFactory connectionFactory = getConnectionFactory(); Connection connection = null; Channel channel = null; try { connection = connectionFactory.newConnection(); connection.setId(generateId() + ".queueDelete"); channel = connection.createChannel(); for (String exchange : exchanges) { channel.exchangeDelete(exchange); } } catch (Exception e) { logger.warn("Failed to delete queues", e); } finally { closeResources(connection, channel); } }

Target:
public void deleteExchanges(String... exchanges) { ConnectionFactory connectionFactory = getConnectionFactory(); Connection connection = null; Channel channel = null; try { connection = connectionFactory.newConnection(); connection.setId(generateId() + ".exchangeDelete"); channel = connection.createChannel(); for (String exchange : exchanges) { channel.exchangeDelete(exchange); } } catch (Exception e) { logger.warn("Failed to delete queues", e); } finally { closeResources(connection, channel); } }
Source:
public CriteriaSet getLastCriteriaSet() { return criterias.get(criterias.size() - 1); }

Target:
public CriteriaSet getLastCriteriaSet() { return !criterias.isEmpty() ? criterias.get(criterias.size() - 1) : null; }
Source:
public void refresh() { try { if (this.producer == null) { SustainedConnectionWorker.this.totalProducerConnections.incrementAndGet(); this.producer = new KafkaProducer<>(this.props, new ByteArraySerializer(), new ByteArraySerializer()); this.partitions = this.producer.partitionsFor(this.topicName).stream() .map(partitionInfo -> new TopicPartition(partitionInfo.topic(), partitionInfo.partition())) .collect(Collectors.toList()); Collections.shuffle(this.partitions); } if (this.partitionsIterator == null || !this.partitionsIterator.hasNext()) { this.partitionsIterator = this.partitions.iterator(); } TopicPartition partition = this.partitionsIterator.next(); ProducerRecord<byte[], byte[]> record = new ProducerRecord<>( partition.topic(), partition.partition(), keys.next(), values.next()); producer.send(record).get(); } catch (Throwable e) { this.closeQuietly(); SustainedConnectionWorker.this.totalProducerConnections.decrementAndGet(); SustainedConnectionWorker.this.totalProducerFailedConnections.incrementAndGet(); SustainedConnectionWorker.log.error("Error while refreshing sustained KafkaProducer connection", e.getMessage()); } this.nextUpdate = System.currentTimeMillis() + this.refreshRate; this.inUse = false; }

Target:
public void refresh() { try { if (this.producer == null) { SustainedConnectionWorker.this.totalProducerConnections.incrementAndGet(); this.producer = new KafkaProducer<>(this.props, new ByteArraySerializer(), new ByteArraySerializer()); this.partitions = this.producer.partitionsFor(this.topicName).stream() .map(partitionInfo -> new TopicPartition(partitionInfo.topic(), partitionInfo.partition())) .collect(Collectors.toList()); Collections.shuffle(this.partitions); } if (this.partitionsIterator == null || !this.partitionsIterator.hasNext()) { this.partitionsIterator = this.partitions.iterator(); } TopicPartition partition = this.partitionsIterator.next(); ProducerRecord<byte[], byte[]> record = new ProducerRecord<>( partition.topic(), partition.partition(), keys.next(), values.next()); producer.send(record).get(); } catch (Throwable e) { this.closeQuietly(); SustainedConnectionWorker.this.totalProducerConnections.decrementAndGet(); SustainedConnectionWorker.this.totalProducerFailedConnections.incrementAndGet(); SustainedConnectionWorker.log.error("Error while refreshing sustained KafkaProducer connection", e); } this.completeRefresh(); }
Source:
public boolean isClusterComplete() { return (m_clusterSettings.get().hostcount() == m_messenger.getLiveHostIds().size()); }

Target:
public boolean isClusterComplete() { return (getHostCount() == m_messenger.getLiveHostIds().size()); }
Source:
public void testSubmitUsersWithNoGuarantees() { INimbus iNimbus = new INimbusTest(); Map<String, SupervisorDetails> supMap = genSupervisors(4, 4, 100, 1000); Map<String, Map<String, Number>> resourceUserPool = userResourcePool( userRes("jerry", 200, 2000)); Config config = createClusterConfig(100, 500, 500, resourceUserPool); Topologies topologies = new Topologies( genTopology("topo-1", config, 1, 0, 1, 0, currentTime - 2, 10, "jerry"), genTopology("topo-2", config, 1, 0, 1, 0, currentTime - 2, 20, "jerry"), genTopology("topo-3", config, 1, 0, 1, 0, currentTime - 2, 20, "jerry"), genTopology("topo-4", config, 1, 0, 1, 0, currentTime - 2, 10, "bobby"), genTopology("topo-5", config, 1, 0, 1, 0, currentTime - 2, 20, "bobby")); Cluster cluster = new Cluster(iNimbus, new ResourceMetrics(new StormMetricsRegistry()), supMap, new HashMap<>(), topologies, config); ResourceAwareScheduler rs = new ResourceAwareScheduler(); rs.prepare(config); rs.schedule(topologies, cluster); scheduler = rs; assertTopologiesFullyScheduled(cluster, "topo-1", "topo-2", "topo-3", "topo-4"); assertTopologiesNotScheduled(cluster, "topo-5"); }

Target:
public void testSubmitUsersWithNoGuarantees() { INimbus iNimbus = new INimbusTest(); Map<String, SupervisorDetails> supMap = genSupervisors(4, 4, 100, 1000); Map<String, Map<String, Number>> resourceUserPool = userResourcePool( userRes("jerry", 200, 2000)); Config config = createClusterConfig(100, 500, 500, resourceUserPool); Topologies topologies = new Topologies( genTopology("topo-1", config, 1, 0, 1, 0, currentTime - 2, 10, "jerry"), genTopology("topo-2", config, 1, 0, 1, 0, currentTime - 2, 20, "jerry"), genTopology("topo-3", config, 1, 0, 1, 0, currentTime - 2, 20, "jerry"), genTopology("topo-4", config, 1, 0, 1, 0, currentTime - 2, 10, "bobby"), genTopology("topo-5", config, 1, 0, 1, 0, currentTime - 2, 20, "bobby")); Cluster cluster = new Cluster(iNimbus, new ResourceMetrics(new StormMetricsRegistry()), supMap, new HashMap<>(), topologies, config); scheduler = new ResourceAwareScheduler(); scheduler.prepare(config); scheduler.schedule(topologies, cluster); assertTopologiesFullyScheduled(cluster, "topo-1", "topo-2", "topo-3", "topo-4"); assertTopologiesNotScheduled(cluster, "topo-5"); }
Source:
public void testGetEntryFromTupleTooSmall() { YailList tuple = createTuple(1f); Entry expected = null; Entry result = model.getEntryFromTuple(tuple); assertEquals(expected, result); }

Target:
public void testGetEntryFromTupleTooSmall() { YailList tuple = createTuple(1f); Entry result = model.getEntryFromTuple(tuple); assertNull(result); }
Source:
public void testFullTextExtractionFilterValidMimeTypeForceExistingFile() throws Exception { String derivativePath = idToPath(fileID, HASHED_PATH_DEPTH, HASHED_PATH_SIZE); File existingFile = new File("target/" + derivativePath + "/" + fileID + ".txt"); FileUtils.writeStringToFile(existingFile, "extracted text", "utf-8"); getMockEndpoint("mock:direct:fulltext.extraction").expectedMessageCount(1); createContext(ENHANCEMENT_ROUTE); Map<String, Object> headers = createEvent(); headers.put("force", "true"); template.sendBodyAndHeaders("", headers); assertMockEndpointsSatisfied(); existingFile.delete(); }

Target:
public void testFullTextExtractionFilterValidMimeTypeForceExistingFile() throws Exception { String derivativePath = idToPath(fileID, HASHED_PATH_DEPTH, HASHED_PATH_SIZE); File existingFile = new File("target/" + derivativePath + "/" + fileID + ".txt"); FileUtils.writeStringToFile(existingFile, "extracted text", "utf-8"); getMockEndpoint("mock:direct:fulltext.extraction").expectedMessageCount(1); createContext(ENHANCEMENT_ROUTE); Map<String, Object> headers = createEvent(); headers.put("force", "true"); template.sendBodyAndHeaders("", headers); assertMockEndpointsSatisfied(); }
Source:
public Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) { ByteArrayInputStream bis = new ByteArrayInputStream((byte[]) (message.getPayload())); try { return new ObjectInputStream(bis).readObject(); } catch (Exception e) { this.logger.error(e.getMessage(), e); } return null; }

Target:
public Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) { if (!(message.getPayload() instanceof byte[])) { return null; } try { ByteArrayInputStream bis = new ByteArrayInputStream((byte[]) (message.getPayload())); return new ObjectInputStream(bis).readObject(); } catch (Exception e) { this.logger.error(e.getMessage(), e); } return null; }
Source:
public String getAlgorithm() { return "SK-ED25519"; }

Target:
public String getAlgorithm() { return ALGORITHM; }
Source:
public synchronized <T extends TopLevelItem> T copy(T src, String name) throws IOException { acl.checkPermission(Item.CREATE); src.checkPermission(Item.EXTENDED_READ); XmlFile srcConfigFile = Items.getConfigFile(src); if (!src.hasPermission(Item.CONFIGURE)) { Matcher matcher = AbstractItem.SECRET_PATTERN.matcher(srcConfigFile.asString()); while (matcher.find()) { if (Secret.decrypt(matcher.group(1)) != null) { throw new AccessDeniedException(Messages.ItemGroupMixIn_may_not_copy_as_it_contains_secrets_and_(src.getFullName(), Jenkins.getAuthentication().getName(), Item.PERMISSIONS.title, Item.EXTENDED_READ.name, Item.CONFIGURE.name)); } } } src.getDescriptor().checkApplicableIn(parent); acl.getACL().checkCreatePermission(parent, src.getDescriptor()); ItemListener.checkBeforeCopy(src, parent); T result = (T)createProject(src.getDescriptor(),name,false); Files.copy(srcConfigFile.getFile().toPath(), Items.getConfigFile(result).getFile().toPath(), StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); final File rootDir = result.getRootDir(); result = Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<T,IOException>() { @Override public T call() throws IOException { return (T) Items.load(parent, rootDir); } }); result.onCopiedFrom(src); add(result); ItemListener.fireOnCopied(src,result); Jenkins.getInstance().rebuildDependencyGraphAsync(); return result; }

Target:
public synchronized <T extends TopLevelItem> T copy(T src, String name) throws IOException { acl.checkPermission(Item.CREATE); src.checkPermission(Item.EXTENDED_READ); XmlFile srcConfigFile = Items.getConfigFile(src); if (!src.hasPermission(Item.CONFIGURE)) { Matcher matcher = AbstractItem.SECRET_PATTERN.matcher(srcConfigFile.asString()); while (matcher.find()) { if (Secret.decrypt(matcher.group(1)) != null) { throw new AccessDeniedException(Messages.ItemGroupMixIn_may_not_copy_as_it_contains_secrets_and_(src.getFullName(), Jenkins.getAuthentication().getName(), Item.PERMISSIONS.title, Item.EXTENDED_READ.name, Item.CONFIGURE.name)); } } } src.getDescriptor().checkApplicableIn(parent); acl.getACL().checkCreatePermission(parent, src.getDescriptor()); ItemListener.checkBeforeCopy(src, parent); T result = (T)createProject(src.getDescriptor(),name,false); Files.copy(Util.fileToPath(srcConfigFile.getFile()), Util.fileToPath(Items.getConfigFile(result).getFile()), StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); final File rootDir = result.getRootDir(); result = Items.whileUpdatingByXml(new NotReallyRoleSensitiveCallable<T,IOException>() { @Override public T call() throws IOException { return (T) Items.load(parent, rootDir); } }); result.onCopiedFrom(src); add(result); ItemListener.fireOnCopied(src,result); Jenkins.getInstance().rebuildDependencyGraphAsync(); return result; }
Source:
private HttpMessage makeHttpMessage() throws HttpMalformedHeaderException { HttpMessage httpMessage = new HttpMessage(); SiteNode siteNode = Mockito.mock(SiteNode.class); given(siteNode.getPastHistoryReference()).willReturn(new Vector<>()); HistoryReference ref = Mockito.mock(HistoryReference.class); given(ref.getSiteNode()).willReturn(siteNode); httpMessage.setHistoryRef(ref); httpMessage.setRequestHeader("GET <LINK_0> HTTP/1.1"); httpMessage.setResponseHeader("HTTP/1.1 200 OK"); httpMessage.getResponseHeader().addHeader(HttpResponseHeader.CONTENT_TYPE, "text/html"); return httpMessage; }

Target:
private HttpMessage makeHttpMessage() throws HttpMalformedHeaderException { HttpMessage httpMessage = new HttpMessage(); SiteNode siteNode = Mockito.mock(SiteNode.class); given(siteNode.getPastHistoryReference()).willReturn(new Vector<>()); HistoryReference ref = Mockito.mock(HistoryReference.class); given(ref.getSiteNode()).willReturn(siteNode); httpMessage.setHistoryRef(ref); httpMessage.setRequestHeader("GET <LINK_0> HTTP/1.1"); httpMessage.setResponseHeader("HTTP/1.1 200 OK"); httpMessage.getResponseHeader().setHeader(HttpResponseHeader.CONTENT_TYPE, "text/html"); return httpMessage; }
Source:
public void bufferInput(RowData input) throws Exception { BinaryRowData currentKey = groupKeyProjection.apply(input).copy(); currentKey.setRowKind(input.getRowKind()); if (lastGroupKey == null) { lastGroupKey = currentKey; lastGroupSet = groupSetProjection.apply(input).copy(); } else if (isNewKey(currentKey)) { invokeCurrentBatch(); lastGroupKey = currentKey; lastGroupSet = groupSetProjection.apply(input).copy(); } }

Target:
public void bufferInput(RowData input) throws Exception { BinaryRowData currentKey = groupKeyProjection.apply(input).copy(); if (isNewKey(currentKey)) { if (lastGroupKey != null) { invokeCurrentBatch(); } lastGroupKey = currentKey; lastGroupSet = groupSetProjection.apply(input).copy(); } }
Source:
public void testDataSourceNative() { System.loadLibrary("ctsmediav2codec_jni"); boolean isOk = true; if (!nativeTestDataSource(mInpPrefix + mInpMedia, mInpMediaUrl)) { isOk = false; } assertTrue(testName.getMethodName() + " failed ", isOk); }

Target:
public void testDataSourceNative() { System.loadLibrary("ctsmediav2codec_jni"); boolean isOk = nativeTestDataSource(mInpPrefix + mInpMedia, mInpMediaUrl); assertTrue(testName.getMethodName() + " failed ", isOk); }
Source:
@Provides @Singleton static TelephonyManager provideTelephonyManager(Context context) { return (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); }

Target:
@Provides @Singleton TelephonyManager provideTelephonyManager(Context context) { return (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); }
Source:
public MetadataDiff compareMetadata(DirCacheEntry entry) { if (entry.isAssumeValid()) return MetadataDiff.EQUAL; if (entry.isUpdateNeeded()) return MetadataDiff.DIFFER_BY_METADATA; if (isModeDifferent(entry.getRawMode())) return MetadataDiff.DIFFER_BY_METADATA; int type = mode & FileMode.TYPE_MASK; if (type == FileMode.TYPE_TREE || type == FileMode.TYPE_GITLINK) return MetadataDiff.EQUAL; if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength()) return MetadataDiff.DIFFER_BY_METADATA; Instant cacheLastModified = entry.getLastModifiedInstant(); Instant fileLastModified = getEntryLastModifiedInstant(); long cacheSeconds = cacheLastModified.getEpochSecond(); long fileSeconds = fileLastModified.getEpochSecond(); if (cacheSeconds != fileSeconds) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } int cacheSubSecond = cacheLastModified.getNano(); int fileSubSecond = fileLastModified.getNano(); if ((getOptions().getCheckStat() == CheckStat.MINIMAL) || (cacheSubSecond == 0) || (fileSubSecond == 0)) { } else if (cacheSubSecond != fileSubSecond) { if (cacheSubSecond % 1_000_000 == 0) { fileSubSecond -= (fileSubSecond % 1_000_000); if (cacheSubSecond != fileSubSecond) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } else { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } if (entry.isSmudged()) { return MetadataDiff.SMUDGED; } return MetadataDiff.EQUAL; }

Target:
public MetadataDiff compareMetadata(DirCacheEntry entry) { if (entry.isAssumeValid()) return MetadataDiff.EQUAL; if (entry.isUpdateNeeded()) return MetadataDiff.DIFFER_BY_METADATA; if (isModeDifferent(entry.getRawMode())) return MetadataDiff.DIFFER_BY_METADATA; int type = mode & FileMode.TYPE_MASK; if (type == FileMode.TYPE_TREE || type == FileMode.TYPE_GITLINK) return MetadataDiff.EQUAL; if (!entry.isSmudged() && entry.getLength() != (int) getEntryLength()) return MetadataDiff.DIFFER_BY_METADATA; Instant cacheLastModified = entry.getLastModifiedInstant(); Instant fileLastModified = getEntryLastModifiedInstant(); long cacheSeconds = cacheLastModified.getEpochSecond(); long fileSeconds = fileLastModified.getEpochSecond(); if (cacheSeconds != fileSeconds) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } int cacheSubSecond = cacheLastModified.getNano(); int fileSubSecond = fileLastModified.getNano(); if ((getOptions().getCheckStat() == CheckStat.MINIMAL) || (cacheSubSecond == 0) || (fileSubSecond == 0)) { } else if (cacheSubSecond != fileSubSecond) { int cacheSubMillis = cacheSubSecond % 1_000_000; int fileSubMillis = fileSubSecond % 1_000_000; if (cacheSubMillis == 0) { fileSubSecond -= fileSubMillis; if (cacheSubSecond != fileSubSecond) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } else if (fileSubMillis == 0) { cacheSubSecond -= cacheSubMillis; if (cacheSubSecond != fileSubSecond) { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } else { return MetadataDiff.DIFFER_BY_TIMESTAMP; } } if (entry.isSmudged()) { return MetadataDiff.SMUDGED; } return MetadataDiff.EQUAL; }
Source:
private void maybeAddPlaceholderBoltAggStats(TopologyPageInfo topoPageInfo, StormTopology topology, boolean includeSys) { if (topoPageInfo.get_id_to_bolt_agg_stats().isEmpty()) { Map<String, Bolt> bolts = topology.get_bolts(); for (String boltName : bolts.keySet()) { if (!includeSys && Utils.isSystemId(boltName) || boltName.equals("__system")) { continue; } ComponentAggregateStats placeholderComponentStats = new ComponentAggregateStats(); placeholderComponentStats.set_type(ComponentType.BOLT); CommonAggregateStats commonStats = new CommonAggregateStats(); commonStats.set_num_executors(0); commonStats.set_num_tasks(0); commonStats.set_emitted(0); commonStats.set_transferred(0); commonStats.set_acked(0); placeholderComponentStats.set_common_stats(commonStats); BoltAggregateStats boltAggStats = new BoltAggregateStats(); boltAggStats.set_execute_latency_ms(0); boltAggStats.set_process_latency_ms(0); boltAggStats.set_executed(0); boltAggStats.set_capacity(0); SpecificAggregateStats specificStats = new SpecificAggregateStats(); specificStats.set_bolt(boltAggStats); placeholderComponentStats.set_specific_stats(specificStats); topoPageInfo.get_id_to_bolt_agg_stats().put(boltName, placeholderComponentStats); } } }

Target:
private void maybeAddPlaceholderBoltAggStats(TopologyPageInfo topoPageInfo, StormTopology topology, boolean includeSys) { if (topoPageInfo.get_id_to_bolt_agg_stats().isEmpty()) { Map<String, Bolt> bolts = topology.get_bolts(); for (String boltName : bolts.keySet()) { if ((!includeSys && Utils.isSystemId(boltName)) || boltName.equals(Constants.SYSTEM_COMPONENT_ID)) { continue; } ComponentAggregateStats placeholderComponentStats = new ComponentAggregateStats(); placeholderComponentStats.set_type(ComponentType.BOLT); CommonAggregateStats commonStats = new CommonAggregateStats(); commonStats.set_num_executors(0); commonStats.set_num_tasks(0); commonStats.set_emitted(0); commonStats.set_transferred(0); commonStats.set_acked(0); placeholderComponentStats.set_common_stats(commonStats); BoltAggregateStats boltAggStats = new BoltAggregateStats(); boltAggStats.set_execute_latency_ms(0); boltAggStats.set_process_latency_ms(0); boltAggStats.set_executed(0); boltAggStats.set_capacity(0); SpecificAggregateStats specificStats = new SpecificAggregateStats(); specificStats.set_bolt(boltAggStats); placeholderComponentStats.set_specific_stats(specificStats); topoPageInfo.get_id_to_bolt_agg_stats().put(boltName, placeholderComponentStats); } } }
Source:
public void schedule(Job job, Calendar eventAt) { monitor.lock(); try { long sleepTime = eventAt.getTimeInMillis() - new Date().getTime(); ScheduledFuture<?> future = scheduler.schedule(job, sleepTime, TimeUnit.MILLISECONDS); scheduledFutures.add(future); if (logger.isDebugEnabled()) { String formattedDate = DateFormatUtils.ISO_DATETIME_FORMAT.format(eventAt); logger.debug("Scheduled in {}ms (at {})", job, sleepTime, formattedDate); } } finally { monitor.unlock(); } }

Target:
public void schedule(Job job, Calendar eventAt) { long sleepTime; monitor.lock(); try { sleepTime = eventAt.getTimeInMillis() - new Date().getTime(); ScheduledFuture<?> future = scheduler.schedule(job, sleepTime, TimeUnit.MILLISECONDS); scheduledFutures.add(future); } finally { monitor.unlock(); } if (logger.isDebugEnabled()) { String formattedDate = DateFormatUtils.ISO_DATETIME_FORMAT.format(eventAt); logger.debug("Scheduled in {}ms (at {})", job, sleepTime, formattedDate); } }
Source:
public ConsistentHash getReadConsistentHash() { switch (phase) { case STABLE: assert pendingCH == null; assert unionCH == null; return currentCH; case READ_OLD_WRITE_ALL: assert pendingCH != null; assert unionCH != null; return currentCH; case READ_ALL_WRITE_ALL: assert pendingCH != null; return unionCH; case READ_NEW_WRITE_ALL: assert unionCH != null; return pendingCH; } return currentCH; }

Target:
public ConsistentHash getReadConsistentHash() { switch (phase) { case NO_REBALANCE: assert pendingCH == null; assert unionCH == null; return currentCH; case READ_OLD_WRITE_ALL: assert pendingCH != null; assert unionCH != null; return currentCH; case READ_ALL_WRITE_ALL: assert pendingCH != null; return unionCH; case READ_NEW_WRITE_ALL: assert unionCH != null; return pendingCH; } return currentCH; }
Source:
public com.google.common.base.Optional<InterpreterSetting> getDefaultInterpreterSetting(String noteId) { return getDefaultInterpreterSetting(getInterpreterSettings(noteId)); }

Target:
public InterpreterSetting getDefaultInterpreterSetting(String noteId) { return getDefaultInterpreterSetting(getInterpreterSettings(noteId)); }
Source:
public void checkoutToRemoteBranch() throws Exception { String pathJavaFile = "src/main/java/che/eclipse/sample/Aclass.java"; String pathJspFile = "src/main/webapp/index.jsp"; String changeContent = String.format(" projectExplorer.waitProjectExplorer(); git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME, MAVEN); projectExplorer.waitAndSelectItem(PROJECT_NAME); checkoutToSecondRemoteBranch(); menu.runCommand(GIT, STATUS); git.waitGitStatusBarWithMess(GIT_STATUS_MESS); performGitPull(); changeContentOnGithubSide(pathJavaFile, changeContent, SECOND_BRANCH); changeContentOnGithubSide(pathJspFile, changeContent, SECOND_BRANCH); git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME2, MAVEN); projectExplorer.waitAndSelectItem(PROJECT_NAME2); checkoutToSecondRemoteBranch(); projectExplorer.quickExpandWithJavaScript(); projectExplorer.openItemByPath(PROJECT_NAME2 + "/src/main/java/che/eclipse/sample/Aclass.java"); editor.waitTextIntoEditor(changeContent); projectExplorer.openItemByPath(PROJECT_NAME2 + "/src/main/webapp/index.jsp"); editor.waitTextIntoEditor(changeContent); }

Target:
public void checkoutToRemoteBranch() throws Exception { String pathJavaFile = "/src/main/java/che/eclipse/sample/Aclass.java"; String pathJspFile = "/src/main/webapp/index.jsp"; String changeContent = String.format(" projectExplorer.waitProjectExplorer(); git.importJavaApp(testRepo.getSshUrl(), PROJECT_NAME, MAVEN); projectExplorer.waitAndSelectItem(PROJECT_NAME); checkoutToSecondRemoteBranch(); menu.runCommand(GIT, STATUS); git.waitGitStatusBarWithMess(GIT_STATUS_MESS); performGitPull(); testProjectServiceClient.updateFile(ws.getId(), PROJECT_NAME + pathJavaFile, changeContent); testProjectServiceClient.updateFile(ws.getId(), PROJECT_NAME + pathJspFile, changeContent); commitFiles(); performGitPush(); git.importJavaApp(testRepo.getHtmlUrl(), PROJECT_NAME2, MAVEN); projectExplorer.waitAndSelectItem(PROJECT_NAME2); checkoutToSecondRemoteBranch(); projectExplorer.quickExpandWithJavaScript(); projectExplorer.openItemByPath(PROJECT_NAME2 + "/src/main/java/che/eclipse/sample/Aclass.java"); editor.waitTextIntoEditor(changeContent); projectExplorer.openItemByPath(PROJECT_NAME2 + "/src/main/webapp/index.jsp"); editor.waitTextIntoEditor(changeContent); projectExplorer.waitAndSelectItem(PROJECT_NAME2 + "/src"); menu.runCommand(GIT, SHOW_HISTORY); git.waitHistoryFormToOpen(); git.waitCommitInHistoryForm(COMMIT_MESS); }
Source:
public void whenPOSTValidEventTypeThenOk() { Map body = buildEventTypeBody("event-name"); final Response response = given().body(body).post("http://localhost:8080/event_types"); response.then().body(equalTo("")); response.then().statusCode(HttpStatus.SC_CREATED); }

Target:
public void whenPOSTValidEventTypeThenOk() throws JsonProcessingException { EventType eventType = buildEventTypeBody(); String body = mapper.writer().writeValueAsString(eventType); given(). body(body). header("accept", "application/json"). contentType(JSON). when(). post(ENDPOINT). then(). body(equalTo("")). statusCode(HttpStatus.SC_CREATED); }
Source:
public DomainTranslator.ColumnExtractor<Subfield> toColumnExtractor() { return (expression, domain) -> { Type type = expression.getType(); if (isComplexType(type) && !(domain.isOnlyNull() || (domain.getValues().isAll() && !domain.isNullAllowed()))) { return Optional.empty(); } Optional<Subfield> subfield = extract(expression); if (hasSubscripts(subfield)) { if (HiveSessionProperties.isNestedColumnsFilterEnabled(connectorSession)) { return subfield; } return Optional.empty(); } return subfield; }; }

Target:
public DomainTranslator.ColumnExtractor<Subfield> toColumnExtractor() { return (expression, domain) -> { Type type = expression.getType(); if (isComplexType(type) && !(domain.isOnlyNull() || (domain.getValues().isAll() && !domain.isNullAllowed()))) { return Optional.empty(); } Optional<Subfield> subfield = extract(expression); if (hasSubscripts(subfield)) { if (isNestedColumnsFilterEnabled(connectorSession)) { return subfield; } return Optional.empty(); } return subfield; }; }
Source:
public void close() { log.debug("Closing record collector"); if (eosEnabled) { streamsProducer.abortTransaction(); } streamsProducer.flush(); checkForException(); }

Target:
public void close() { log.debug("Closing record collector"); if (eosEnabled) { streamsProducer.abortTransaction(); } checkForException(); }