auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private NetworkSend write(SelectionKey key, Transmission transmission) { long startTimeToWriteInMs = time.milliseconds(); try { boolean sendComplete = transmission.write(); NetworkSend networkSend = transmission.getNetworkSend(); if (sendComplete) { logger.trace("Finished writing, registering for read on connection {}", transmission.getRemoteSocketAddress()); transmission.onSendComplete(); metrics.sendInFlight.dec(); transmission.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } return networkSend; } catch (IOException e) { handleReadWriteIOException(e, key); transmission.networkSend.getPayload().release(); return null; } finally { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmission.getConnectionId(), writeTime); } }

Target:
private NetworkSend write(SelectionKey key, Transmission transmission) { long startTimeToWriteInMs = time.milliseconds(); try { boolean sendComplete = transmission.write(); NetworkSend networkSend = transmission.getNetworkSend(); if (sendComplete) { logger.trace("Finished writing, registering for read on connection {}", transmission.getRemoteSocketAddress()); transmission.onSendComplete(); metrics.sendInFlight.dec(); transmission.clearSend(); key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE | SelectionKey.OP_READ); } return networkSend; } catch (IOException e) { handleReadWriteIOException(e, key); return null; } finally { long writeTime = time.milliseconds() - startTimeToWriteInMs; logger.trace("SocketServer time spent on write per key = {}", transmission.getConnectionId(), writeTime); } }
Source:
public String generateCPF(boolean valid) { String partial = ""; String cpf = ""; Integer number; for (int i = 0; i < 9; i++) { number = new Integer((int) (Math.random() * 10)); partial += number.toString(); } if(valid) { cpf = partial + CPFUtils.calculateVerificationDigit(partial); } else { String twoFakeDigits = String.valueOf(new Random().nextInt(9 + 1)) + String.valueOf(new Random().nextInt(9 + 1)); cpf = partial + twoFakeDigits; } return formatCPF(cpf); }

Target:
public String generateCPF(boolean valid) { String partial = ""; String cpf = ""; Integer number; for (int i = 0; i < 9; i++) { number = new Integer((int) (Math.random() * 10)); partial += number.toString(); } if(valid) { cpf = partial + CPFUtils.calculateVerificationDigit(partial); } else { Random random = new Random(); long elevenDigits = (random.nextInt(1000000000) + (random.nextInt(90) + 10) * 1000000000L); cpf = String.valueOf(elevenDigits); } return formatCPF(cpf); }
Source:
public FilePath getWorkspace(Job job) { if(job != null) { LOGGER.info("Nodes went offline. Hence fetching it through master"); if (job instanceof AbstractProject) { String assignedLabel = ((AbstractProject) job).getAssignedLabelString(); KubernetesCloud kubernetesCloud = Hudson.getInstance().clouds.get(KubernetesCloud.class); if (kubernetesCloud != null) { List<PodTemplate> podTemplates = kubernetesCloud.getTemplates(); for (PodTemplate podTemplate : podTemplates) { if (ObjectUtils.equals(podTemplate.getLabel(), assignedLabel)) { FilePath filePath = Jenkins.getInstance().getWorkspaceFor((TopLevelItem) job); if(filePath != null) { String workspacePath = filePath.toString(); LOGGER.info("Workspace Path: " + workspacePath); File workspace = new File(workspacePath); LOGGER.info("Workspace exists ? " + workspace.exists()); if (workspace.exists()) { return new FilePath(workspace); } } } } } } } return null; }

Target:
public FilePath getWorkspace(Job job) { LOGGER.info("Nodes went offline. Hence fetching it through master"); if (job instanceof AbstractProject) { String assignedLabel = ((AbstractProject) job).getAssignedLabelString(); Jenkins jenkinsInstance = Hudson.getInstanceOrNull(); if(jenkinsInstance != null) { List<KubernetesCloud> kubernetesClouds = jenkinsInstance.clouds.getAll(KubernetesCloud.class); for (KubernetesCloud kubernetesCloud : kubernetesClouds) { if (kubernetesCloud != null) { List<PodTemplate> podTemplates = kubernetesCloud.getTemplates(); for (PodTemplate podTemplate : podTemplates) { if (ObjectUtils.equals(podTemplate.getLabel(), assignedLabel)) { FilePath filePath = Jenkins.getInstance().getWorkspaceFor((TopLevelItem) job); if (filePath != null) { String workspacePath = filePath.toString(); LOGGER.fine("Workspace Path: " + workspacePath); File workspace = new File(workspacePath); LOGGER.fine("Workspace exists ? " + workspace.exists()); if (workspace.exists()) { return new FilePath(workspace); } } } } } } } } return null; }
Source:
public UpdateMetadataRequest build(short version) { if (version < 3) { for (UpdateMetadataBroker broker : liveBrokers) { if (version == 0) { if (broker.endpoints().size() != 1 || broker.endpoints().get(0).securityProtocol() != SecurityProtocol.PLAINTEXT.id) { throw new UnsupportedVersionException("UpdateMetadataRequest v0 only handles PLAINTEXT endpoints"); } UpdateMetadataEndpoint endpoint = broker.endpoints().get(0); broker.setV0Host(endpoint.host()); broker.setV0Port(endpoint.port()); } else { if (broker.endpoints().stream().anyMatch(endpoint -> !endpoint.listener().isEmpty() && !endpoint.listener().equals(listenerNameFromSecurityProtocol(endpoint)))) { throw new UnsupportedVersionException("UpdateMetadataRequest v0-v3 does not support custom " + "listeners, request version: " + version + ", endpoints: " + broker.endpoints()); } } } } UpdateMetadataRequestData data = new UpdateMetadataRequestData() .setControllerId(controllerId) .setControllerEpoch(controllerEpoch) .setBrokerEpoch(brokerEpoch) .setLiveBrokers(liveBrokers); if (version >= 5) { Map<String, UpdateMetadataTopicState> topicStatesMap = groupByTopic(partitionStates); data.setTopicStates(new ArrayList<>(topicStatesMap.values())); } else { data.setUngroupedPartitionStates(partitionStates); } return new UpdateMetadataRequest(data, version); }

Target:
public UpdateMetadataRequest build(short version) { if (version < 3) { for (UpdateMetadataBroker broker : liveBrokers) { if (version == 0) { if (broker.endpoints().size() != 1) throw new UnsupportedVersionException("UpdateMetadataRequest v0 requires a single endpoint"); if (broker.endpoints().get(0).securityProtocol() != SecurityProtocol.PLAINTEXT.id) throw new UnsupportedVersionException("UpdateMetadataRequest v0 only handles PLAINTEXT endpoints"); UpdateMetadataEndpoint endpoint = broker.endpoints().get(0); broker.setV0Host(endpoint.host()); broker.setV0Port(endpoint.port()); } else { if (broker.endpoints().stream().anyMatch(endpoint -> !endpoint.listener().isEmpty() && !endpoint.listener().equals(listenerNameFromSecurityProtocol(endpoint)))) { throw new UnsupportedVersionException("UpdateMetadataRequest v0-v3 does not support custom " + "listeners, request version: " + version + ", endpoints: " + broker.endpoints()); } } } } UpdateMetadataRequestData data = new UpdateMetadataRequestData() .setControllerId(controllerId) .setControllerEpoch(controllerEpoch) .setBrokerEpoch(brokerEpoch) .setLiveBrokers(liveBrokers); if (version >= 5) { Map<String, UpdateMetadataTopicState> topicStatesMap = groupByTopic(partitionStates); data.setTopicStates(new ArrayList<>(topicStatesMap.values())); } else { data.setUngroupedPartitionStates(partitionStates); } return new UpdateMetadataRequest(data, version); }
Source:
public void reflogSeek() throws IOException { PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60); String msg = "test"; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter() .setMinUpdateIndex(1) .setMaxUpdateIndex(1) .begin(buffer); writer.writeLog(MASTER, 1, who, ObjectId.zeroId(), id(1), msg); writer.writeLog(NEXT, 1, who, ObjectId.zeroId(), id(2), msg); writer.finish(); byte[] table = buffer.toByteArray(); ReftableReader t = read(table); try (LogCursor c = t.seekLog(MASTER, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(MASTER, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(MASTER, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); } try (LogCursor c = t.seekLog(NEXT, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(NEXT, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(NEXT, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); } }

Target:
public void reflogSeek() throws IOException { PersonIdent who = new PersonIdent("Log", "Ger", 1500079709, -8 * 60); String msg = "test"; String msgNext = "test next"; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter() .setMinUpdateIndex(1) .setMaxUpdateIndex(1) .begin(buffer); writer.writeLog(MASTER, 1, who, ObjectId.zeroId(), id(1), msg); writer.writeLog(NEXT, 1, who, ObjectId.zeroId(), id(2), msgNext); writer.finish(); byte[] table = buffer.toByteArray(); ReftableReader t = read(table); try (LogCursor c = t.seekLog(MASTER, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(MASTER, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(MASTER, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); assertEquals(c.getReflogEntry().getComment(), msg); } try (LogCursor c = t.seekLog(NEXT, Long.MAX_VALUE)) { assertTrue(c.next()); assertEquals(c.getReflogEntry().getComment(), msgNext); } try (LogCursor c = t.seekLog(NEXT, 0)) { assertFalse(c.next()); } try (LogCursor c = t.seekLog(NEXT, 1)) { assertTrue(c.next()); assertEquals(c.getUpdateIndex(), 1); assertEquals(c.getReflogEntry().getComment(), msgNext); } }
Source:
public Response createFromYaml(String yaml) { URI uri; try { uri = new URI(yaml); } catch (URISyntaxException e) { uri = null; } if (uri != null) { log.debug("Input to createFromYaml might be a URL: " + uri); DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(uri); HttpResponse response = null; try { response = httpClient.execute(request); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); response.getEntity().writeTo(byteArrayOutputStream); yaml = byteArrayOutputStream.toString(); log.debug("Continuing using the contents of the URL: {}", yaml); } } catch (IOException e) { log.debug("Could not retrieve from URL due to exception, proceeding to treat as YAML", e); } } log.debug("Creating app from yaml"); Reader input = new StringReader(yaml); AssemblyTemplate at = camp().pdp().registerDeploymentPlan(input); return launch(at); }

Target:
public Response createFromYaml(String yaml) { URI uri; try { uri = new URI(yaml); } catch (URISyntaxException e) { uri = null; } if (uri != null) { log.debug("Input to createFromYaml might be a URL: " + uri); yaml = ResourceUtils.create(mgmt()).getResourceAsString(uri.toString()); log.debug("Continuing using the contents of the URL: {}", yaml); } log.debug("Creating app from yaml"); Reader input = new StringReader(yaml); AssemblyTemplate at = camp().pdp().registerDeploymentPlan(input); return launch(at); }
Source:
protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { return surveyRepository.getUsers() .concatMap(new Function<List<User>, Observable<Pair<User, List<User>>>>() { @Override public Observable<Pair<User, List<User>>> apply(final List<User> users) { return userRepository.getSelectedUser() .map(new Function<Long, Pair<User, List<User>>>() { @Override public Pair<User, List<User>> apply(final Long selectedUserId) { User currentUser = null; for (User u : users) { if (selectedUserId == u.getId()) { currentUser = u; break; } } if (currentUser != null) { users.remove(currentUser); } return new Pair<>(currentUser, users); } }); } }); }

Target:
protected <T> Observable buildUseCaseObservable(Map<String, T> parameters) { return surveyRepository.getUsers() .concatMap(new Function<List<User>, Observable<Pair<User, List<User>>>>() { @Override public Observable<Pair<User, List<User>>> apply(final List<User> users) { return userRepository.getSelectedUser() .map(new Function<Long, Pair<User, List<User>>>() { @Override public Pair<User, List<User>> apply(final Long selectedUserId) { User currentUser = null; for (User u : users) { if (selectedUserId.equals(u.getId())) { currentUser = u; break; } } if (currentUser != null) { users.remove(currentUser); } return new Pair<>(currentUser, users); } }); } }); }
Source:
public List getEmulatedMachinesList() { List resultList = lst(); resultList.add("vdsmfake"); resultList.add("host25-rack06.scale.openstack.engineering.redhat.com"); resultList.add("pc-0.12"); resultList.add("pc-0.13"); resultList.add("pc-0.14"); resultList.add("pc-0.15"); resultList.add("pc-1.0"); resultList.add("pc-1.0"); resultList.add("rhel6.4.0"); resultList.add("pc"); resultList.add("isapc"); return resultList; }

Target:
public List getEmulatedMachinesList() { List resultList = lst(); resultList.add("vdsmfake"); resultList.add("pc-0.12"); resultList.add("pc-0.13"); resultList.add("pc-0.14"); resultList.add("pc-0.15"); resultList.add("pc-1.0"); resultList.add("pc-1.0"); resultList.add("rhel6.4.0"); resultList.add("pc"); resultList.add("isapc"); return resultList; }
Source:
public String toString() { if (this.hashtag != null){ return "Host with Hashtag [hostname=" + hostname + ", ipAddress=" + ipAddress + ", port=" + port + ", rack: " + rack + ", datacenter: " + datacenter + ", status: " + status.name() + ", hashtag=" + hashtag + "]"; } return "Host [hostname=" + hostname + ", ipAddress=" + ipAddress + ", port=" + port + ", rack: " + rack + ", datacenter: " + datacenter + ", status: " + status.name() + "]"; }

Target:
public String toString() { return "Host [hostname=" + hostname + ", ipAddress=" + ipAddress + ", port=" + port + ", rack: " + rack + ", datacenter: " + datacenter + ", status: " + status.name() + ", hashtag=" + hashtag + "]"; }
Source:
public void start() throws IOException { for (final FireDepartment fireDepartment : fireDepartments) { DataSchema schema = fireDepartment.getDataSchema(); final FireChief chief = new FireChief(fireDepartment); List<FireChief> chiefsOfDataSource = chiefs.get(schema.getDataSource()); if (chiefsOfDataSource == null){ chiefsOfDataSource = new ArrayList<RealtimeManager.FireChief>(); chiefs.put(schema.getDataSource(), chiefsOfDataSource); } chiefsOfDataSource.add(chief); chief.setName(String.format("chief-%s", schema.getDataSource())); chief.setDaemon(true); chief.init(); chief.start(); } }

Target:
public void start() throws IOException { for (final FireDepartment fireDepartment : fireDepartments) { DataSchema schema = fireDepartment.getDataSchema(); final FireChief chief = new FireChief(fireDepartment); List<FireChief> chiefs = this.chiefs.get(schema.getDataSource()); if (chiefs == null) { chiefs = new ArrayList<RealtimeManager.FireChief>(); this.chiefs.put(schema.getDataSource(), chiefs); } chiefs.add(chief); chief.setName(String.format("chief-%s", schema.getDataSource())); chief.setDaemon(true); chief.init(); chief.start(); } }
Source:
protected void doInit() throws Exception { super.doInit(); resolvedTemplate = SqlHelper.resolveQuery(getEndpoint().getCamelContext(), getEndpoint().getTemplate(), null); }

Target:
protected void doInit() throws Exception { super.doInit(); String template = getEndpoint().getTemplate(); if (ResourceHelper.isClasspathUri(template)) { resolvedTemplate = SqlHelper.resolveQuery(getEndpoint().getCamelContext(), template, null); } }
Source:
public static boolean isChimeric(final SAMRecord rec, final int maxInsertSize, final Set<PairOrientation> expectedOrientations) { return (Math.abs(rec.getInferredInsertSize()) > maxInsertSize || !rec.getReferenceIndex().equals(rec.getMateReferenceIndex()) || expectedOrientations.contains(SamPairUtil.getPairOrientation(rec)) || rec.getAttribute("SA") != null); }

Target:
public static boolean isChimeric(final SAMRecord rec, final int maxInsertSize, final Set<PairOrientation> expectedOrientations) { return !(rec.getReadUnmappedFlag() || !rec.getReadPairedFlag() || rec.getMateUnmappedFlag()) && (Math.abs(rec.getInferredInsertSize()) > maxInsertSize || !rec.getReferenceIndex().equals(rec.getMateReferenceIndex()) || expectedOrientations.contains(SamPairUtil.getPairOrientation(rec)) || rec.getAttribute("SA") != null); }
Source:
public void onBackPressed() { androidx.fragment.app.Fragment fragment = getSupportFragmentManager() .findFragmentByTag(ImageSettingsDialogFragment.IMAGE_SETTINGS_DIALOG_TAG); if (fragment != null && fragment.isVisible()) { ((ImageSettingsDialogFragment) fragment).dismissFragment(); } else { super.onBackPressed(); } }

Target:
public void onBackPressed() { Fragment fragment = getSupportFragmentManager().findFragmentByTag(ImageSettingsDialogFragment.IMAGE_SETTINGS_DIALOG_TAG); if (fragment != null && fragment.isVisible()) { ((ImageSettingsDialogFragment) fragment).dismissFragment(); } else { super.onBackPressed(); } }
Source:
public void channelActive(ChannelHandlerContext ctx) throws RestServiceException { this.ctx = ctx; try { messageHandler = requestDelegator.getMessageHandler(); responseHandler = new NettyResponseHandler(ctx, nettyMetrics); } catch (Exception e) { logger.error("Unable to obtain message/response handlers - " + e); nettyMetrics.channelActiveTasksFailureCount.inc(); throw new RestServiceException("Unable to obtain message/response handlers - " + e, RestServiceErrorCode.ChannelActiveTasksFailure); } }

Target:
public void channelActive(ChannelHandlerContext ctx) throws RestServiceException { this.ctx = ctx; requestHandler = requestHandlerController.getRequestHandler(); responseHandler = new NettyResponseHandler(ctx, nettyMetrics); if (requestHandler == null || responseHandler == null) { nettyMetrics.channelActiveTasksFailureCount.inc(); String msg = requestHandler == null ? "RestRequestHandler received was null" : "RestResponseHandler received was null"; logger.error(msg); throw new RestServiceException(msg, RestServiceErrorCode.ChannelActiveTasksFailure); } }
Source:
public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mIsRadioTechnologyChangeOngoing = true; mRuimRecords.unregisterForRecordsLoaded(h); mCM.unregisterForAvailable(h); mCM.unregisterForOffOrNotAvailable(h); mCM.unregisterForOn(h); mCM.unregisterForNVReady(h); mSST.unregisterForNetworkAttach(h); mCM.unSetOnSuppServiceNotification(h); mCM.unSetOnCallRing(h); h.removeCallbacksAndMessages(null); mCT.dispose(); mDataConnection.dispose(); mSST.dispose(); mSMS.dispose(); ((RuimFileHandler) mIccFileHandler).dispose(); mRuimRecords.dispose(); mRuimCard.dispose(); mRuimPhoneBookInterfaceManager.dispose(); mRuimSmsInterfaceManager.dispose(); mSubInfo.dispose(); this.mCM = null; this.mNvLoadedRegistrants = null; this.mCT = null; this.mDataConnection = null; this.mPostDialHandler = null; this.mRuimCard = null; this.mRuimPhoneBookInterfaceManager = null; this.mRuimRecords = null; this.mRuimSmsInterfaceManager = null; this.mSMS = null; this.mSST = null; this.mSubInfo = null; this.mIccFileHandler = null; this.h = null; } }

Target:
public void dispose() { synchronized(PhoneProxy.lockForRadioTechnologyChange) { mRuimRecords.unregisterForRecordsLoaded(h); mCM.unregisterForAvailable(h); mCM.unregisterForOffOrNotAvailable(h); mCM.unregisterForOn(h); mCM.unregisterForNVReady(h); mSST.unregisterForNetworkAttach(h); mCM.unSetOnSuppServiceNotification(h); mCM.unSetOnCallRing(h); mCT.dispose(); mDataConnection.dispose(); mSST.dispose(); mSMS.dispose(); mIccFileHandler.dispose(); mRuimRecords.dispose(); mRuimCard.dispose(); mRuimPhoneBookInterfaceManager.dispose(); mRuimSmsInterfaceManager.dispose(); mSubInfo.dispose(); } }
Source:
public synchronized void onPartitionsAssigned(@NotNull final Collection<TopicPartition> topicPartitions) { final Instant assignmentTime = Instant.now(); for (final TopicPartition topicPartition : topicPartitions) { @NotNull final KafkaPositionKey key = new KafkaPositionKey(topicPartition.topic(), topicPartition.partition(), _brooklinInstance, _brooklinTaskId, _taskStartTime); _ownedKeys.put(topicPartition, key); _needingInit.add(topicPartition); @NotNull final KafkaPositionValue value = (KafkaPositionValue) _positions.computeIfAbsent(key, s -> new KafkaPositionValue()); value.setAssignmentTime(assignmentTime); } }

Target:
public synchronized void onPartitionsAssigned(@NotNull final Collection<TopicPartition> topicPartitions) { final Instant assignmentTime = Instant.now(); for (final TopicPartition topicPartition : topicPartitions) { final KafkaPositionKey key = new KafkaPositionKey(topicPartition.topic(), topicPartition.partition(), BrooklinInstanceInfo.getInstanceName(), _datastreamTaskPrefix, _datastreamTaskName, _connectorTaskStartTime); _ownedKeys.put(topicPartition, key); _needingInit.add(topicPartition); final KafkaPositionValue value = (KafkaPositionValue) _positions.computeIfAbsent(key, s -> new KafkaPositionValue()); value.setAssignmentTime(assignmentTime); } }
Source:
public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException, GroupResourceMismatchException { }

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { }
Source:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); final DeploymentUnit top = unit.getParent() == null ? unit : unit.getParent(); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION); moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("jakarta.security.enterprise.api"), false, false, true, false)); Boolean securityPresent = top.getAttachment(EESecurityAnnotationProcessor.SECURITY_PRESENT); if(securityPresent != null && securityPresent) { moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("org.glassfish.soteria"), false, false, true, false)); } }

Target:
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); final DeploymentUnit top = unit.getParent() == null ? unit : unit.getParent(); final ModuleLoader moduleLoader = Module.getBootModuleLoader(); final ModuleSpecification moduleSpec = unit.getAttachment(Attachments.MODULE_SPECIFICATION); moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("javax.security.enterprise.api"), false, false, true, false)); Boolean securityPresent = top.getAttachment(EESecurityAnnotationProcessor.SECURITY_PRESENT); if(securityPresent != null && securityPresent) { moduleSpec.addSystemDependency(new ModuleDependency(moduleLoader, ModuleIdentifier.fromString("org.glassfish.soteria"), false, false, true, false)); } }
Source:
public boolean skipToKeyframeBefore(long timeUs) { long nextOffset = infoQueue.skipToKeyframeBefore(timeUs, false); if (nextOffset == C.POSITION_UNSET) { return false; } dropDownstreamTo(nextOffset); return true; }

Target:
public boolean skipToKeyframeBefore(long timeUs) { return infoQueue.skipToKeyframeBefore(timeUs, false); }
Source:
protected boolean mergeRecursive(int callDepth, RevCommit h1, RevCommit h2, List<RevCommit> commonAncestors) throws IOException { boolean clean = false; List<RevCommit> mergedCommonAncestors = new ArrayList<RevCommit>(); RevCommit firstCommonAncestor = null; if (commonAncestors == null) commonAncestors = new ArrayList<RevCommit>(); if (commonAncestors.isEmpty()) commonAncestors.addAll(reverseCommitList(getMergeBases(h1, h2))); if (!commonAncestors.isEmpty()) { firstCommonAncestor = commonAncestors.remove(0); mergedCommonAncestors.add(firstCommonAncestor); } if (commonAncestors.isEmpty()) { resultTree = (firstCommonAncestor == null ? null : firstCommonAncestor.getTree().getId()); } else { for (RevCommit commonAncestor : commonAncestors) { resultTree = null; RevCommit saved_b1; RevCommit saved_b2; callDepth++; dircache.clear(); saved_b1 = h1; saved_b2 = h2; mergeRecursive(callDepth, firstCommonAncestor, commonAncestor, null); if (resultTree == null) { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveReturnedNoCommit, callDepth, (firstCommonAncestor == null ? "null" : firstCommonAncestor.name()), commonAncestor.name())); } mergedCommonAncestors.add(commonAncestor); h1 = saved_b1; h2 = saved_b2; callDepth--; } } clean = mergeTrees(openTree(resultTree), h1.getTree(), h2.getTree()); return clean; }

Target:
protected boolean mergeRecursive(int callDepth, RevCommit h1, RevCommit h2, List<RevCommit> commonAncestors) throws IOException { RevCommit firstCommonAncestor = null; if (commonAncestors == null) commonAncestors = new ArrayList<RevCommit>(); if (commonAncestors.isEmpty()) commonAncestors.addAll(reverseCommitList(getMergeBases(h1, h2))); if (!commonAncestors.isEmpty()) { firstCommonAncestor = commonAncestors.remove(0); } if (commonAncestors.isEmpty()) { resultTree = (firstCommonAncestor == null ? null : firstCommonAncestor.getTree().getId()); } else { for (RevCommit commonAncestor : commonAncestors) { resultTree = null; if (!mergeRecursive(callDepth + 1, firstCommonAncestor, commonAncestor, null)) { return false; } if (resultTree == null) { throw new IOException(MessageFormat.format( JGitText.get().mergeRecursiveReturnedNoCommit, callDepth + 1, (firstCommonAncestor == null ? "null" : firstCommonAncestor.name()), commonAncestor.name())); } } } return mergeTrees(openTree(resultTree), h1.getTree(), h2.getTree()); }
Source:
private String getOtherIdFromDTO(DatasetVersionDTO datasetVersionDTO) { List<String> otherIds = new ArrayList<>(); for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) { String key = entry.getKey(); MetadataBlockDTO value = entry.getValue(); if ("citation".equals(key)) { for (FieldDTO fieldDTO : value.getFields()) { if (DatasetFieldConstant.otherId.equals(fieldDTO.getTypeName())) { for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) { for (FieldDTO next : foo) { if (DatasetFieldConstant.otherIdValue.equals(next.getTypeName())) { otherIds.add(next.getSinglePrimitive()); } } } } } } } if (!otherIds.isEmpty()) { for (String otherId : otherIds) { if (otherId.contains(GlobalId.DOI_PROTOCOL) || otherId.contains(GlobalId.HDL_PROTOCOL)) { return otherId; } } for (String otherId : otherIds) { try { HandleResolver hr = new HandleResolver(); hr.resolveHandle(otherId); return GlobalId.HDL_PROTOCOL + ":" + otherId; } catch (HandleException e) { logger.fine("Not a valid handle: " + e.toString()); } } } return null; }

Target:
private String getOtherIdFromDTO(DatasetVersionDTO datasetVersionDTO) { List<String> otherIds = new ArrayList<>(); for (Map.Entry<String, MetadataBlockDTO> entry : datasetVersionDTO.getMetadataBlocks().entrySet()) { String key = entry.getKey(); MetadataBlockDTO value = entry.getValue(); if ("citation".equals(key)) { for (FieldDTO fieldDTO : value.getFields()) { if (DatasetFieldConstant.otherId.equals(fieldDTO.getTypeName())) { for (HashSet<FieldDTO> foo : fieldDTO.getMultipleCompound()) { for (FieldDTO next : foo) { if (DatasetFieldConstant.otherIdValue.equals(next.getTypeName())) { otherIds.add(next.getSinglePrimitive()); } } } } } } } if (!otherIds.isEmpty()) { for (String otherId : otherIds) { if (otherId.startsWith(GlobalId.DOI_PROTOCOL) || otherId.startsWith(GlobalId.HDL_PROTOCOL) || otherId.startsWith(GlobalId.DOI_RESOLVER_URL) || otherId.startsWith(GlobalId.HDL_RESOLVER_URL)) { return otherId; } } for (String otherId : otherIds) { try { HandleResolver hr = new HandleResolver(); hr.resolveHandle(otherId); return GlobalId.HDL_PROTOCOL + ":" + otherId; } catch (HandleException e) { logger.fine("Not a valid handle: " + e.toString()); } } } return null; }
Source:
public void afterChunk(ChunkContext context) { int estimatedTotalNumberOfLines = (int)context.getStepContext().getStepExecutionContext() .get(JobParametersNames.NUMBER_OF_LINES); int read = context.getStepContext().getStepExecution().getReadCount(); int write = context.getStepContext().getStepExecution().getWriteCount(); int skip = context.getStepContext().getStepExecution().getReadSkipCount() + context.getStepContext().getStepExecution().getProcessSkipCount() + context.getStepContext().getStepExecution().getWriteSkipCount(); String chunkStatisticsMessage = "Chunk stats: Items read count " + read + ", items write count " + write + " items skip count " + skip; if (estimatedTotalNumberOfLines != 0) { int percent = (read * 100 / estimatedTotalNumberOfLines); logger.info( percent + "% " + chunkStatisticsMessage); } else { logger.info(chunkStatisticsMessage); } }

Target:
public void afterChunk(ChunkContext context) { long estimatedTotalNumberOfLines = (long)context.getStepContext().getStepExecutionContext() .get(ExecutionContextParametersNames.NUMBER_OF_LINES); long read = context.getStepContext().getStepExecution().getReadCount(); long write = context.getStepContext().getStepExecution().getWriteCount(); long skip = context.getStepContext().getStepExecution().getReadSkipCount() + context.getStepContext().getStepExecution().getProcessSkipCount() + context.getStepContext().getStepExecution().getWriteSkipCount(); String chunkStatisticsMessage = "Items read =" + read + ", items written = " + write + ", items skipped = " + skip; if (estimatedTotalNumberOfLines != 0) { int percent = (int) ((read * 100) / estimatedTotalNumberOfLines); logger.info(percent + "% complete: " + chunkStatisticsMessage); } else { logger.info(chunkStatisticsMessage); } }
Source:
protected void endWithFailure() { if (commandCoordinatorUtil.getCommandExecutionStatus(getCommandId()) != CommandExecutionStatus.EXECUTED) { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Unknown); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_OVF_UPDATE_INCOMPLETE); getReturnValue().setEndActionTryAgain(false); setSucceeded(false); } else if (getParameters().isForceMaintenance()) { executeDeactivateCommand(); setSucceeded(true); } else { StoragePoolIsoMap map = loadStoragePoolIsoMap(); changeDomainStatusWithCompensation(map, StorageDomainStatus.Unknown, StorageDomainStatus.Active, getCompensationContext()); getReturnValue().setEndActionTryAgain(false); setSucceeded(false); } }

Target:
protected void endWithFailure() { if (commandCoordinatorUtil.getCommandExecutionStatus(getCommandId()) != CommandExecutionStatus.EXECUTED) { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Unknown); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_OVF_UPDATE_INCOMPLETE); } else if (getParameters().isForceMaintenance()) { executeDeactivateCommand(); } else { changeStorageDomainStatusInTransaction(loadStoragePoolIsoMap(), StorageDomainStatus.Active); auditLogDirector.log(this, AuditLogType.USER_DEACTIVATE_STORAGE_DOMAIN_FAILED); } setSucceeded(true); }
Source:
public void codeMarkdownInMessages() throws Exception { final String alias = "rokit"; final Aliases aliases = new DyBase().user(new URN("urn:test:75065")).aliases(); aliases.add(alias); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Bout bout = inbox.bout(inbox.start()); final String before = " 4 leading spaces retained "; final String after = " 4 leading spaces retained"; bout.messages().post(before); final Iterator<Message> result = bout.messages().search(after).iterator(); MatcherAssert.assertThat( "no matching result found", result.hasNext() ); MatcherAssert.assertThat( result.next().text(), Matchers.equalTo(after) ); }

Target:
public void codeMarkdownInMessages() throws Exception { final String alias = "rokit"; final Aliases aliases = new DyBase().user(new URN("urn:test:75065")).aliases(); aliases.add(alias); final Inbox inbox = aliases.iterate().iterator().next().inbox(); final Bout bout = inbox.bout(inbox.start()); bout.messages().post(" 4 leading spaces retained "); final Iterator<Message> result = bout.messages().iterate().iterator(); MatcherAssert.assertThat( "expected message not found", result.hasNext() ); MatcherAssert.assertThat( result.next().text(), Matchers.equalTo(" 4 leading spaces retained") ); }
Source:
public static <K, V> WriteOnlyManyEntriesCommand<K, V> copy(WriteOnlyManyEntriesCommand<K, V> command, Collection<Object> keys) { WriteOnlyManyEntriesCommand<K, V> copy = new WriteOnlyManyEntriesCommand<>(command); copy.setEntries(filterEntries(command.getEntries(), keys)); return copy; }

Target:
public static <K, V> WriteOnlyManyEntriesCommand<K, V> copy(WriteOnlyManyEntriesCommand<K, V> command, Collection<Object> keys) { return new WriteOnlyManyEntriesCommand<>(command).withEntries(filterEntries(command.getEntries(), keys)); }
Source:
public BitmapDescriptor getCachedMarkerImage(String url, double scale) { Map<Double, BitmapDescriptor> bitmaps = mMarkerImagesCache.get(url); BitmapDescriptor bitmapDescriptor = null; if (bitmaps != null) { bitmapDescriptor = bitmaps.get(scale); } if (bitmapDescriptor == null) { Bitmap bitmap = mBitmapCache.get(url); if (bitmap != null) { bitmapDescriptor = scaleIcon(bitmap, scale); putMarkerImagesCache(url, scale, bitmapDescriptor); } } return bitmapDescriptor; }

Target:
protected BitmapDescriptor getCachedMarkerImage(String url, double scale) { String scaleString = sScaleFormat.format(scale); Map<String, BitmapDescriptor> bitmaps = mImagesCache.markerImagesCache.get(url); BitmapDescriptor bitmapDescriptor = null; if (bitmaps != null) { bitmapDescriptor = bitmaps.get(scaleString); } if (bitmapDescriptor == null) { Bitmap bitmap = mImagesCache.bitmapCache.get(url); if (bitmap != null) { bitmapDescriptor = scaleIcon(bitmap, scale); putMarkerImagesCache(url, scaleString, bitmapDescriptor); } } return bitmapDescriptor; }
Source:
public String getServerApiVersion() throws DockerAccessException { try { String url = urlBuilder.version(); log.verbose(Logger.LogVerboseCategory.API,"GETing %s", url); String response = delegate.get(url, 200); JsonObject info = JsonFactory.newJsonObject(response); return info.get("ApiVersion").getAsString(); } catch (Exception e) { throw new DockerAccessException(e, "Cannot extract API version from server %s", urlBuilder.getBaseUrl()); } }

Target:
public String getServerApiVersion() throws DockerAccessException { try { String url = urlBuilder.version(); log.verbose(Logger.LogVerboseCategory.API,"GET %s", url); String response = delegate.get(url, 200); JsonObject info = JsonFactory.newJsonObject(response); return info.get("ApiVersion").getAsString(); } catch (Exception e) { throw new DockerAccessException(e, "Cannot extract API version from server %s", urlBuilder.getBaseUrl()); } }
Source:
public void progress_of_a_not_started_job_should_be_zero() { view = JobView.of(a(job()), config); assertThat(view.progress(), is(0)); }

Target:
public void progress_of_a_not_started_job_should_be_zero() { view = a(jobView().of(a(job()))); assertThat(view.progress(), is(0)); }
Source:
public Observable<List<String>> getProductTags(final int page) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } return retrofitService .getProductTagPage(appId, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductTagsWrapper, List<ProductTag>>()) .map(new Func1<List<ProductTag>, List<String>>() { @Override public List<String> call(final List<ProductTag> productTags) { if (productTags == null) { return null; } else { final List<String> tags = new ArrayList<>(); for (ProductTag productTag : productTags) { if (!TextUtils.isEmpty(productTag.getHandle())) { tags.add(productTag.getHandle()); } } return tags; } } }) .onErrorResumeNext(new BuyClientExceptionHandler<List<String>>()) .observeOn(callbackScheduler); }

Target:
public Observable<List<String>> getProductTags(final int page) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } return retrofitService .getProductTagPage(appId, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductTagsWrapper, List<ProductTag>>()) .map(unwrapProductTags()) .onErrorResumeNext(new BuyClientExceptionHandler<List<String>>()) .observeOn(callbackScheduler); }
Source:
private Encounter saveRadiologyOrderEncounter(Patient patient, Provider provider, Date encounterDateTime) throws IllegalStateException { try { EncounterTransaction encounterTransaction = setUpEncounterTransaction(patient, encounterDateTime, radiologyProperties.getRadiologyVisitType(), radiologyProperties.getRadiologyOrderEncounterType(), provider, radiologyProperties.getOrderingProviderEncounterRole()); encounterTransaction = emrEncounterService.save(encounterTransaction); return encounterService.saveEncounter(encounterService.getEncounterByUuid(encounterTransaction .getEncounterUuid())); } catch (Exception e) { log.error(e.getMessage(), e); log.error("Unable to save radiology order encounter"); throw new IllegalStateException("Unable to save radiology order encounter"); } }

Target:
private Encounter saveRadiologyOrderEncounter(Patient patient, Provider provider, Date encounterDateTime) { final EncounterTransaction encounterTransaction = new EncounterTransaction(); encounterTransaction.setPatientUuid(patient.getUuid()); final EncounterTransaction.Provider encounterProvider = new EncounterTransaction.Provider(); encounterProvider.setEncounterRoleUuid(radiologyProperties.getRadiologyOrderingProviderEncounterRole() .getUuid()); encounterProvider.setUuid(provider.getUuid()); final Set<EncounterTransaction.Provider> encounterProviderSet = new HashSet<EncounterTransaction.Provider>(); encounterProviderSet.add(encounterProvider); encounterTransaction.setProviders(encounterProviderSet); encounterTransaction.setEncounterDateTime(encounterDateTime); encounterTransaction.setVisitTypeUuid(this.radiologyProperties.getRadiologyVisitType() .getUuid()); encounterTransaction.setEncounterTypeUuid(this.radiologyProperties.getRadiologyOrderEncounterType() .getUuid()); return this.encounterService.getEncounterByUuid(this.emrEncounterService.save(encounterTransaction) .getEncounterUuid()); }
Source:
public double isApplicable(VElement vElement, ViewModelContext viewModelContext) { double highestPriority = Double.MIN_VALUE; EMFFormsDIRendererService<VElement> bestRendererService = null; for (final EMFFormsDIRendererService<VElement> rendererService : diRendererServices) { final double isCurrentApplicable = rendererService.isApplicable(vElement, viewModelContext); if (!Double.isNaN(isCurrentApplicable) && isCurrentApplicable > highestPriority) { highestPriority = isCurrentApplicable; bestRendererService = rendererService; } } if (bestRendererService != null) { return highestPriority; } return NOT_APPLICABLE; }

Target:
public double isApplicable(VElement vElement, ViewModelContext viewModelContext) { double highestPriority = Double.MIN_VALUE; EMFFormsDIRendererService<VElement> bestRendererService = null; final Set<EMFFormsDIRendererService<VElement>> rendererServicesCopy = new LinkedHashSet<EMFFormsDIRendererService<VElement>>( diRendererServices); for (final EMFFormsDIRendererService<VElement> rendererService : rendererServicesCopy) { final double isCurrentApplicable = rendererService.isApplicable(vElement, viewModelContext); if (!Double.isNaN(isCurrentApplicable) && isCurrentApplicable > highestPriority) { highestPriority = isCurrentApplicable; bestRendererService = rendererService; } } if (bestRendererService != null) { return highestPriority; } return NOT_APPLICABLE; }
Source:
public TimestampSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, DateTimeZone hiveStorageTimeZone, boolean outputRequired, LocalMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputRequired; this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nullsAllowed = this.filter == null || this.filter.testNull(); this.baseTimestampInSeconds = new DateTime( 2015, 1, 1, 0, 0, requireNonNull(hiveStorageTimeZone, "hiveStorageTimeZone is null")).getMillis() / 1000; }

Target:
public TimestampSelectiveStreamReader( StreamDescriptor streamDescriptor, Optional<TupleDomainFilter> filter, DateTimeZone hiveStorageTimeZone, boolean outputRequired, LocalMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "streamDescriptor is null"); this.filter = filter.orElse(null); this.outputRequired = outputRequired; this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); this.nonDeterministicFilter = this.filter != null && !this.filter.isDeterministic(); this.nullsAllowed = this.filter == null || nonDeterministicFilter || this.filter.testNull(); this.baseTimestampInSeconds = new DateTime(2015, 1, 1, 0, 0, requireNonNull(hiveStorageTimeZone, "hiveStorageTimeZone is null")).getMillis() / 1000; }
Source:
protected String getJavaCallDeclaration() { return "if (!window.callJava) {\n" + " window.callJava = function callJava(index, token, args) {\n" + " return external.callJava(index,token,args);\n" + " }\n" + "};\n"; }

Target:
String getJavaCallDeclaration() { return "if (!window.callJava) {\n" + " window.callJava = function callJava(index, token, args) {\n" + " return external.callJava(index,token,args);\n" + " }\n" + "};\n"; }
Source:
private SidebarGroup<CheckBox> createFilterGroup() { final CheckBox testingCheck = createCheckBox(tr("Testing"), tr("Also show apps in testing state")); getControl().containTestingApplicationsProperty().bind(testingCheck.selectedProperty()); final CheckBox requiresPatchCheck = createCheckBox(tr("Patch required"), tr("Also show apps, where CD patch is necessary")); getControl().containRequiresPatchApplicationsProperty().bind(requiresPatchCheck.selectedProperty()); final CheckBox commercialCheck = createCheckBox(tr("Commercial"), tr("Also show apps not free of costs")); commercialCheck.setSelected(true); getControl().containCommercialApplicationsProperty().bind(commercialCheck.selectedProperty()); final CheckBox operatingSystemCheck = createCheckBox(tr("All Operating Systems"), tr("Also show apps tested on different OS")); getControl().containAllOSCompatibleApplicationsProperty().bind(operatingSystemCheck.selectedProperty()); return new SidebarGroup<>(tr("Filters"), FXCollections.observableArrayList( testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck)); }

Target:
private SidebarGroup<CheckBox> createFilterGroup() { final CheckBox testingCheck = createCheckBox(tr("Testing")); testingCheck.setTooltip(new Tooltip(tr("Also show apps in testing state"))); getControl().containTestingApplicationsProperty().bind(testingCheck.selectedProperty()); final CheckBox requiresPatchCheck = createCheckBox(tr("Patch required")); requiresPatchCheck.setTooltip(new Tooltip(tr("Also show apps, where CD patch is necessary"))); getControl().containRequiresPatchApplicationsProperty().bind(requiresPatchCheck.selectedProperty()); final CheckBox commercialCheck = createCheckBox(tr("Commercial")); commercialCheck.setTooltip(new Tooltip(tr("Also show apps not free of costs"))); commercialCheck.setSelected(true); getControl().containCommercialApplicationsProperty().bind(commercialCheck.selectedProperty()); final CheckBox operatingSystemCheck = createCheckBox(tr("All Operating Systems")); operatingSystemCheck.setTooltip(new Tooltip(tr("Also show apps tested on different OS"))); getControl().containAllOSCompatibleApplicationsProperty().bind(operatingSystemCheck.selectedProperty()); return new SidebarGroup<>(tr("Filters"), FXCollections.observableArrayList( testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck)); }
Source:
public PianoView(Context context, AttributeSet attributeSet) { super(context, attributeSet); margin = getResources().getDimensionPixelSize(R.dimen.pocketmusic_trackrow_margin); int correspondingMidiValue = NoteName.DEFAULT_NOTE_NAME.getMidi(); for (int i = 0; i < WHITE_KEY_COUNT; i++) { while (NoteName.getNoteNameFromMidiValue(correspondingMidiValue).isSigned()) { correspondingMidiValue++; } TextView whiteButton = new TextView(context); whiteButton.setBackgroundColor(ContextCompat.getColor(context, R.color.solid_white)); whiteButton.setTag(correspondingMidiValue); whiteButton.setText(NoteName.getNoteNameFromMidiValue(correspondingMidiValue).name()); whiteButton.setTextColor(ContextCompat.getColor(context, R.color.solid_black)); whitePianoKeys.add(whiteButton); addView(whiteButton); correspondingMidiValue++; } correspondingMidiValue = NoteName.DEFAULT_NOTE_NAME.getMidi(); for (int i = 0; i < BLACK_KEY_COUNT; i++) { while (!NoteName.getNoteNameFromMidiValue(correspondingMidiValue).isSigned()) { correspondingMidiValue++; } TextView blackButton = new TextView(context); blackButton.setBackgroundColor(ContextCompat.getColor(context, R.color.solid_black)); blackButton.setTag(correspondingMidiValue); blackButton.setText(NoteName.getNoteNameFromMidiValue(correspondingMidiValue).name()); blackButton.setTextColor(ContextCompat.getColor(context, R.color.solid_white)); blackPianoKeys.add(blackButton); addView(blackButton); correspondingMidiValue++; } currentHeight = 0; }

Target:
public PianoView(Context context, AttributeSet attributeSet) { super(context, attributeSet); margin = getResources().getDimensionPixelSize(R.dimen.pocketmusic_trackrow_margin); initializePianoKeys(context); }
Source:
public static FastaSequenceIndex buildFromFasta(final Path fastaFile) throws IOException { try(final AsciiLineReader in = new AsciiLineReader(IOUtil.openFileForReading(fastaFile))) { String previous = in.readLine(); if (previous == null) { throw new SAMException("Cannot index empty file: " + fastaFile); } else if (previous.charAt(0) != '>') { throw new SAMException("Wrong sequence header: " + previous); } int sequenceIndex = -1; long location = in.getPosition(); final FastaSequenceIndex index = new FastaSequenceIndex(); FaiEntryBuilder entry = null; for (String line = in.readLine(); previous != null; line = in.readLine()) { if (previous.charAt(0) == '>') { if (entry != null) { index.add(entry.build()); } sequenceIndex++; entry = new FaiEntryBuilder(sequenceIndex, previous, line, location); } else if (line != null && line.charAt(0) == '>') { location = in.getPosition(); } else if (line != null && !line.isEmpty()) { entry.updateWithSequence(line); } previous = line; } index.add(entry.build()); return index; } }

Target:
public static FastaSequenceIndex buildFromFasta(final Path fastaFile) throws IOException { try(final AsciiLineReader in = new AsciiLineReader(IOUtil.openFileForReading(fastaFile))) { String previous = in.readLine(); if (previous == null) { throw new SAMException("Cannot index empty file: " + fastaFile); } else if (previous.charAt(0) != '>') { throw new SAMException("Wrong sequence header: " + previous); } int sequenceIndex = -1; long location = in.getPosition(); final FastaSequenceIndex index = new FastaSequenceIndex(); FaiEntryBuilder entry = null; for (String line = in.readLine(); previous != null; line = in.readLine()) { if (previous.charAt(0) == '>') { if (entry != null) index.add(entry.build()); entry = new FaiEntryBuilder(sequenceIndex++, previous, line, in.getLineTerminatorLength(), location); } else if (line != null && line.charAt(0) == '>') { location = in.getPosition(); } else if (line != null && !line.isEmpty()) { entry.updateWithSequence(line, in.getLineTerminatorLength()); } previous = line; } index.add(entry.build()); return index; } }