auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public TaskResult validate(Map<String, String> optionsMap) { if (ShellUtils.isAlluxioRunning(mOwner)) { System.out.format("%s is already running. Skip validation.%n", mOwner); return TaskResult.SKIPPED; } int port = NetworkAddressUtils.getPort(mServiceType, InstancedConfiguration.defaults()); if (!isLocalPortAvailable(port)) { System.err.format("%s port %d is not available.%n", mServiceType.getServiceName(), port); return TaskResult.FAILED; } return TaskResult.OK; }

Target:
public TaskResult validate(Map<String, String> optionsMap) { if (ShellUtils.isAlluxioRunning(mOwner)) { System.out.format("%s is already running. Skip validation.%n", mOwner); return TaskResult.SKIPPED; } int port = NetworkAddressUtils.getPort(mServiceType, mConf); if (!isLocalPortAvailable(port)) { System.err.format("%s port %d is not available.%n", mServiceType.getServiceName(), port); return TaskResult.FAILED; } return TaskResult.OK; }
Source:
public VdsStaticDAO getVdsStaticDao() { return DbFacade.getInstance().getVdsStaticDAO(); }

Target:
public VdsStaticDAO getVdsStaticDao() { return getDbFacade().getVdsStaticDAO(); }
Source:
public void testEmailSubject() { String requestingUserName = "John"; String result = buildEmailSubject(Optional.empty(), requestingUserName); String expectedResult = MessageFormat.format("Become my friend on Yona!", requestingUserName); assertThat(result, equalTo(expectedResult)); }

Target:
public void testEmailSubject() { String requestingUserName = "John"; String result = buildEmailSubject(Optional.empty(), requestingUserName); String expectedResult = "Become my friend on Yona!"; assertThat(result, equalTo(expectedResult)); }
Source:
private void awaitStopTask(ConnectorTaskId taskId, long timeout) { try (LoggingContext loggingContext = LoggingContext.forTask(taskId)) { WorkerTask task = tasks.remove(taskId); if (task == null) { log.warn("Ignoring await stop request for non-present task {}", taskId); return; } if (connectorStatusMetricsGroup != null) { connectorStatusMetricsGroup.recordTaskRemoved(taskId); } if (!task.awaitStop(timeout)) { log.error("Graceful stop of task failed.", task.id()); task.cancel(); } else { log.debug("Graceful stop of task succeeded.", task.id()); } } }

Target:
private void awaitStopTask(ConnectorTaskId taskId, long timeout) { try (LoggingContext loggingContext = LoggingContext.forTask(taskId)) { WorkerTask task = tasks.remove(taskId); if (task == null) { log.warn("Ignoring await stop request for non-present task {}", taskId); return; } connectorStatusMetricsGroup.recordTaskRemoved(taskId); if (!task.awaitStop(timeout)) { log.error("Graceful stop of task failed.", task.id()); task.cancel(); } else { log.debug("Graceful stop of task succeeded.", task.id()); } } }
Source:
public static int calcCrc(CRC32 crcAlgo, ByteBuffer buf, int len) { int initLimit = buf.limit(); buf.limit(buf.position() + len); crcAlgo.update(buf); buf.limit(initLimit); return ~(int)crcAlgo.getValue(); }

Target:
private static int calcCrc(CRC32 crcAlgo, ByteBuffer buf, int len) { int initLimit = buf.limit(); buf.limit(buf.position() + len); crcAlgo.update(buf); buf.limit(initLimit); return ~(int)crcAlgo.getValue(); }
Source:
public void select(final int... indices) { waitForEnabled(); if (indices.length > 1) assertMultiSelect(); setFocus(); log.debug(MessageFormat.format("Selecting rows {0} in table {1}", StringUtils.join(indices, ", "), this)); for (int i = 0; i < indices.length; i++) { assertIsLegalRowIndex(indices[i]); } asyncExec(new VoidResult() { public void run() { widget.setSelection(indices); for (int i = 0; i < indices.length; i++) { lastSelectionItem = widget.getItem(indices[i]); notifySelect(); } } }); }

Target:
public void select(final int... indices) { waitForEnabled(); if (indices.length > 1) assertMultiSelect(); setFocus(); log.debug(MessageFormat.format("Selecting rows {0} in table {1}", StringUtils.join(indices, ", "), this)); for (int i = 0; i < indices.length; i++) { assertIsLegalRowIndex(indices[i]); } asyncExec(new VoidResult() { public void run() { for (int i = 0; i < indices.length; i++) { lastSelectionItem = widget.getItem(indices[i]); if (i == 0) { widget.setSelection(indices[0]); notifySelect(false); } else { widget.select(indices[i]); notifySelect(true); } } } }); }
Source:
public PasswordPolicy setResetSuccessEmailStatus(EmailStatus status) { setProperty(RESET_SUCCESS_EMAIL_STATUS, status.name()); return this; }

Target:
public PasswordPolicy setResetSuccessEmailStatus(EmailStatus status) { Assert.notNull(status, "status cannot be null."); setProperty(RESET_SUCCESS_EMAIL_STATUS, status.name()); return this; }
Source:
public static boolean shouldShowSearchTabTooltip() { return getBoolean(R.string.preference_key_pulsating_icon_event_sent, true); }

Target:
public static boolean shouldShowSearchTabTooltip() { return getBoolean(R.string.preference_key_show_search_tab_tooltip, true); }
Source:
public ModelAndView bannerList(@RequestParam(value = "isBank", defaultValue = "true") Boolean isBank) { ModelAndView modelAndView = new ModelAndView(); List<BankDto> bankModelList = null; if (isBank) { bankModelList = bankService.findBankList(null, null); modelAndView.setViewName("/bank-list"); } else { bankModelList = bankService.findUmpBankList(null, null); modelAndView.setViewName("/ump-bank-list"); } modelAndView.addObject("bankList", bankModelList); return modelAndView; }

Target:
public ModelAndView bannerList(@RequestParam(value = "isBank", defaultValue = "true") Boolean isBank) { ModelAndView modelAndView = null; List<BankDto> bankModelList = null; bankModelList = isBank ? bankService.findBankList(null, null) : bankService.findUmpBankList(null, null); modelAndView = isBank ? new ModelAndView("/bank-list") : new ModelAndView("/ump-bank-list"); modelAndView.addObject("bankList", bankModelList); return modelAndView; }
Source:
public ResultSummary consume() { while ( !done ) { connection.receiveOne(); recordBuffer.clear(); } recordBuffer.clear(); return summary; }

Target:
public ResultSummary consume() { if ( done ) { recordBuffer.clear(); } else { do { connection.receiveOne(); recordBuffer.clear(); } while ( !done ); } return summary; }
Source:
private void processRunProperties( boolean isInsidePPr, boolean bold, boolean italics, boolean underline, boolean strike, boolean subscript, boolean superscript, Color color ) throws IOException { if ( bold || italics || underline || strike || subscript || superscript || color != null ) { if ( isInsidePPr ) { startPPrIfNeeded(); } super.write( "<w:rPr>" ); if ( bold ) { super.write( "<w:b />" ); } if ( italics ) { super.write( "<w:i />" ); } if ( underline ) { super.write( "<w:u w:val=\"single\" />" ); } if ( strike ) { super.write( "<w:strike />" ); } if ( subscript ) { super.write( "<w:vertAlign w:val=\"subscript\"/>" ); } if ( superscript ) { super.write( "<w:vertAlign w:val=\"superscript\"/>" ); } if ( color != null ) { super.write( "<w:color w:val=\"" + DocxColorGenerator.parse( color ) + "\"/>" ); } super.write( "</w:rPr>" ); } }

Target:
private void processRunProperties( boolean isInsidePPr, boolean bold, boolean italics, boolean underline, boolean strike, boolean subscript, boolean superscript, Color color ) throws IOException { if ( bold || italics || underline || strike || subscript || superscript || color != null ) { if ( isInsidePPr ) { startPPrIfNeeded(); } super.write( "<w:rPr>" ); if ( bold ) { super.write( "<w:b />" ); } if ( italics ) { super.write( "<w:i />" ); } if ( underline ) { super.write( "<w:u w:val=\"single\" />" ); } if ( strike ) { super.write( "<w:strike />" ); } if ( subscript ) { super.write( "<w:vertAlign w:val=\"subscript\"/>" ); } if ( superscript ) { super.write( "<w:vertAlign w:val=\"superscript\"/>" ); } if ( color != null ) { super.write( "<w:color w:val=\"" + DocxColorGenerator.generate( color ) + "\"/>" ); } super.write( "</w:rPr>" ); } }
Source:
VoltTable getFunctions() { VoltTable results = new VoltTable(FUNCTIONS_SCHEMA); for (Function func : m_database.getFunctions()) { String function_type = func.getMethodname() == null ? "aggregate" : "scalar"; results.addRow( function_type, func.getFunctionname(), func.getClassname(), func.getMethodname()); } return results; }

Target:
VoltTable getFunctions() { VoltTable results = new VoltTable(FUNCTIONS_SCHEMA); for (Function func : m_database.getFunctions()) { String functionType = func.getMethodname() == null ? "aggregate" : "scalar"; results.addRow( functionType, func.getFunctionname(), func.getClassname(), func.getMethodname()); } return results; }
Source:
private long doForceInsertExistingDocumentWithHistory(BasicDocumentRevision newRevision, List<String> revisions, Map<String, Object> attachments) { Log.v(LOG_TAG, "doForceInsertExistingDocumentWithHistory(): Revisions: " + revisions); Preconditions.checkNotNull(newRevision, "New document revision must not be null."); Preconditions.checkArgument(this.containsDocument(newRevision.getId()), "DocumentRevisionTree must exist."); Preconditions.checkNotNull(revisions, "Revision history should not be null."); Preconditions.checkArgument(revisions.size() > 0, "Revision history should have at least one revision." ); DocumentRevisionTree localRevs = getAllRevisionsOfDocument(newRevision.getId()); assert localRevs != null; long sequence; BasicDocumentRevision parent = localRevs.lookup(newRevision.getId(), revisions.get(0)); if(parent == null) { sequence = insertDocumentHistoryToNewTree(newRevision, revisions, localRevs.getCurrentRevision().getInternalNumericId(), localRevs); } else { sequence = insertDocumentHistoryIntoExistingTree(newRevision, revisions, parent.getInternalNumericId(), localRevs, attachments); } return sequence; }

Target:
private long doForceInsertExistingDocumentWithHistory(BasicDocumentRevision newRevision, List<String> revisions, Map<String, Object> attachments) { logger.entering("BasicDatastore", "doForceInsertExistingDocumentWithHistory", new Object[]{newRevision, revisions, attachments}); Preconditions.checkNotNull(newRevision, "New document revision must not be null."); Preconditions.checkArgument(this.containsDocument(newRevision.getId()), "DocumentRevisionTree must exist."); Preconditions.checkNotNull(revisions, "Revision history should not be null."); Preconditions.checkArgument(revisions.size() > 0, "Revision history should have at least one revision." ); DocumentRevisionTree localRevs = getAllRevisionsOfDocument(newRevision.getId()); assert localRevs != null; long sequence; BasicDocumentRevision parent = localRevs.lookup(newRevision.getId(), revisions.get(0)); if(parent == null) { sequence = insertDocumentHistoryToNewTree(newRevision, revisions, localRevs.getDocumentNumericId(), localRevs); } else { sequence = insertDocumentHistoryIntoExistingTree(newRevision, revisions, localRevs.getDocumentNumericId(), localRevs, attachments); } return sequence; }
Source:
public static void executeHelp(String[] args, PrintStream stream) throws Exception { String subCmd = (args.length > 0) ? args[0] : ""; args = AdminUtils.copyArrayCutFirst(args); if(subCmd.equals("async-job")) { AdminCommandAsyncJob.executeHelp(args, stream); } else if(subCmd.equals("cleanup")) { AdminCommandCleanup.executeHelp(args, stream); } else if(subCmd.equals("debug")) { AdminCommandDebug.executeHelp(args, stream); } else if(subCmd.equals("meta")) { AdminCommandMeta.executeHelp(args, stream); } else if(subCmd.equals("quota")) { AdminCommandQuota.executeHelp(args, stream); } else if(subCmd.equals("store")) { AdminCommandStore.executeHelp(args, stream); } else if(subCmd.equals("stream")) { AdminCommandStream.executeHelp(args, stream); } else if(subCmd.equals("native-backup")) { SubCommandNativeBackup.printHelp(stream); } else if(subCmd.equals("restore-from-replica")) { SubCommandRestoreFromReplica.printHelp(stream); } else { printHelp(stream); } }

Target:
public static void executeHelp(String[] args, PrintStream stream) throws Exception { String subCmd = (args.length > 0) ? args[0] : ""; args = AdminUtils.copyArrayCutFirst(args); if(subCmd.equals("async-job")) { AdminCommandAsyncJob.executeHelp(args, stream); } else if(subCmd.equals("cleanup")) { AdminCommandCleanup.executeHelp(args, stream); } else if(subCmd.equals("debug")) { AdminCommandDebug.executeHelp(args, stream); } else if(subCmd.equals("meta")) { AdminCommandMeta.executeHelp(args, stream); } else if(subCmd.equals("quota")) { AdminCommandQuota.executeHelp(args, stream); } else if(subCmd.equals("store")) { AdminCommandStore.executeHelp(args, stream); } else if(subCmd.equals("stream")) { AdminCommandStream.executeHelp(args, stream); } else { args = AdminUtils.copyArrayAddFirst(args, subCmd); AdminCommandOther.executeHelp(args, stream); } }
Source:
public void testSimple() { final Id id1 = new Id("some_scheme", "id1"); final Id id2 = new Id("some_scheme", "id2"); final RuleBasedZooKeeperAclProvider aclProvider = RuleBasedZooKeeperAclProvider.builder() .rule("/foo/baz", DELETE, id1) .rule("/foo/bar", CREATE, id1) .rule("/foo/qux", READ | WRITE, id2) .build(); assertEquals( Arrays.asList(new ACL(DELETE, id1)), aclProvider.getAclForPath("/foo/baz")); assertEquals( Arrays.asList(new ACL(CREATE, id1)), aclProvider.getAclForPath("/foo/bar")); assertEquals( Arrays.asList(new ACL(READ | WRITE, id2)), aclProvider.getAclForPath("/foo/qux")); }

Target:
public void testSimple() { final Id id1 = new Id("some_scheme", "id1"); final Id id2 = new Id("some_scheme", "id2"); final RuleBasedZooKeeperAclProvider aclProvider = RuleBasedZooKeeperAclProvider.builder() .rule("/foo/baz", DELETE, id1) .rule("/foo/bar", CREATE, id1) .rule("/foo/qux", READ | WRITE, id2) .build(); assertThat(aclProvider.getAclForPath("/foo/baz"), contains(new ACL(DELETE, id1))); assertThat(aclProvider.getAclForPath("/foo/bar"), contains(new ACL(CREATE, id1))); assertThat(aclProvider.getAclForPath("/foo/qux"), contains(new ACL(READ | WRITE, id2))); }
Source:
private Union getUnion(ByteBuffer buf, int position) { Union union = unions.get(buf) != null ? unions.get(buf).get(position) : null; if (union == null) { union = createNewUnion(buf, position, true); } return union; }

Target:
private Union getUnion(ByteBuffer buf, int position) { Int2ObjectMap<Union> unionMap = unions.get(buf); Union union = unionMap != null ? unionMap.get(position) : null; if (union != null) { return union; } return createNewUnion(buf, position, true); }
Source:
public static CompressedVSizeIndexedV3Writer create( final IOPeon ioPeon, final String filenameBase, final int maxValue, final CompressedObjectStrategy.CompressionStrategy compression ) { return new CompressedVSizeIndexedV3Writer( new CompressedIntsIndexedWriter( ioPeon, StringUtils.safeFormat("%s.offsets", filenameBase), CompressedIntsIndexedSupplier.MAX_INTS_IN_BUFFER, IndexIO.BYTE_ORDER, compression ), new CompressedVSizeIntsIndexedWriter( ioPeon, StringUtils.safeFormat("%s.values", filenameBase), maxValue, CompressedVSizeIntsIndexedSupplier.maxIntsInBufferForValue(maxValue), IndexIO.BYTE_ORDER, compression ) ); }

Target:
public static CompressedVSizeIndexedV3Writer create( final IOPeon ioPeon, final String filenameBase, final int maxValue, final CompressedObjectStrategy.CompressionStrategy compression ) { return new CompressedVSizeIndexedV3Writer( new CompressedIntsIndexedWriter( ioPeon, StringUtils.format("%s.offsets", filenameBase), CompressedIntsIndexedSupplier.MAX_INTS_IN_BUFFER, IndexIO.BYTE_ORDER, compression ), new CompressedVSizeIntsIndexedWriter( ioPeon, StringUtils.format("%s.values", filenameBase), maxValue, CompressedVSizeIntsIndexedSupplier.maxIntsInBufferForValue(maxValue), IndexIO.BYTE_ORDER, compression ) ); }
Source:
private Set<Guid> findNonResponsiveHosts(List<VDS> hosts) { final Set<Guid> nonResponsiveHosts = new HashSet<>(); for (VDS host : hosts) { if (host.getStatus() == VDSStatus.NonResponsive) { nonResponsiveHosts.add(host.getId()); } if ((host.getStatus() == VDSStatus.Down || host.getStatus() == VDSStatus.Reboot) && host.isInFenceFlow()) { host.setStatus(VDSStatus.NonResponsive); nonResponsiveHosts.add(host.getId()); } } return nonResponsiveHosts; }

Target:
private Set<Guid> findNonResponsiveHosts(List<VDS> hosts) { final Set<Guid> nonResponsiveHosts = new HashSet<>(); for (VDS host : hosts) { if (host.getStatus() == VDSStatus.NonResponsive) { nonResponsiveHosts.add(host.getId()); } if (host.isInFenceFlow() && (host.getStatus() == VDSStatus.Down || host.getStatus() == VDSStatus.Reboot)) { host.setStatus(VDSStatus.NonResponsive); nonResponsiveHosts.add(host.getId()); } } return nonResponsiveHosts; }
Source:
public Cache.Entry<K, ValueHolder<V>> next() throws CacheAccessException { if (next == null) { throw new NoSuchElementException(); } final Map.Entry<K, OffHeapValueHolder<V>> thisEntry = next; advance(); final K key = thisEntry.getKey(); backingMap().computeIfPresent(key, new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { @Override public OffHeapValueHolder<V> apply(final K k, final OffHeapValueHolder<V> currentMapping) { if (currentMapping.getId() == thisEntry.getValue().getId()) { setAccessTimeAndExpiry(key, currentMapping, timeSource.getTimeMillis()); } return currentMapping; } }); return new Cache.Entry<K, ValueHolder<V>>() { @Override public K getKey() { return thisEntry.getKey(); } @Override public ValueHolder<V> getValue() { return thisEntry.getValue(); } @Override public long getCreationTime(TimeUnit unit) { return thisEntry.getValue().creationTime(unit); } @Override public long getLastAccessTime(TimeUnit unit) { return thisEntry.getValue().lastAccessTime(unit); } @Override public float getHitRate(TimeUnit unit) { final long now = timeSource.getTimeMillis(); return thisEntry.getValue().hitRate(now, unit); } }; }

Target:
public Cache.Entry<K, ValueHolder<V>> next() throws CacheAccessException { if (next == null) { throw new NoSuchElementException(); } final Map.Entry<K, OffHeapValueHolder<V>> thisEntry = next; advance(); final long now = timeSource.getTimeMillis(); backingMap().computeIfPresent(thisEntry.getKey(), new BiFunction<K, OffHeapValueHolder<V>, OffHeapValueHolder<V>>() { @Override public OffHeapValueHolder<V> apply(final K k, final OffHeapValueHolder<V> currentMapping) { if (currentMapping.getId() == thisEntry.getValue().getId()) { setAccessTimeAndExpiry(k, currentMapping, now); } return currentMapping; } }); thisEntry.getValue().accessed(now, expiry.getExpiryForAccess(thisEntry.getKey(), thisEntry.getValue().value())); return new Cache.Entry<K, ValueHolder<V>>() { @Override public K getKey() { return thisEntry.getKey(); } @Override public ValueHolder<V> getValue() { return thisEntry.getValue(); } @Override public long getCreationTime(TimeUnit unit) { return thisEntry.getValue().creationTime(unit); } @Override public long getLastAccessTime(TimeUnit unit) { return thisEntry.getValue().lastAccessTime(unit); } @Override public float getHitRate(TimeUnit unit) { final long now = timeSource.getTimeMillis(); return thisEntry.getValue().hitRate(now, unit); } }; }
Source:
public Single<PageBlobGetPageRangesDiffResponse> getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Context context) { blobRange = blobRange == null ? new BlobRange() : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; context = context == null ? Context.NONE : context; if (prevSnapshot == null) { throw new IllegalArgumentException("prevSnapshot cannot be null."); } return postProcessResponse(this.storageClient.generatedPageBlobs().getPageRangesDiffWithRestResponseAsync( context, null, null, prevSnapshot, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions())); }

Target:
public Single<PageBlobGetPageRangesDiffResponse> getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Context context) { blobRange = blobRange == null ? new BlobRange() : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; context = context == null ? Context.NONE : context; if (prevSnapshot == null) { throw new IllegalArgumentException("prevSnapshot cannot be null"); } return postProcessResponse(this.storageClient.generatedPageBlobs().getPageRangesDiffWithRestResponseAsync( context, null, null, prevSnapshot, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions())); }
Source:
public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<String>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.subscription(friend.alias())) { continue; } this.tryEmail(friend, text, failed); } this.checkForFailures(failed); }

Target:
public void post(final String text) throws IOException { this.origin.post(text); final Collection<String> failed = new ArrayList<String>(16); for (final Friend friend : this.bout.friends().iterate()) { if (friend.email().isEmpty() || friend.alias().equals(this.self) || !this.bout.subscription(friend.alias())) { continue; } try { this.courier.email(friend, text); } catch (final IOException exception) { failed.add(friend.alias()); } } if (!failed.isEmpty()) { final String message = String.format( "Sorry, we were not able to send the notification email to %s.", Joiner.on(", ").join(failed) ); throw new RsFailure(new EmailDeliveryException(message)); } }
Source:
public void initialize() throws APIManagerIntegrationTestException, XPathExpressionException, MalformedURLException, ApiException { super.init(); apiEndPointUrl = backEndServerUrl.getWebAppURLHttp() + API_END_POINT_POSTFIX_URL; providerName = user.getUserName(); apiCreationRequestBean = new APICreationRequestBean(API_NAME, API_CONTEXT, API_VERSION_1_0_0, providerName, new URL(apiEndPointUrl)); apiCreationRequestBean.setTags(API_TAGS); apiCreationRequestBean.setDescription(API_DESCRIPTION); String publisherURLHttp = publisherUrls.getWebAppURLHttp(); String storeURLHttp = storeUrls.getWebAppURLHttp(); apiIdentifier = new APIIdentifier(providerName, API_NAME, API_VERSION_1_0_0); ApplicationDTO applicationDTO = restAPIStore.addApplication(APPLICATION_NAME, APIMIntegrationConstants.RESOURCE_TIER.UNLIMITED, "", ""); applicationId = applicationDTO.getApplicationId(); ArrayList grantTypes = new ArrayList(); grantTypes.add("client_credentials"); grantTypes.add("password"); ApplicationKeyDTO applicationKeyDTO = restAPIStore.generateKeys(applicationId, "3600", null, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, null, grantTypes); consumerKey = applicationKeyDTO.getConsumerKey(); consumerSecret = applicationKeyDTO.getConsumerSecret(); }

Target:
public void initialize() throws APIManagerIntegrationTestException, XPathExpressionException, MalformedURLException, ApiException { super.init(); apiEndPointUrl = backEndServerUrl.getWebAppURLHttp() + API_END_POINT_POSTFIX_URL; providerName = user.getUserName(); apiCreationRequestBean = new APICreationRequestBean(API_NAME, API_CONTEXT, API_VERSION_1_0_0, providerName, new URL(apiEndPointUrl)); apiCreationRequestBean.setTags(API_TAGS); apiCreationRequestBean.setDescription(API_DESCRIPTION); String publisherURLHttp = publisherUrls.getWebAppURLHttp(); String storeURLHttp = storeUrls.getWebAppURLHttp(); apiIdentifier = new APIIdentifier(providerName, API_NAME, API_VERSION_1_0_0); ApplicationDTO applicationDTO = restAPIStore.addApplication(APPLICATION_NAME, APIMIntegrationConstants.RESOURCE_TIER.UNLIMITED, "", ""); applicationId = applicationDTO.getApplicationId(); ArrayList grantTypes = new ArrayList(); grantTypes.add(APIMIntegrationConstants.GRANT_TYPE.CLIENT_CREDENTIAL); grantTypes.add(APIMIntegrationConstants.GRANT_TYPE.PASSWORD); ApplicationKeyDTO applicationKeyDTO = restAPIStore.generateKeys(applicationId, "3600", null, ApplicationKeyGenerateRequestDTO.KeyTypeEnum.PRODUCTION, null, grantTypes); consumerKey = applicationKeyDTO.getConsumerKey(); consumerSecret = applicationKeyDTO.getConsumerSecret(); }
Source:
void record(String serviceName, String hostname, int port, int statusCode, long micros) { try { hostMetrics.getUnchecked( ImmutableServiceHostAndPort.of(serviceName, hostname, port)).record(statusCode, micros); } catch (Exception e) { log.warn("Unable to record metrics for host and url", UnsafeArg.of("hostname", hostname), UnsafeArg.of("url", port)); } }

Target:
void record(String serviceName, String hostname, int port, int statusCode, long micros) { try { hostMetrics.getUnchecked( ImmutableServiceHostAndPort.of(serviceName, hostname, port)).record(statusCode, micros); } catch (Exception e) { log.warn("Unable to record metrics for host and port", UnsafeArg.of("hostname", hostname), SafeArg.of("port", port)); } }
Source:
private void updateAudioDeviceState(boolean hasWiredHeadset) { if (hasWiredHeadset) { audioDevices.add(AudioDevice.WIRED_HEADSET); } else { audioDevices.add(AudioDevice.SPEAKER_PHONE); if (hasEarpiece()) { audioDevices.add(AudioDevice.EARPIECE); } } RCLogger.d(TAG, "audioDevices: " + audioDevices); if (hasWiredHeadset) { setAudioDevice(AudioDevice.WIRED_HEADSET); } else { setAudioDevice(defaultAudioDevice); } }

Target:
private void updateAudioDeviceState(boolean hasWiredHeadset) { audioDevices.clear(); if (hasWiredHeadset) { audioDevices.add(AudioDevice.WIRED_HEADSET); } else { audioDevices.add(AudioDevice.SPEAKER_PHONE); if (hasEarpiece()) { audioDevices.add(AudioDevice.EARPIECE); } } RCLogger.d(TAG, "audioDevices: " + audioDevices); if (hasWiredHeadset) { setAudioDevice(AudioDevice.WIRED_HEADSET); } else { setAudioDevice(defaultAudioDevice); } }
Source:
public void testCodeReview() { IGerritHudsonTriggerConfig config = Setup.createConfig(); ParameterExpander instance = new ParameterExpander(config); Integer result = instance.getMinimumCodeReviewValue(parameter.memoryImprint, true); if (parameter.expectedCodeReview == null) { assertEquals(null, result); } else { assertEquals(Integer.valueOf(parameter.expectedCodeReview), result); } }

Target:
public void testCodeReview() { IGerritHudsonTriggerConfig config = Setup.createConfig(); ParameterExpander instance = new ParameterExpander(config); Integer result = instance.getMinimumCodeReviewValue(parameter.memoryImprint, true); if (parameter.expectedCodeReview == null) { assertNull(result); } else { assertEquals(Integer.valueOf(parameter.expectedCodeReview), result); } }
Source:
public void testLoadFilters() { processDefinitionListBasicFiltersPresenter.loadFilters(); final InOrder inOrder = inOrder(getView()); inOrder.verify(getView()).addTextFilter(eq(Constants.INSTANCE.Process_Definition_Name()), eq(Constants.INSTANCE.Default_Process_Definition_Name()), eq(true), any()); }

Target:
public void testLoadFilters() { processDefinitionListBasicFiltersPresenter.loadFilters(); verify(getView()).addTextFilter(eq(Constants.INSTANCE.Name()), eq(Constants.INSTANCE.Default_Process_Definition_Name()), eq(true), any()); }
Source:
public void validate_shouldPassIfTheDuplicateNameIsForATermFromSameConceptSourceButRetired() throws Exception { ConceptReferenceTerm term = new ConceptReferenceTerm(); term.setName("retired name"); term.setCode("retired code"); term.setConceptSource(Context.getConceptService().getConceptSource(1)); Errors errors = new BindException(term, "term"); new ConceptReferenceTermValidator().validate(term, errors); Assert.assertEquals(false, errors.hasErrors()); }

Target:
public void validate_shouldPassIfTheDuplicateNameIsForATermFromSameConceptSourceButRetired() throws Exception { ConceptService cs = Context.getConceptService(); ConceptSource source = Context.getConceptService().getConceptSource(1); ConceptReferenceTerm retiredTerm = cs.getConceptReferenceTermByName("retired name", source); Assert.assertTrue(retiredTerm.isRetired()); ConceptReferenceTerm term = new ConceptReferenceTerm(); term.setName("retired name"); term.setCode("retired code"); term.setConceptSource(source); Errors errors = new BindException(term, "term"); new ConceptReferenceTermValidator().validate(term, errors); Assert.assertEquals(false, errors.hasErrors()); }
Source:
private static SecretKey generateEncryptionKey() throws NoSuchAlgorithmException { KeyGenerator keygen = KeyGenerator.getInstance("AES"); keygen.init(128); SecretKey secretKey = keygen.generateKey(); return secretKey; }

Target:
private static SecretKey generateEncryptionKey() throws NoSuchAlgorithmException { KeyGenerator keygen = KeyGenerator.getInstance(ENCRYPTION_ALGO); keygen.init(ENCRYPTION_KEY_SIZE_BITS); SecretKey secretKey = keygen.generateKey(); return secretKey; }
Source:
public List<ArtifactEntry> findMatching(ArtifactEntrySearchCriteria searchCriteria, PagingCriteria pagingCriteria) { StringBuilder sb = new StringBuilder(); sb.append("SELECT FROM ").append(getEntityClass().getSimpleName()); Map<String, Object> parameterMap = Collections.emptyMap(); if (!searchCriteria.isEmpty()) { StringBuilder criteriaQueryClasuse = new StringBuilder(); sb.append(" WHERE "); parameterMap = new HashMap<>(); if (searchCriteria.getMinSizeInBytes() != null && searchCriteria.getMinSizeInBytes() > 0) { criteriaQueryClasuse.append(" sizeInBytes >= :minSizeInBytes "); parameterMap.put("minSizeInBytes", searchCriteria.getMinSizeInBytes()); } if (searchCriteria.getUselessnessDays() != null && searchCriteria.getUselessnessDays() > 0) { if (criteriaQueryClasuse.length() > 0) { criteriaQueryClasuse.append(" AND "); } Date lastUsed = DateUtils.addDays(new Date(), -searchCriteria.getUselessnessDays()); criteriaQueryClasuse.append(" lastUsed < :lastUsed "); parameterMap.put("lastUsed", lastUsed); } sb.append(criteriaQueryClasuse); } appendPagingCriteria(sb, pagingCriteria); logger.debug("Executing SQL query> " + sb.toString()); OSQLSynchQuery<ArtifactEntry> oQuery = new OSQLSynchQuery<>(sb.toString()); return getDelegate().command(oQuery).execute(parameterMap); }

Target:
public List<ArtifactEntry> findMatching(ArtifactEntrySearchCriteria searchCriteria, PagingCriteria pagingCriteria) { StringBuilder sb = new StringBuilder(); sb.append("SELECT FROM ").append(getEntityClass().getSimpleName()); Map<String, Object> parameterMap = Collections.emptyMap(); if (!searchCriteria.isEmpty()) { StringBuilder criteriaQueryClasuse = new StringBuilder(); sb.append(" WHERE "); parameterMap = new HashMap<>(); if (searchCriteria.getMinSizeInBytes() != null && searchCriteria.getMinSizeInBytes() > 0) { criteriaQueryClasuse.append(" sizeInBytes >= :minSizeInBytes "); parameterMap.put("minSizeInBytes", searchCriteria.getMinSizeInBytes()); } if (searchCriteria.getLastAccessedTimeInDays() != null && searchCriteria.getLastAccessedTimeInDays() > 0) { if (criteriaQueryClasuse.length() > 0) { criteriaQueryClasuse.append(" AND "); } Date lastUsed = DateUtils.addDays(new Date(), -searchCriteria.getLastAccessedTimeInDays()); criteriaQueryClasuse.append(" lastUsed < :lastUsed "); parameterMap.put("lastUsed", lastUsed); } sb.append(criteriaQueryClasuse); } appendPagingCriteria(sb, pagingCriteria); logger.debug("Executing SQL query> " + sb.toString()); OSQLSynchQuery<ArtifactEntry> oQuery = new OSQLSynchQuery<>(sb.toString()); return getDelegate().command(oQuery).execute(parameterMap); }
Source:
private void checkAutomaticProcessors(ILogEvent event) { for (IProcessorDescriptor descriptor : descriptors) { if (Processors.shouldProcess(descriptor, event) && descriptor.isAutomaticActivation()) { EList<IReportProcessor> enabledProcessors = event.getOptions().getEnabledProcessors(); IReportProcessor processor = descriptor.getProcessor(); if (!enabledProcessors.contains(processor)) { enabledProcessors.add(processor); } processor.analyze(event.getStatus(), event.getContext()); } } }

Target:
private void checkAutomaticProcessors(ILogEvent event) { for (IProcessorDescriptor descriptor : descriptors) { if (descriptor.isAutomatic() && Processors.shouldProcess(descriptor, event)) { EList<IReportProcessor> enabledProcessors = event.getOptions().getEnabledProcessors(); IReportProcessor processor = descriptor.getProcessor(); if (!enabledProcessors.contains(processor)) { enabledProcessors.add(processor); } processor.analyze(event.getStatus(), event.getContext()); } } }
Source:
public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = Collections.emptyMap(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); String content = blobs.get(0).getString(); assertTrue(content.contains("<li><a href=\"hello.xml\">hello.xml</a></li>") && content.contains("<li><a href=\"hello.txt\">hello.txt</a></li>")); content = DocumentUTUtils.readContent(blobs.get(1).getFile()); assertTrue(content.contains("Hello from a xml <b>document</b>")); content = DocumentUTUtils.readContent(blobs.get(2).getFile()); assertTrue(content.contains("Hello from a text document")); }

Target:
public void testConvertToMimeType(String mimeType) throws IOException { String converterName = cs.getConverterName(mimeType, "text/html"); assertEquals("zip2html", converterName); checkConverterAvailability(converterName); BlobHolder htmlBH = getBlobFromPath("test-docs/hello.zip"); htmlBH.getBlob().setMimeType(mimeType); Map<String, Serializable> parameters = Collections.emptyMap(); BlobHolder result = cs.convert(converterName, htmlBH, parameters); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertNotNull(blobs); assertEquals(3, blobs.size()); String content = blobs.get(0).getString(); assertTrue(content, content.contains("<li><a href=\"hello.xml\">hello.xml</a></li>")); assertTrue(content, content.contains("<li><a href=\"hello.txt\">hello.txt</a></li>")); content = DocumentUTUtils.readContent(blobs.get(1).getFile()); assertTrue(content, content.contains("Hello from a xml <b>document</b>")); content = DocumentUTUtils.readContent(blobs.get(2).getFile()); assertTrue(content, content.contains("Hello from a text document")); }
Source:
public Subscription getSubscription(final String owningApplication, final Set<String> eventTypes, final String consumerGroup) throws NoSuchSubscriptionException, InternalNakadiException, ServiceUnavailableException { final String sql = "SELECT s_subscription_object FROM zn_data.subscription " + "WHERE s_subscription_object->>'owning_application' = ? " + "AND replace(s_subscription_object->>'event_types', ' ', '') = ? " + "AND s_subscription_object->>'consumer_group' = ? "; try { final String eventTypesJson = jsonMapper.writer().writeValueAsString(newTreeSet(eventTypes)); return jdbcTemplate.queryForObject(sql, new Object[]{owningApplication, eventTypesJson, consumerGroup}, rowMapper); } catch (final JsonProcessingException e) { throw new InternalNakadiException("Serialization problem during getting event type", e); } catch (final EmptyResultDataAccessException e) { throw new NoSuchSubscriptionException("Subscription does not exist", e); } catch (final DataAccessException e) { throw new ServiceUnavailableException("Error occurred when running database request", e); } }

Target:
public Subscription getSubscription(final String owningApplication, final Set<String> eventTypes, final String consumerGroup) throws NoSuchSubscriptionException, InternalNakadiException, ServiceUnavailableException { final String sql = "SELECT s_subscription_object FROM zn_data.subscription " + "WHERE s_subscription_object->>'owning_application' = ? " + "AND replace(s_subscription_object->>'event_types', ' ', '') = ? " + "AND s_subscription_object->>'consumer_group' = ? "; try { final String eventTypesJson = jsonMapper.writer().writeValueAsString(newTreeSet(eventTypes)); return jdbcTemplate.queryForObject(sql, new Object[]{owningApplication, eventTypesJson, consumerGroup}, rowMapper); } catch (final JsonProcessingException e) { throw new InternalNakadiException("Serialization problem during getting event type", e); } catch (final EmptyResultDataAccessException e) { throw new NoSuchSubscriptionException("Subscription does not exist", e); } catch (final DataAccessException e) { LOG.error("Database error when getting subscription by key properties", e); throw new ServiceUnavailableException("Error occurred when running database request"); } }
Source:
private boolean shouldUpdateCache(Optional<ActivityDto> lastRegisteredActivity, Activity newOrUpdatedActivity) { if (!lastRegisteredActivity.isPresent()) { return true; } return !newOrUpdatedActivity.getEndTime().atZone(newOrUpdatedActivity.getTimeZone()) .isBefore(lastRegisteredActivity.get().getEndTime()); }

Target:
private boolean shouldUpdateCache(Optional<ActivityDto> lastRegisteredActivity, Activity newOrUpdatedActivity) { if (!lastRegisteredActivity.isPresent()) { return true; } return !newOrUpdatedActivity.getEndTimeAsZonedDateTime().isBefore(lastRegisteredActivity.get().getEndTime()); }
Source:
private String buildCanonicalResourceIdentifier(URI uri, SpiderResourceFound resourceFound) throws URIException { StringBuilder identifierBuilder = new StringBuilder(50); if (resourceFound != null) { String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation( uri, spider.getSpiderParam().getHandleParameters(), spider.getSpiderParam().isHandleODataParametersVisited()); identifierBuilder.append(resourceFound.getMethod()); identifierBuilder.append(" "); identifierBuilder.append(visitedURI); identifierBuilder.append("\n"); String canonicalHeaderRepresentation = getCanonicalHeadersString(resourceFound.getRequestHeaders()); identifierBuilder.append("\n"); identifierBuilder.append(resourceFound.getBody()); } return identifierBuilder.toString(); }

Target:
private String buildCanonicalResourceIdentifier(URI uri, SpiderResourceFound resourceFound) throws URIException { StringBuilder identifierBuilder = new StringBuilder(50); String visitedURI = URLCanonicalizer.buildCleanedParametersURIRepresentation( uri, spider.getSpiderParam().getHandleParameters(), spider.getSpiderParam().isHandleODataParametersVisited()); identifierBuilder.append(resourceFound.getMethod()); identifierBuilder.append(" "); identifierBuilder.append(visitedURI); identifierBuilder.append("\n"); String canonicalHeaderRepresentation = getCanonicalHeadersString(resourceFound.getRequestHeaders()); identifierBuilder.append("\n"); identifierBuilder.append(resourceFound.getBody()); return identifierBuilder.toString(); }
Source:
public byte[] resultToBinary(Map<String, R> result) { Aggregation<P, R, T> agg = this.result.values().stream().findAny().orElse(null); if (agg == null) { return new byte[0]; } Map<String, byte[]> mapped = result.entrySet().stream().collect( Collectors.toMap(Map.Entry::getKey, e -> agg.resultToBinary(e.getValue()))); int totalDataSize = mapped.entrySet().stream().map(e -> 8 + e.getKey().length() + e.getValue().length).reduce( 0, Integer::sum); ByteBuffer bb = ByteBuffer.allocate(4 + totalDataSize); bb.putInt(mapped.size()); mapped.forEach( (k, v) -> bb.putInt(k.length()).put(StringUtils.stringToBinary(k)).putInt(v.length).put(v)); return bb.array(); }

Target:
public byte[] resultToBinary(Map<String, R> result) { final Aggregation<P, R, T> agg = this.getHelperAggregation(); Map<String, byte[]> mapped = result.entrySet().stream().collect( Collectors.toMap(Map.Entry::getKey, e -> agg.resultToBinary(e.getValue()))); int totalDataSize = mapped.entrySet().stream().map(e -> 8 + e.getKey().length() + e.getValue().length).reduce( 0, Integer::sum); ByteBuffer bb = ByteBuffer.allocate(4 + totalDataSize); bb.putInt(mapped.size()); mapped.forEach( (k, v) -> bb.putInt(k.length()).put(StringUtils.stringToBinary(k)).putInt(v.length).put(v)); return bb.array(); }
Source:
public void sendEvent(Event event) { if (log.isDebugEnabled()) { log.debug("Sending event: " + event); } try { ClientMessage message = getClientSession().createMessage(true); String eventString = mapper.writeValueAsString(event); message.getBodyBuffer().writeString(eventString); getClientProducer().send(message); } catch (Exception e) { log.error("Error while trying to send event: " + event, e); } }

Target:
public void sendEvent(Event event) { log.debug("Sending event: " + event); try { ClientMessage message = getClientSession().createMessage(true); String eventString = mapper.writeValueAsString(event); message.getBodyBuffer().writeString(eventString); getClientProducer().send(message); } catch (Exception e) { log.error("Error while trying to send event: " + event, e); } }
Source:
public void testMethodNotFound() throws Exception { Map<String, Object> req = request(7, "not-found", null); assertError(onMessage(rpc, req), JsonRpc.METHOD_NOT_FOUND); }

Target:
public void testMethodNotFound() throws Exception { String message = "{\"method\":\"not-found\",\"id\":0,\"jsonrpc\":\"2.0\",\"params\":null}"; assertError(onMessage(rpc, message), JsonRpc.METHOD_NOT_FOUND); }
Source:
public void migrate(DiagnosisMetadata diagnosisMetadata) { EmrVisitService emrVisitService = Context.getService(EmrVisitService.class); DiagnosisService oldDiagnosisService = new DiagnosisServiceImpl(); ((DiagnosisServiceImpl)oldDiagnosisService).setEncounterService(Context.getEncounterService()); ((DiagnosisServiceImpl)oldDiagnosisService).setObsService(Context.getObsService()); ((DiagnosisServiceImpl)oldDiagnosisService).setEmrApiProperties(Context.getRegisteredComponent("emrApiProperties", EmrApiProperties.class)); org.openmrs.api.DiagnosisService newDiagnosisService = Context.getService(org.openmrs.api.DiagnosisService.class); List<Diagnosis> allEmrapiDiagnosis = new ArrayList<Diagnosis>(); List<Integer> patientsIds = emrVisitService.getAllPatientsWithDiagnosis(diagnosisMetadata); for (int id : patientsIds) { Patient patient = Context.getPatientService().getPatient(id); allEmrapiDiagnosis.addAll(oldDiagnosisService.getDiagnoses(patient, null)); } List<org.openmrs.Diagnosis> diagnoses = convert(allEmrapiDiagnosis); for (org.openmrs.Diagnosis diagnosis : diagnoses) { newDiagnosisService.save(diagnosis); } }

Target:
public Boolean migrate(DiagnosisMetadata diagnosisMetadata) { Boolean migratedAtleastOneEncounterDiagosis = false; EmrVisitService emrVisitService = Context.getService(EmrVisitService.class); DiagnosisService oldDiagnosisService = new DiagnosisServiceImpl(); ((DiagnosisServiceImpl)oldDiagnosisService).setEncounterService(Context.getEncounterService()); ((DiagnosisServiceImpl)oldDiagnosisService).setObsService(Context.getObsService()); ((DiagnosisServiceImpl)oldDiagnosisService).setEmrApiProperties(Context.getRegisteredComponent("emrApiProperties", EmrApiProperties.class)); org.openmrs.api.DiagnosisService newDiagnosisService = Context.getService(org.openmrs.api.DiagnosisService.class); List<Integer> patientsIds = emrVisitService.getAllPatientsWithDiagnosis(diagnosisMetadata); for (int id : patientsIds) { Patient patient = Context.getPatientService().getPatient(id); List<org.openmrs.Diagnosis> diagnoses = convert(oldDiagnosisService.getDiagnoses(patient, null)); for (org.openmrs.Diagnosis diagnosis : diagnoses) { newDiagnosisService.save(diagnosis); migratedAtleastOneEncounterDiagosis = true; } } return migratedAtleastOneEncounterDiagosis; }
Source:
public String[] getPartitionsFor(final String eventTypeName) throws ServiceUnavailableException { try { String[] partitions = partitionsPerEventType.get(eventTypeName); if (partitions == null) { partitions = kafkaFactory.createProducer().partitionsFor(eventTypeName) .stream() .map(partitionInfo -> String.valueOf(partitionInfo.partition())) .toArray(n -> new String[n]); partitionsPerEventType.put(eventTypeName, partitions); } return partitions; } catch (final KafkaException e) { throw new ServiceUnavailableException("Could not get partition information about '" + eventTypeName + "'", e); } }

Target:
public String[] getPartitionsFor(final String eventTypeName) throws NakadiException { String[] partitions = partitionsPerEventType.get(eventTypeName); if (partitions == null) { partitions = topicRepository.listPartitionNames(eventTypeName); partitionsPerEventType.put(eventTypeName, partitions); } return partitions; }
Source:
public GhprbGitHubAuth getGitHubApiAuth() { if (gitHubAuthId == null) { GhprbGitHubAuth auth = getDescriptor().getGithubAuth().get(0); gitHubAuthId = auth.getId(); getDescriptor().save(); return auth; } return getDescriptor().getGitHubAuth(gitHubAuthId); }

Target:
public GhprbGitHubAuth getGitHubApiAuth() { GhprbGitHubAuth auth = getDescriptor().getGitHubAuth(gitHubAuthId); if (gitHubAuthId == null && auth != null) { gitHubAuthId = auth.getId(); getDescriptor().save(); } return auth; }
Source:
private void connect(InetAddress anAddr, int aPort, int timeout) throws IOException { InetAddress normalAddr = anAddr.isAnyLocalAddress() ? InetAddress.getLocalHost() : anAddr; if (streaming && usingSocks()) { socksConnect(anAddr, aPort, 0); } else { IoBridge.connect(fd, normalAddr, aPort, timeout); } super.address = normalAddr; super.port = aPort; }

Target:
private void connect(InetAddress anAddr, int aPort, int timeout) throws IOException { InetAddress normalAddr = anAddr.isAnyLocalAddress() ? InetAddress.getLocalHost() : anAddr; if (streaming && usingSocks()) { socksConnect(anAddr, aPort, 0); } else { IoBridge.connect(fd, normalAddr, aPort, timeout); } address = normalAddr; port = aPort; }
Source:
void calculate(int startLine, int lineCount) { int endLine = startLine + lineCount; if (startLine < 0 || endLine > lineSizes.length) { return; } int hTrim = styledText.leftMargin + styledText.rightMargin + styledText.getCaretWidth(); for (int i = startLine; i < endLine; i++) { LineSizeInfo line = getLineSize(i); if (line.width == -1 || line.height == -1) { TextLayout layout = getTextLayout(i); Rectangle rect = layout.getBounds(); line.width = rect.width + hTrim; line.height = rect.height; disposeTextLayout(layout); } if (line.width > maxWidth) { maxWidth = line.width; maxWidthLineIndex = i; } } }

Target:
void calculate(int startLine, int lineCount) { int endLine = startLine + lineCount; if (startLine < 0 || endLine > lineSizes.length) { return; } int hTrim = styledText.leftMargin + styledText.rightMargin + styledText.getCaretWidth(); for (int i = startLine; i < endLine; i++) { LineSizeInfo line = getLineSize(i); if (line.needsRecaculateSize()) { TextLayout layout = getTextLayout(i); Rectangle rect = layout.getBounds(); line.width = rect.width + hTrim; line.height = rect.height; disposeTextLayout(layout); } if (line.width > maxWidth) { maxWidth = line.width; maxWidthLineIndex = i; } } }
Source:
public static void setOmHome(File home) { OM_HOME = home; final String dataDir = System.getProperty("DATA_DIR"); if (Strings.isEmpty(dataDir)) { DATA_HOME = new File(OM_HOME, DATA_DIR); } else { log.info("Overwrite custom DATA_DIR: {}", dataDir); DATA_HOME = new File(dataDir); } }

Target:
public static void setOmHome(File home) { OM_HOME = home; final String dataDir = System.getProperty("DATA_DIR"); if (Strings.isEmpty(dataDir)) { DATA_HOME = new File(OM_HOME, DATA_DIR); } else { DATA_HOME = new File(dataDir); } log.info("Using file locations - OM_HOME: DATA_DIR: {}", OM_HOME, DATA_HOME); }
Source:
private LockRequest toLegacyLockRequest(LockRequestV2 request) { SortedMap<LockDescriptor, LockMode> locks = buildLockMap(request.getLockDescriptors(), LockMode.WRITE); LockRequest.Builder builder = LockRequest.builder(locks); if (request.getAcquireTimeoutMs() < Long.MAX_VALUE) { builder.blockForAtMost(SimpleTimeDuration.of(request.getAcquireTimeoutMs(), TimeUnit.MILLISECONDS)); } return builder.build(); }

Target:
private LockRequest toLegacyLockRequest(LockRequestV2 request) { SortedMap<LockDescriptor, LockMode> locks = buildLockMap(request.getLockDescriptors(), LockMode.WRITE); return LockRequest.builder(locks) .blockForAtMost(SimpleTimeDuration.of(request.getAcquireTimeoutMs(), TimeUnit.MILLISECONDS)) .build(); }