auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { ManualCondition manualCondition=(ManualCondition) getProcess().getPromotionCondition(ManualCondition.class.getName()); if(!getTarget().hasPermission(Promotion.PROMOTE)) { if (!manualCondition.getUsersAsSet().isEmpty() && !manualCondition.isInUsersList() && !manualCondition.isInGroupList()) return; } JSONObject formData = req.getSubmittedForm(); List<ParameterValue> paramValues=null; if (formData!=null){ paramValues = new ArrayList<ParameterValue>(); if (manualCondition!=null){ List<ParameterDefinition> parameterDefinitions=manualCondition.getParameterDefinitions(); if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) { JSONArray a = JSONArray.fromObject(formData.get("parameter")); for (Object o : a) { JSONObject jo = (JSONObject) o; String name = jo.getString("name"); ParameterDefinition d = manualCondition.getParameterDefinition(name); if (d==null) throw new IllegalArgumentException("No such parameter definition: " + name); paramValues.add(d.createValue(req, jo)); } } } } if (paramValues==null){ paramValues = new ArrayList<ParameterValue>(); } Future<Promotion> f = getProcess().scheduleBuild2(getTarget(), new UserCause(), paramValues); if (f==null) LOGGER.warning("Failing to schedule the promotion of "+getTarget()); rsp.forwardToPreviousPage(req); }

Target:
public void doBuild(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { ManualCondition manualCondition = (ManualCondition) getProcess().getPromotionCondition(ManualCondition.class.getName()); if(!getTarget().hasPermission(Promotion.PROMOTE)) { if (manualCondition == null || (!manualCondition.getUsersAsSet().isEmpty() && !manualCondition.isInUsersList() && !manualCondition.isInGroupList())) return; } JSONObject formData = req.getSubmittedForm(); List<ParameterValue> paramValues=null; if (formData!=null){ paramValues = new ArrayList<ParameterValue>(); if (manualCondition!=null){ List<ParameterDefinition> parameterDefinitions=manualCondition.getParameterDefinitions(); if (parameterDefinitions != null && !parameterDefinitions.isEmpty()) { JSONArray a = JSONArray.fromObject(formData.get("parameter")); for (Object o : a) { JSONObject jo = (JSONObject) o; String name = jo.getString("name"); ParameterDefinition d = manualCondition.getParameterDefinition(name); if (d==null) throw new IllegalArgumentException("No such parameter definition: " + name); paramValues.add(d.createValue(req, jo)); } } } } if (paramValues==null){ paramValues = new ArrayList<ParameterValue>(); } Future<Promotion> f = getProcess().scheduleBuild2(getTarget(), new UserCause(), paramValues); if (f==null) LOGGER.warning("Failing to schedule the promotion of "+getTarget()); rsp.forwardToPreviousPage(req); }
Source:
public int available() throws IOException { final FSDataInputStream inLocal = in; synchronized (inLocal) { int avail = in.available(); if (pos + avail > end) { avail = (int) (end - pos); } return avail; } }

Target:
public int available() throws IOException { return (int) (end - pos); }
Source:
public DynamoDBLeaseCoordinator initialLeaseTableReadCapacity(long readCapacity) { throw new UnsupportedOperationException("Please set read capacity using the constructor"); }

Target:
public DynamoDBLeaseCoordinator initialLeaseTableReadCapacity(long readCapacity) { if (readCapacity <= 0) { throw new IllegalArgumentException("readCapacity should be >= 1"); } initialLeaseTableReadCapacity = readCapacity; return this; }
Source:
public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final Map<String, String> customValues) { AuditLogableBase logable = new AuditLogableBase(); logable.setAuditLogType(logType); logable.setVds(server); logable.setGlusterVolume(volume); logable.setVdsGroupId(clusterId == null ? Guid.Empty : clusterId); if (customValues != null) { for (String key : customValues.keySet()) { logable.addCustomValue(key, customValues.get(key)); } } AuditLogDirector.log(logable); }

Target:
public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final Map<String, String> customValues) { AuditLogableBase logable = new AuditLogableBase(); logable.setVds(server); logable.setGlusterVolume(volume); logable.setVdsGroupId(clusterId == null ? Guid.Empty : clusterId); if (customValues != null) { for (String key : customValues.keySet()) { logable.addCustomValue(key, customValues.get(key)); } } AuditLogDirector.log(logable, logType); }
Source:
protected boolean canDoAction() { boolean canDo = true; if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { canDo = failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return canDo; }

Target:
protected boolean canDoAction() { boolean canDo = true; if (!FeatureSupported.vmSlaPolicy(getVdsGroup().getcompatibility_version())) { addCanDoActionMessage(VdcBllMessages.VM_SLA_POLICY_NOT_SUPPORTED); return false; } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); } if (getVm().getStatus() != VMStatus.Up) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_STATUS_ILLEGAL, LocalizedVmStatus.from(getVm().getStatus())); } return canDo; }
Source:
public void testKDCLocator() { KDCLocator locator = new KDCLocator(); String[] recordsList = { "0 100 88 example.com.", "0 100 88 comp1.example.com", "1 100 88 comp1.example.com." }; DnsSRVResult result = locator.getKdc(recordsList, "example.com"); int numOfEntries = result.getNumOfValidAddresses(); Assert.assertEquals(3, numOfEntries); }

Target:
public void testKDCLocator() { KDCLocator locator = new KDCLocator(); String[] recordsList = { "0 100 88 example.com.", "0 100 88 comp1.example.com", "1 100 88 comp1.example.com." }; DnsSRVResult result = locator.getKdc(recordsList, "example.com"); int numOfEntries = result.getNumOfValidAddresses(); assertEquals(3, numOfEntries); }
Source:
public void test() { final Resource resource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(DRL)); resource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); final KieBase kbase = KieBaseUtil.getDefaultKieBaseFromKieBuilder(kbuilder); KieSession ksession = kbase.newKieSession(); ksession.insert(new Person()); ksession.insert(new Cheese("eidam")); ((DefaultAgenda) ksession.getAgenda()).activateRuleFlowGroup("group1"); Assertions.assertThat(1).isEqualTo(ksession.fireAllRules()); ksession.dispose(); }

Target:
public void test() { final Resource resource = KieServices.Factory.get().getResources().newReaderResource(new StringReader(DRL)); resource.setTargetPath(TestConstants.DRL_TEST_TARGET_PATH); final KieBuilder kbuilder = KieBaseUtil.getKieBuilderFromResources(true, resource); final KieBase kbase = KieBaseUtil.getDefaultKieBaseFromKieBuilder(kbuilder); final KieSession ksession = kbase.newKieSession(); ksession.insert(new Person()); ksession.insert(new Cheese("eidam")); ((DefaultAgenda) ksession.getAgenda()).activateRuleFlowGroup("group1"); Assertions.assertThat(ksession.fireAllRules()).isEqualTo(1); ksession.dispose(); }
Source:
private void registerSitesPerHostToZK(int sitesperhost) { try { ZKUtil.addIfMissing(m_messenger.getZK(), VoltZK.sitesPerHost, CreateMode.PERSISTENT, new byte[0]); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to create " + VoltZK.sitesPerHost + " node to Zookeeper, dying", false, e); } String path = ZKUtil.joinZKPath(VoltZK.sitesPerHost, "host_" + m_messenger.getHostId()); try { ByteBuffer b = ByteBuffer.allocate(4); b.putInt(sitesperhost); m_messenger.getZK().create(path, b.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) { hostLog.info("Zookeeper node " + path + "already exists"); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to write sitePerHost to ZK, dying", false, e); } }

Target:
private void registerSitesPerHostToZK(int sitesperhost) { try { ZKUtil.addIfMissing(m_messenger.getZK(), VoltZK.sitesPerHost, CreateMode.PERSISTENT, new byte[0]); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to create " + VoltZK.sitesPerHost + " node to Zookeeper, dying", false, e); } String path = ZKUtil.joinZKPath(VoltZK.sitesPerHost, String.valueOf(m_messenger.getHostId())); try { ByteBuffer b = ByteBuffer.allocate(4); b.putInt(sitesperhost); m_messenger.getZK().create(path, b.array(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } catch (KeeperException.NodeExistsException e) { hostLog.info("Zookeeper node " + path + "already exists"); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to write sitePerHost to ZK, dying", false, e); } }
Source:
protected void executeCommand() { if (getVmTemplate() != null) { UpdateVmTemplate(); if (getVmTemplate().getstorage_pool_id() != null && !VmTemplateHandler.BlankVmTemplateId.equals(getVmTemplate().getId())) { UpdateTemplateInSpm( getVmTemplate().getstorage_pool_id().getValue(), new java.util.ArrayList<VmTemplate>(java.util.Arrays .asList(new VmTemplate[] { getVmTemplate() }))); } setSucceeded(true); } }

Target:
protected void executeCommand() { if (getVmTemplate() != null) { getVmStaticDAO().incrementDbGeneration(getVmTemplate().getId()); VmHandler.LockVm(getVm().getDynamicData(), getCompensationContext()); freeLock(); UpdateVmTemplate(); setSucceeded(true); } }
Source:
protected void shutdown() { if (requestResponseHandlers.size() > 0) { logger.info("Shutting down RequestResponseHandlerController"); Iterator<AsyncRequestResponseHandler> asyncRequestHandlerIterator = requestResponseHandlers.iterator(); while (asyncRequestHandlerIterator.hasNext()) { AsyncRequestResponseHandler requestHandler = asyncRequestHandlerIterator.next(); requestHandler.shutdown(); asyncRequestHandlerIterator.remove(); } logger.info("RequestResponseHandlerController shutdown complete"); } }

Target:
protected void shutdown() { if (asyncRequestResponseHandlers.size() > 0) { logger.info("Shutting down RequestResponseHandlerController"); Iterator<AsyncRequestResponseHandler> asyncRequestHandlerIterator = asyncRequestResponseHandlers.iterator(); while (asyncRequestHandlerIterator.hasNext()) { AsyncRequestResponseHandler requestHandler = asyncRequestHandlerIterator.next(); requestHandler.shutdown(); asyncRequestHandlerIterator.remove(); } logger.info("RequestResponseHandlerController shutdown complete"); } }
Source:
private long beginFateOperation() throws ThriftSecurityException, TException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnectionWithRetry(context, 0); return client.beginFateOperation(Tracer.traceInfo(), context.rpcCreds()); } catch (TTransportException tte) { log.debug("Failed to call beginFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } catch (ThriftNotActiveServiceException e) { log.debug("Contacted a Master which is no longer active, retrying"); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } finally { MasterClient.close(client); } } }

Target:
private long beginFateOperation() throws ThriftSecurityException, TException { while (true) { MasterClientService.Iface client = null; try { client = MasterClient.getConnection(context, true); if (client == null) throw new TTransportException("Could not get connection"); return client.beginFateOperation(Tracer.traceInfo(), context.rpcCreds()); } catch (TTransportException tte) { log.debug("Failed to call beginFateOperation(), retrying ... ", tte); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } catch (ThriftNotActiveServiceException e) { log.debug("Contacted a Master which is no longer active, retrying"); sleepUninterruptibly(100, TimeUnit.MILLISECONDS); } finally { MasterClient.close(client); } } }
Source:
private String getMethodCallback(JMethod method) { if (isVoidMethod(method)) { return "org.fusesource.restygwt.client.MethodCallback<java.lang.Void> callback"; } else if (method.getReturnType().isPrimitive() != null) { JPrimitiveType primitiveType = method.getReturnType().isPrimitive(); return "org.fusesource.restygwt.client.MethodCallback<" + primitiveType.getQualifiedBoxedSourceName() + "> callback"; } return "org.fusesource.restygwt.client.MethodCallback<" + method.getReturnType().getParameterizedQualifiedSourceName() + "> callback"; }

Target:
private String getMethodCallback(JMethod method) { if (method.getReturnType().isPrimitive() != null) { JPrimitiveType primitiveType = method.getReturnType().isPrimitive(); return "org.fusesource.restygwt.client.MethodCallback<" + primitiveType.getQualifiedBoxedSourceName() + "> callback"; } return "org.fusesource.restygwt.client.MethodCallback<" + method.getReturnType().getParameterizedQualifiedSourceName() + "> callback"; }
Source:
PagedFlux<BlobItem> listBlobsFlatWithOptionalTimeout(ListBlobsOptions options, String continuationToken, Duration timeout) { Function<String, Mono<PagedResponse<BlobItem>>> func = marker -> listBlobsFlatSegment(marker, options, timeout) .map(response -> { List<BlobItem> value = response.getValue().getSegment() == null ? new ArrayList<>(0) : response.getValue().getSegment().getBlobItems().stream() .map(BlobItem::new) .collect(Collectors.toList()); return new PagedResponseBase<>( response.getRequest(), response.getStatusCode(), response.getHeaders(), value, response.getValue().getNextMarker(), response.getDeserializedHeaders()); }); return new PagedFlux<>(() -> func.apply(continuationToken), func); }

Target:
PagedFlux<BlobItem> listBlobsFlatWithOptionalTimeout(ListBlobsOptions options, String continuationToken, Duration timeout) { Function<String, Mono<PagedResponse<BlobItem>>> func = marker -> listBlobsFlatSegment(marker, options, timeout) .map(response -> { List<BlobItem> value = response.getValue().getSegment() == null ? Collections.emptyList() : response.getValue().getSegment().getBlobItems().stream() .map(BlobItem::new) .collect(Collectors.toList()); return new PagedResponseBase<>( response.getRequest(), response.getStatusCode(), response.getHeaders(), value, response.getValue().getNextMarker(), response.getDeserializedHeaders()); }); return new PagedFlux<>(() -> func.apply(continuationToken), func); }
Source:
public void doesNotLogIfLoggingNotAllowedEvenIfOperationsAreSlow() { makeOperationsTakeSpecifiedDuration(LONG_DURATION); profilingTimelockService.getFreshTimestamp(); verify(delegate).getFreshTimestamp(); verifyLoggerNeverInvoked(); }

Target:
public void doesNotLogIfLoggingNotAllowedEvenIfOperationsAreSlow() { accumulateLogsWithCall(LONG_DURATION, profilingTimelockService::getFreshTimestamp); verify(delegate).getFreshTimestamp(); verifyLoggerNeverInvoked(); }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.homeAsUp: return true; case R.id.menu_page_other_languages: startLangLinksActivity(); return true; case R.id.menu_page_share: sharePageLink(); return true; case R.id.menu_page_add_to_list: addToReadingList(AddToReadingListDialog.InvokeSource.PAGE_OVERFLOW_MENU); return true; case R.id.menu_page_remove_from_list: ReadingList.DAO.anyListContainsTitleAsync(ReadingListDaoProxy.key(getTitle()), new CallbackTask.DefaultCallback<ReadingListPage>() { @Override public void success(@Nullable ReadingListPage page) { new RemoveFromReadingListsDialog(page).deleteOrShowDialog(getContext(), new RemoveFromReadingListsDialog.Callback() { @Override public void onDeleted(@NonNull ReadingListPage page) { if (callback() != null) { callback().onPageRemoveFromReadingLists(getTitle()); } } }); } }); return true; case R.id.menu_page_find_in_page: showFindInPage(); return true; case R.id.menu_page_content_issues: showContentIssues(); return true; case R.id.menu_page_similar_titles: showSimilarTitles(); return true; case R.id.menu_page_font_and_theme: showThemeChooser(); return true; case R.id.menu_page_show_tabs: tabsProvider.enterTabMode(false); return true; case R.id.menu_page_search: if (callback() != null) { callback().onPageSearchRequested(); } return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.homeAsUp: return true; case R.id.menu_page_other_languages: startLangLinksActivity(); return true; case R.id.menu_page_share: sharePageLink(); return true; case R.id.menu_page_add_to_list: addToReadingList(AddToReadingListDialog.InvokeSource.PAGE_OVERFLOW_MENU); return true; case R.id.menu_page_remove_from_list: new RemoveFromReadingListsDialog(model.getReadingListPage()).deleteOrShowDialog(getContext(), new RemoveFromReadingListsDialog.Callback() { @Override public void onDeleted(@NonNull ReadingListPage page) { if (callback() != null) { callback().onPageRemoveFromReadingLists(getTitle()); } } }); return true; case R.id.menu_page_find_in_page: showFindInPage(); return true; case R.id.menu_page_content_issues: showContentIssues(); return true; case R.id.menu_page_similar_titles: showSimilarTitles(); return true; case R.id.menu_page_font_and_theme: showThemeChooser(); return true; case R.id.menu_page_show_tabs: tabsProvider.enterTabMode(false); return true; case R.id.menu_page_search: if (callback() != null) { callback().onPageSearchRequested(); } return true; default: return super.onOptionsItemSelected(item); } }
Source:
protected byte[] getOutput(FilePath workspace) throws IOException, InterruptedException { try (InputStream is = getOutputFile(workspace).read()) { return IOUtils.toByteArray(is); } }

Target:
protected byte[] getOutput(FilePath workspace) throws IOException, InterruptedException { return getOutputFile(workspace).act(new MasterToSlaveFileCallable<byte[]>() { @Override public byte[] invoke(File f, VirtualChannel channel) throws IOException, InterruptedException { byte[] buf = FileUtils.readFileToByteArray(f); ByteBuffer transcoded = maybeTranscode(buf, charset); if (transcoded == null) { return buf; } else { byte[] buf2 = new byte[transcoded.remaining()]; transcoded.get(buf2); return buf2; } } }); }
Source:
public void testCreateCxfRsClientFactoryBeanProgrammatically() { CxfRsEndpoint endpoint = resolveMandatoryEndpoint("cxfrs://bean://" + BEAN_SERVICE_ENDPOINT_NAME, CxfRsEndpoint.class); SpringJAXRSClientFactoryBean cfb = (SpringJAXRSClientFactoryBean)endpoint.createJAXRSClientFactoryBean(); assertEquals("Got the wrong address", BEAN_SERVICE_ADDRESS, cfb.getAddress()); assertNotNull("Service class must not be null", cfb.getServiceClass()); assertEquals("Got the wrong ServiceClass", CustomerService.class, cfb.getServiceClass()); assertEquals("Got the wrong username", BEAN_SERVICE_USERNAME, cfb.getUsername()); assertEquals("Got the wrong password", BEAN_SERVICE_PASSWORD, cfb.getPassword()); }

Target:
public void testCreateCxfRsClientFactoryBeanProgrammatically() { CxfRsEndpoint endpoint = resolveMandatoryEndpoint("cxfrs://bean://" + BEAN_SERVICE_ENDPOINT_NAME, CxfRsEndpoint.class); SpringJAXRSClientFactoryBean cfb = (SpringJAXRSClientFactoryBean)endpoint.createJAXRSClientFactoryBean(); assertNotSame("Got the same object but must be different", super.applicationContext.getBean(BEAN_SERVICE_ENDPOINT_NAME), cfb); assertEquals("Got the wrong address", BEAN_SERVICE_ADDRESS, cfb.getAddress()); assertNotNull("Service class must not be null", cfb.getServiceClass()); assertEquals("Got the wrong ServiceClass", CustomerService.class, cfb.getServiceClass()); assertEquals("Got the wrong username", BEAN_SERVICE_USERNAME, cfb.getUsername()); assertEquals("Got the wrong password", BEAN_SERVICE_PASSWORD, cfb.getPassword()); }
Source:
static BiPredicate<Index, ClusterState> getSkipShrinkStepPredicate(int targetNumberOfShards) { return (index, clusterState) -> { IndexMetadata indexMetadata = clusterState.getMetadata().index(index); boolean skipShrink = indexMetadata.getNumberOfShards() == targetNumberOfShards; if (skipShrink == false) { IndexAbstraction indexAbstraction = clusterState.metadata().getIndicesLookup().get(index.getName()); assert indexAbstraction != null : "invalid cluster metadata. index [" + index.getName() + "] was not found"; if (indexAbstraction.getParentDataStream() != null) { IndexAbstraction.DataStream dataStream = indexAbstraction.getParentDataStream(); assert dataStream.getWriteIndex() != null : dataStream.getName() + " has no write index"; if (dataStream.getWriteIndex().getIndex().getName().equals(index.getName())) { String policyName = indexMetadata.getSettings().get(LifecycleSettings.LIFECYCLE_NAME); String errorMessage = String.format(Locale.ROOT, "index [%s] is the write index for data stream [%s]. stopping execution of lifecycle [%s] as a data stream's " + "write index cannot be shrunk. manually rolling over the index will resume the execution of the policy " + "as the index will not be the data stream's write index anymore", index.getName(), dataStream.getName(), policyName); logger.debug(errorMessage); throw new IllegalStateException(errorMessage); } } } return skipShrink; }; }

Target:
static BiPredicate<Index, ClusterState> getSkipShrinkStepPredicate(int targetNumberOfShards) { return (index, clusterState) -> { IndexMetadata indexMetadata = clusterState.getMetadata().index(index); if (indexMetadata == null) { logger.debug("[{}] lifecycle action for index executed but index no longer exists", NAME, index.getName()); return true; } if (indexMetadata.getNumberOfShards() == targetNumberOfShards) { logger.debug("skipping lifecycle action for index because the index already has the target number of shards", NAME, index.getName()); return true; } IndexAbstraction indexAbstraction = clusterState.metadata().getIndicesLookup().get(index.getName()); assert indexAbstraction != null : "invalid cluster metadata. index [" + index.getName() + "] was not found"; if (indexAbstraction.getParentDataStream() != null) { IndexAbstraction.DataStream dataStream = indexAbstraction.getParentDataStream(); assert dataStream.getWriteIndex() != null : dataStream.getName() + " has no write index"; if (dataStream.getWriteIndex().getIndex().getName().equals(index.getName())) { String policyName = indexMetadata.getSettings().get(LifecycleSettings.LIFECYCLE_NAME); String errorMessage = String.format(Locale.ROOT, "index [%s] is the write index for data stream [%s]. stopping execution of lifecycle [%s] as a data stream's " + "write index cannot be shrunk. manually rolling over the index will resume the execution of the policy " + "as the index will not be the data stream's write index anymore", index.getName(), dataStream.getName(), policyName); logger.debug(errorMessage); throw new IllegalStateException(errorMessage); } } return false; }; }
Source:
public void testServiceScripts() throws Exception { String[] b = new String[] { "Agent", "LeapMotion", "OpenNi", "Runtime", "SlamBad", "_TemplateService", "Cli", "WebGui", "JMonkeyEngine", "ImageDisplay", "GoogleAssistant", "PickToLight", "PythonProxy", "Sprinkler", "_TemplateProxy", "SwingGui" }; Set<String> blacklist = new HashSet<String>(Arrays.asList(b)); pythonScripts = getPyRobotLabServiceScripts(); log.info("testing scripts", pythonScripts.size()); for (String name : pythonScripts.keySet()) { name = "AudioFile"; log.info("testing script {}", name); releaseServices(); Python python = (Python) Runtime.start("python", "Python"); try { log.error("testing ######## ########", name); python.execAndWait(pythonScripts.get(name)); } catch (Exception e) { log.error("testing threw", name, e); } } }

Target:
public void testServiceScripts() throws Exception { String[] b = new String[] { "Agent", "LeapMotion", "OpenNi", "Runtime", "SlamBad", "_TemplateService", "Cli", "WebGui", "JMonkeyEngine", "ImageDisplay", "GoogleAssistant", "PickToLight", "PythonProxy", "Sprinkler", "_TemplateProxy", "SwingGui" }; Set<String> blacklist = new HashSet<String>(Arrays.asList(b)); pythonScripts = getPyRobotLabServiceScripts(); log.info("testing scripts", pythonScripts.size()); for (String name : pythonScripts.keySet()) { log.info("testing script {}", name); releaseServices(); Python python = (Python) Runtime.start("python", "Python"); try { log.error("testing ######## ########", name); python.execAndWait(pythonScripts.get(name)); } catch (Exception e) { log.error("testing threw", name, e); } } }
Source:
private long skipVarintsInBuffer(long items) throws IOException { if (items == 0) { return 0; } if (available() == 0) { advance(); if (available() == 0) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected end of stream"); } } long skipped = 0; while (items - skipped > SIZE_OF_LONG && available() > MAX_VARINT_LENGTH) { long value = ByteArrays.getLong(buffer, position); position += SIZE_OF_LONG; long mask = (value & VARINT_MASK) ^ VARINT_MASK; skipped += Long.bitCount(mask); } while (skipped < items && available() > 0) { if ((buffer[position++] & 0x80) == 0) { skipped++; } } return skipped; }

Target:
private long skipVarintsInBuffer(long items) throws IOException { if (available() == 0) { advance(); if (available() == 0) { throw new OrcCorruptionException(orcDataSourceId, "Unexpected end of stream"); } } long skipped = 0; while (items - skipped > SIZE_OF_LONG && available() > MAX_VARINT_LENGTH) { long value = ByteArrays.getLong(buffer, position); position += SIZE_OF_LONG; long mask = (value & VARINT_MASK) ^ VARINT_MASK; skipped += Long.bitCount(mask); } while (skipped < items && available() > 0) { if ((buffer[position++] & 0x80) == 0) { skipped++; } } return skipped; }
Source:
public synchronized void validate() throws TimeoutException { if (!selfDelivered) { throw new TimeoutException("Timeout waiting for member " + localAddress); } else if (!keysAwaitingValidation.isEmpty()) { throw new TimeoutException("Timeout waiting for the validation of " + keysAwaitingValidation); } }

Target:
public synchronized void validate() throws TimeoutException { if (!selfDelivered) { throw new TimeoutException("Timeout waiting for member " + localAddress); } else if (!keysAwaitingValidation.isEmpty()) { throw new TimeoutException("Timeout waiting for the validation of keys: " + keysAwaitingValidation); } }
Source:
public static ClientBuilder bluemix(String vcapServices, String instanceName) { Gson gson = new GsonBuilder().create(); if (vcapServices == null) { throw new IllegalStateException("VCAP_SERVICES is not present."); } CloudFoundryServices services; try { services = gson.fromJson(vcapServices, CloudFoundryServices.class); } catch (JsonParseException e){ throw new IllegalStateException("VCAP_SERVICES is not valid JSON.", e); } if (services.cloudantNoSQLDB == null || services.cloudantNoSQLDB.size() == 0) { throw new IllegalStateException("No Cloudant services present."); } if (instanceName == null) { if (services.cloudantNoSQLDB.size() == 1) { CloudFoundryServices.CloudFoundryService service = services.cloudantNoSQLDB.get(0); if (service.credentials == null || service.credentials.url == null) { throw new IllegalStateException("Invalid VCAP_SERVICES services."); } return ClientBuilder.url(service.credentials.url); } else { throw new IllegalArgumentException("Multiple Cloudant services present. " + "A service name must be specified."); } } for (CloudFoundryServices.CloudFoundryService service : services.cloudantNoSQLDB) { if (instanceName.equals(service.name)) { if (service.credentials == null || service.credentials.url == null) { throw new IllegalStateException("Invalid VCAP_SERVICES services."); } return ClientBuilder.url(service.credentials.url); } } throw new IllegalArgumentException( String.format("Cloudant service matching name %s not found.", instanceName) ); }

Target:
public static ClientBuilder bluemix(String vcapServices, String instanceName) { Gson gson = new GsonBuilder().create(); if (vcapServices == null) { throw new IllegalArgumentException("The vcapServices JSON information was null."); } CloudFoundryServices services; try { services = gson.fromJson(vcapServices, CloudFoundryServices.class); } catch (JsonParseException e){ throw new IllegalArgumentException("The vcapServices was not valid JSON.", e); } if (services.cloudantNoSQLDB == null || services.cloudantNoSQLDB.size() == 0) { throw new IllegalArgumentException("No Cloudant services information present."); } if (instanceName == null) { if (services.cloudantNoSQLDB.size() == 1) { CloudFoundryServices.CloudFoundryService service = services.cloudantNoSQLDB.get(0); if (service.credentials == null || service.credentials.url == null) { throw new IllegalArgumentException( "The Cloudant service instance information was invalid."); } return ClientBuilder.url(service.credentials.url); } else { throw new IllegalArgumentException("Multiple Cloudant service instances present. " + "A service instance name must be specified."); } } for (CloudFoundryServices.CloudFoundryService service : services.cloudantNoSQLDB) { if (instanceName.equals(service.name)) { if (service.credentials == null || service.credentials.url == null) { throw new IllegalArgumentException( "The Cloudant service instance information was invalid."); } return ClientBuilder.url(service.credentials.url); } } throw new IllegalArgumentException( String.format("Cloudant service instance matching name %s was not found.", instanceName) ); }
Source:
public DatabasesImpl() { this(new DatabaseConnection("database1")); }

Target:
public DatabasesImpl() { }
Source:
public void download() throws Exception { LanguageDownloader downloader = LanguageFactory.getLanguageDownloader(getClient(), connectivity,mSettingsRepository.getSettings()); downloader.start(); }

Target:
public void download() throws Exception { LanguageDownloader downloader = LanguageFactory.getLanguageDownloader(getClient(), connectivity); downloader.start(); }
Source:
public void exitNonReserved(SqlBaseParser.NonReservedContext context) { if (!(context.getChild(0) instanceof TerminalNode)) { int rule = ((ParserRuleContext) context.getChild(0)).getRuleIndex(); throw new AssertionError("nonReserved can only contain tokens. Found nested rule: " + ruleNames.get(rule)); } context.getParent().removeLastChild(); Token token = (Token) context.getChild(0).getPayload(); warningConsumer.accept(new ParsingWarning("nonReserved word used", null, token.getLine(), token.getCharPositionInLine())); context.getParent().addChild(new CommonToken( new Pair<>(token.getTokenSource(), token.getInputStream()), SqlBaseLexer.IDENTIFIER, token.getChannel(), token.getStartIndex(), token.getStopIndex())); }

Target:
public void exitNonReserved(SqlBaseParser.NonReservedContext context) { if (!(context.getChild(0) instanceof TerminalNode)) { int rule = ((ParserRuleContext) context.getChild(0)).getRuleIndex(); throw new AssertionError("nonReserved can only contain tokens. Found nested rule: " + ruleNames.get(rule)); } context.getParent().removeLastChild(); Token token = (Token) context.getChild(0).getPayload(); if (token.getText().equalsIgnoreCase("CURRENT_ROLE")) { warningConsumer.accept(new ParsingWarning(format("Reserved word used: %s", token.getText()), token.getLine(), token.getCharPositionInLine())); } context.getParent().addChild(new CommonToken( new Pair<>(token.getTokenSource(), token.getInputStream()), SqlBaseLexer.IDENTIFIER, token.getChannel(), token.getStartIndex(), token.getStopIndex())); }
Source:
public static Comparable value(SqlNode node) { if (node instanceof SqlLiteral) { SqlLiteral literal = (SqlLiteral) node; switch (literal.getTypeName().getFamily()) { case CHARACTER: return (NlsString) literal.value; case NUMERIC: return (BigDecimal) literal.value; case INTERVAL_YEAR_MONTH: case INTERVAL_DAY_TIME: final SqlIntervalLiteral.IntervalValue val = (SqlIntervalLiteral.IntervalValue) literal.value; return val.getSign(); } } if (SqlUtil.isLiteralChain(node)) { assert node instanceof SqlCall; final SqlLiteral literal = SqlLiteralChainOperator.concatenateOperands((SqlCall) node); assert SqlTypeUtil.inCharFamily(literal.getTypeName()); return (NlsString) literal.value; } if (node instanceof SqlIntervalQualifier) { SqlIntervalQualifier qualifier = (SqlIntervalQualifier) node; return qualifier.timeUnitRange; } switch (node.getKind()) { case CAST: assert node instanceof SqlCall; return value(((SqlCall) node).operand(0)); case MINUS_PREFIX: assert node instanceof SqlCall; Comparable o = value(((SqlCall) node).operand(0)); if (o instanceof BigDecimal) { BigDecimal bigDecimal = (BigDecimal) o; return bigDecimal.negate(); } default: throw Util.newInternal("invalid literal: " + node); } }

Target:
public static Comparable value(SqlNode node) { if (node instanceof SqlLiteral) { SqlLiteral literal = (SqlLiteral) node; switch (literal.getTypeName().getFamily()) { case CHARACTER: return (NlsString) literal.value; case NUMERIC: return (BigDecimal) literal.value; case INTERVAL_YEAR_MONTH: final SqlIntervalLiteral.IntervalValue valMonth = (SqlIntervalLiteral.IntervalValue) literal.value; return valMonth.getSign() * SqlParserUtil.intervalToMonths(valMonth); case INTERVAL_DAY_TIME: final SqlIntervalLiteral.IntervalValue valTime = (SqlIntervalLiteral.IntervalValue) literal.value; return valTime.getSign() * SqlParserUtil.intervalToMillis(valTime); } } if (SqlUtil.isLiteralChain(node)) { assert node instanceof SqlCall; final SqlLiteral literal = SqlLiteralChainOperator.concatenateOperands((SqlCall) node); assert SqlTypeUtil.inCharFamily(literal.getTypeName()); return (NlsString) literal.value; } if (node instanceof SqlIntervalQualifier) { SqlIntervalQualifier qualifier = (SqlIntervalQualifier) node; return qualifier.timeUnitRange; } switch (node.getKind()) { case CAST: assert node instanceof SqlCall; return value(((SqlCall) node).operand(0)); case MINUS_PREFIX: assert node instanceof SqlCall; Comparable o = value(((SqlCall) node).operand(0)); if (o instanceof BigDecimal) { BigDecimal bigDecimal = (BigDecimal) o; return bigDecimal.negate(); } default: throw Util.newInternal("invalid literal: " + node); } }
Source:
public static @NonNull List<CompletableFuture<LanguageServer>> getInitializedLanguageServers(@NonNull IFile file, @Nullable Predicate<ServerCapabilities> request) throws IOException { Collection<LanguageServerWrapper> wrappers = getLSWrappers(file, request); return wrappers.stream().map(wrapper -> { return wrapper.getInitializedServer().thenApply((server) -> { try { wrapper.connect(file, null); } catch (IOException e) { LanguageServerPlugin.logError(e); } return server; }); }).collect(Collectors.toList()); }

Target:
public static @NonNull List<CompletableFuture<LanguageServer>> getInitializedLanguageServers(@NonNull IFile file, @Nullable Predicate<ServerCapabilities> request) throws IOException { Collection<LanguageServerWrapper> wrappers = getLSWrappers(file, request); return wrappers.stream().map(wrapper -> wrapper.getInitializedServer().thenApply((server) -> { try { wrapper.connect(file, null); } catch (IOException e) { LanguageServerPlugin.logError(e); } return server; })).collect(Collectors.toList()); }
Source:
public void testPreAndPostLaunchCommands() throws IOException { File tempPreLaunchFile = new File(tempDataDir, "prelaunch.txt"); File tempPostLaunchFile = new File(tempDataDir, "postlaunch.txt"); localhost.setConfig(BrooklynConfigKeys.ONBOX_BASE_DIR, tempDataDir.getAbsolutePath()); app.createAndManageChild(EntitySpec.create(MyService.class) .configure(SoftwareProcess.PRE_LAUNCH_COMMAND, String.format("echo foo > %s", tempPreLaunchFile.getAbsoluteFile())) .configure(SoftwareProcess.POST_LAUNCH_COMMAND, String.format("echo bar > %s", tempPostLaunchFile.getAbsoluteFile()))); app.start(ImmutableList.of(localhost)); List<String> prelaunch = Files.readLines(tempPreLaunchFile, Charsets.UTF_8); List<String> postlaunch = Files.readLines(tempPostLaunchFile, Charsets.UTF_8); assertEquals(prelaunch.size(), 1); assertEquals(postlaunch.size(), 1); assertEquals(postlaunch.get(0), "bar"); assertEquals(prelaunch.get(0), "foo"); tempPreLaunchFile.delete(); tempPostLaunchFile.delete(); }

Target:
public void testPreAndPostLaunchCommands() throws IOException { File tempFile = new File(tempDataDir, "tempFile.txt"); localhost.setConfig(BrooklynConfigKeys.ONBOX_BASE_DIR, tempDataDir.getAbsolutePath()); app.createAndManageChild(EntitySpec.create(VanillaSoftwareProcess.class) .configure(VanillaSoftwareProcess.CHECK_RUNNING_COMMAND, "") .configure(SoftwareProcess.PRE_LAUNCH_COMMAND, String.format("echo inPreLaunch >> %s", tempFile.getAbsoluteFile())) .configure(VanillaSoftwareProcess.LAUNCH_COMMAND, String.format("echo inLaunch >> %s", tempFile.getAbsoluteFile())) .configure(SoftwareProcess.POST_LAUNCH_COMMAND, String.format("echo inPostLaunch >> %s", tempFile.getAbsoluteFile()))); app.start(ImmutableList.of(localhost)); List<String> output = Files.readLines(tempFile, Charsets.UTF_8); assertEquals(output.size(), 3); assertEquals(output.get(0), "inPreLaunch"); assertEquals(output.get(1), "inLaunch"); assertEquals(output.get(2), "inPostLaunch"); tempFile.delete(); }
Source:
public void setup() throws IOException { Configuration config = new Configuration(false); config.set(BigtableOptionsFactory.PROJECT_ID_KEY, "project"); config.set(BigtableOptionsFactory.INSTANCE_ID_KEY, "instance"); BigtableHBaseSettings settings = BigtableHBaseSettings.create(config); TableName tableName = TableName.valueOf(TEST_TABLE); HBaseRequestAdapter hbaseAdapter = new HBaseRequestAdapter(settings, tableName); when(mockConnection.getConfiguration()).thenReturn(config); when(mockConnection.getSession()).thenReturn(mockSession); when(mockSession.getDataClientWrapper()).thenReturn(mockBigtableDataClient); when(mockBigtableDataClient.readFlatRows(isA(Query.class))).thenReturn(mockResultScanner); table = new AbstractBigtableTable(mockConnection, hbaseAdapter) {}; }

Target:
public void setup() throws IOException { Configuration config = new Configuration(false); config.set(BigtableOptionsFactory.PROJECT_ID_KEY, "project"); config.set(BigtableOptionsFactory.INSTANCE_ID_KEY, "instance"); config.set(BigtableOptionsFactory.BIGTABLE_ADMIN_HOST_KEY, "localhost"); config.set(BigtableOptionsFactory.BIGTABLE_HOST_KEY, "localhost"); config.set(BigtableOptionsFactory.BIGTABLE_PORT_KEY, "0"); config.set(BigtableOptionsFactory.ENABLE_GRPC_RETRIES_KEY, "false"); config.set(BigtableOptionsFactory.BIGTABLE_NULL_CREDENTIAL_ENABLE_KEY, "true"); config.set(BigtableOptionsFactory.CUSTOM_USER_AGENT_KEY, "testAgent"); BigtableHBaseSettings settings = BigtableHBaseSettings.create(config); TableName tableName = TableName.valueOf(TEST_TABLE); HBaseRequestAdapter hbaseAdapter = new HBaseRequestAdapter(settings, tableName); when(mockConnection.getConfiguration()).thenReturn(config); when(mockConnection.getSession()).thenReturn(mockSession); when(mockSession.getDataClientWrapper()).thenReturn(mockBigtableDataClient); when(mockBigtableDataClient.readFlatRows(isA(Query.class))).thenReturn(mockResultScanner); table = new AbstractBigtableTable(mockConnection, hbaseAdapter) {}; }
Source:
public CacheGroupMetricsImpl(CacheGroupContext ctx) { this.ctx = ctx; CacheConfiguration cacheCfg = ctx.config(); DataStorageConfiguration dsCfg = ctx.shared().kernalContext().config().getDataStorageConfiguration(); boolean persistentEnabled = CU.isPersistentCache(cacheCfg, dsCfg) && !ctx.shared().kernalContext().clientNode(); MetricRegistry mreg = ctx.shared().kernalContext().metric().registry(metricGroupName()); mreg.register("Caches", this::getCaches, List.class, null); storageSize = mreg.register("StorageSize", () -> persistentEnabled ? database().forGroupPageStores(ctx, PageStore::size) : 0, "Storage space allocated for group, in bytes."); sparseStorageSize = mreg.register("SparseStorageSize", () -> persistentEnabled ? database().forGroupPageStores(ctx, PageStore::getSparseSize) : 0, "Storage space allocated for group adjusted for possible sparsity, in bytes."); idxBuildCntPartitionsLeft = mreg.longMetric("IndexBuildCountPartitionsLeft", "Number of partitions need processed for finished indexes create or rebuilding."); initLocalPartitionsNumber = mreg.longMetric("InitializedLocalPartitionsNumber", "Number of local partitions initialized on current node."); DataRegion region = ctx.dataRegion(); if (region != null) { DataRegionMetricsImpl dataRegionMetrics = ctx.dataRegion().memoryMetrics(); grpPageAllocationTracker = dataRegionMetrics.getOrAllocateGroupPageAllocationTracker(ctx.cacheOrGroupName()); } else grpPageAllocationTracker = new LongAdderMetric("NO_OP", null); }

Target:
public CacheGroupMetricsImpl(CacheGroupContext ctx) { this.ctx = ctx; CacheConfiguration cacheCfg = ctx.config(); DataStorageConfiguration dsCfg = ctx.shared().kernalContext().config().getDataStorageConfiguration(); boolean persistentEnabled = !ctx.shared().kernalContext().clientNode() && CU.isPersistentCache(cacheCfg, dsCfg); MetricRegistry mreg = ctx.shared().kernalContext().metric().registry(metricGroupName()); mreg.register("Caches", this::getCaches, List.class, null); storageSize = mreg.register("StorageSize", () -> persistentEnabled ? database().forGroupPageStores(ctx, PageStore::size) : 0, "Storage space allocated for group, in bytes."); sparseStorageSize = mreg.register("SparseStorageSize", () -> persistentEnabled ? database().forGroupPageStores(ctx, PageStore::getSparseSize) : 0, "Storage space allocated for group adjusted for possible sparsity, in bytes."); idxBuildCntPartitionsLeft = mreg.longMetric("IndexBuildCountPartitionsLeft", "Number of partitions need processed for finished indexes create or rebuilding."); initLocalPartitionsNumber = mreg.longMetric("InitializedLocalPartitionsNumber", "Number of local partitions initialized on current node."); DataRegion region = ctx.dataRegion(); if (region != null) { DataRegionMetricsImpl dataRegionMetrics = ctx.dataRegion().memoryMetrics(); grpPageAllocationTracker = dataRegionMetrics.getOrAllocateGroupPageAllocationTracker(ctx.cacheOrGroupName()); } else grpPageAllocationTracker = new LongAdderMetric("NO_OP", null); }
Source:
public ResponseEntity<?> trialsMatchingGet( @ApiParam(value = "", required = true) @RequestParam(value = "", required = true) String oncoTreeCode, @ApiParam(value = "", required = false) @RequestParam(value = "", required = false) String treatment) throws IOException, ParseException { HttpStatus status = HttpStatus.OK; AWSCredentials credentials = new BasicAWSCredentials(s3AccessKey, s3SecretKey); AmazonS3 s3client = AmazonS3ClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion(Regions.US_EAST_1).build(); S3Object s3object = s3client.getObject("oncokb", "drug-matching/result.json"); S3ObjectInputStream inputStream = s3object.getObjectContent(); JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = (JSONObject) jsonParser.parse(new InputStreamReader(inputStream, "UTF-8")); Tumor tumor = new Tumor(); if (jsonObject.containsKey(oncoTreeCode)){ tumor = getTumor(jsonObject, oncoTreeCode); if (treatment == null) { return new ResponseEntity<Tumor>(tumor, status); } Trial[] trial = getTrialByTumorTreatment(tumor.getTrials(), treatment); return new ResponseEntity<Trial[]>(trial, status); } return new ResponseEntity<Trial[]>(new Trial[0], status); }

Target:
public ResponseEntity<List<Trial>> trialsMatchingGet( @ApiParam(value = "", required = true) @RequestParam(value = "", required = true) String oncoTreeCode, @ApiParam(value = "", required = false) @RequestParam(value = "", required = false) String treatment) throws IOException, ParseException { HttpStatus status = HttpStatus.OK; AWSCredentials credentials = new BasicAWSCredentials(s3AccessKey, s3SecretKey); AmazonS3 s3client = AmazonS3ClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion(s3Region).build(); S3Object s3object = s3client.getObject("oncokb", "drug-matching/result.json"); S3ObjectInputStream inputStream = s3object.getObjectContent(); JSONParser jsonParser = new JSONParser(); JSONObject jsonObject = (JSONObject) jsonParser.parse(new InputStreamReader(inputStream, "UTF-8")); Tumor tumor = new Tumor(); if (jsonObject.containsKey(oncoTreeCode)){ tumor = getTumor(jsonObject, oncoTreeCode); if (treatment == null) { return new ResponseEntity<List<Trial>>(tumor.getTrials(), status); } List<Trial> trial = getTrialByTreatment(tumor.getTrials(), treatment); return new ResponseEntity<List<Trial>>(trial, status); } return new ResponseEntity<List<Trial>>(new ArrayList<>(), status); }
Source:
private void initEditMessageAction(ChangeInfo info, String revision) { RevisionInfo revisionInfo = info.revision(revision); NativeMap<ActionInfo> actions = revisionInfo.actions(); if ((actions != null && actions.containsKey("message")) || revisionInfo.is_edit()) { editMessage.setVisible(true); editMessageAction = new EditMessageAction( info.legacy_id(), info.revision(revision).commit().message(), style, editMessage, reply); keysAction.add(new KeyCommand(0, 'e', Util.C.keyEditMessage()) { @Override public void onKeyPress(KeyPressEvent event) { editMessageAction.onEdit(); } }); } }

Target:
private void initEditMessageAction(ChangeInfo info, String revision) { RevisionInfo revisionInfo = info.revision(revision); NativeMap<ActionInfo> actions = revisionInfo.actions(); if ((actions != null && actions.containsKey("message")) || revisionInfo.is_edit()) { editMessage.setVisible(true); editMessageAction = new EditMessageAction( info.legacy_id(), revisionInfo.commit().message(), style, editMessage, reply); keysAction.add(new KeyCommand(0, 'e', Util.C.keyEditMessage()) { @Override public void onKeyPress(KeyPressEvent event) { editMessageAction.onEdit(); } }); } }
Source:
public static String fromJson(JsonReader jsonReader) { return jsonReader.getStringOrDefault("default_job_timeout", null); }

Target:
public static String fromJson(JsonReader jsonReader) { return jsonReader.getString("default_job_timeout"); }
Source:
public void commandRun() { if (!isZKServerRunning()) { pw.println(ZK_NOT_SERVING); } else { pw.print("Zookeeper version: "); pw.println(Version.getFullVersion()); if (zkServer instanceof ReadOnlyZooKeeperServer) { pw.println("READ-ONLY mode; serving only read-only clients"); } if (len == FourLetterCommands.statCmd) { LOG.info("Stat command output"); pw.println("Clients:"); for(ServerCnxn c : factory.getConnections()){ c.dumpConnectionInfo(pw, true); pw.println(); } pw.println(); } ServerStats serverStats = zkServer.serverStats(); pw.print(serverStats.toString()); pw.print("Node count: "); pw.println(zkServer.getZKDatabase().getNodeCount()); if (serverStats.getServerState().equals("leader")) { Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader(); BufferStats bufferStats = leader.getBufferStats(); pw.printf("Proposal sizes last/min/max: %s%n", bufferStats.toString()); } } }

Target:
public void commandRun() { if (!isZKServerRunning()) { pw.println(ZK_NOT_SERVING); } else { pw.print("Zookeeper version: "); pw.println(Version.getFullVersion()); if (zkServer instanceof ReadOnlyZooKeeperServer) { pw.println("READ-ONLY mode; serving only read-only clients"); } if (len == FourLetterCommands.statCmd) { LOG.info("Stat command output"); pw.println("Clients:"); for(ServerCnxn c : factory.getConnections()){ c.dumpConnectionInfo(pw, true); pw.println(); } pw.println(); } ServerStats serverStats = zkServer.serverStats(); pw.print(serverStats.toString()); pw.print("Node count: "); pw.println(zkServer.getZKDatabase().getNodeCount()); if (serverStats.getServerState().equals("leader")) { Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader(); BufferStats proposalStats = leader.getProposalStats(); pw.printf("Proposal sizes last/min/max: %s%n", proposalStats.toString()); } } }
Source:
public DistanceComparator() { this.coords = null; this.list = null; }

Target:
public DistanceComparator() { coords = null; list = new ArrayList<>(); }
Source:
public void setImageServerContent(Map<String, String> serverContent) { this.imageServerContent = serverContent; }

Target:
public void setImageServerContent(Map<String, String> serverContent) { this.imageServerContent = ImmutableMap.copyOf(serverContent); }