auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public WsWorkunitsClientSoapProxyWrapper(String baseURL, String user, String pass, Version platformVersion) { this.platformVersion=platformVersion; version7WorkunitsServiceSoapProxy = new WsWorkunitsServiceSoapProxy(baseURL); if (version7WorkunitsServiceSoapProxy != null) { version7WorkunitsServiceSoap = version7WorkunitsServiceSoapProxy.getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) version7WorkunitsServiceSoap, user, pass); } version5WorkunitsServiceSoapProxy = new org.hpccsystems.ws.client.gen.wsworkunits.v1_56.WsWorkunitsServiceSoapProxy( baseURL); if (version5WorkunitsServiceSoapProxy != null) { version5WorkunitsServiceSoap = version5WorkunitsServiceSoapProxy.getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) version5WorkunitsServiceSoap, user, pass); } version6WorkunitsServiceSoapProxy = new org.hpccsystems.ws.client.gen.wsworkunits.v1_69.WsWorkunitsServiceSoapProxy( baseURL); if (version6WorkunitsServiceSoapProxy != null) { version6WorkunitsServiceSoap = version6WorkunitsServiceSoapProxy.getWsWorkunitsServiceSoap(); if (user != null && pass != null) Connection.initStub((Stub) version6WorkunitsServiceSoap, user, pass); } }

Target:
public WsWorkunitsClientSoapProxyWrapper(String baseURL, String user, String pass, Version platformVersion) { this.platformVersion=platformVersion; this.baseURL=baseURL; this.user=user; this.password=pass; }
Source:
private static boolean isSwitchReturningValue(SwitchStatementTree switchStatementTree) { for (CaseGroupTree caseGroupTree : switchStatementTree.cases()) { if (hasSingleStatement(caseGroupTree.body(), THROW_STATEMENT, RETURN_STATEMENT)) { continue; } return false; } return true; }

Target:
private static boolean isSwitchReturningValue(SwitchStatementTree switchStatementTree) { return switchStatementTree.cases().stream() .map(CaseGroupTree::body) .allMatch(body -> hasSingleStatement(body, THROW_STATEMENT, RETURN_STATEMENT)); }
Source:
public void publishJobModelVersion(String oldVersion, String newVersion) { Stat stat = new Stat(); String currentVersion = zkClient.<String>readData(keyBuilder.getJobModelVersionPath(), stat); LOG.info("pid=" + processorId + " publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat .getVersion() + ")"); if (currentVersion != null && !currentVersion.equals(oldVersion)) { throw new SamzaException( "Someone change JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion); } int dataVersion = stat.getVersion(); try { stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion); } catch (Exception e) { LOG.error("publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion, e); } LOG.info("pid=" + processorId + " published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) + "(actual data version after update = " + stat.getVersion() + ")"); }

Target:
public void publishJobModelVersion(String oldVersion, String newVersion) { Stat stat = new Stat(); String currentVersion = zkClient.<String>readData(keyBuilder.getJobModelVersionPath(), stat); LOG.info("pid=" + processorId + " publishing new version: " + newVersion + "; oldVersion = " + oldVersion + "(" + stat .getVersion() + ")"); if (currentVersion != null && !currentVersion.equals(oldVersion)) { throw new SamzaException( "Someone change JobModelVersion while the leader was generating one: expected" + oldVersion + ", got " + currentVersion); } int dataVersion = stat.getVersion(); try { stat = zkClient.writeDataReturnStat(keyBuilder.getJobModelVersionPath(), newVersion, dataVersion); } catch (Exception e) { String msg = "publish job model version failed for new version = " + newVersion + "; old version = " + oldVersion; LOG.error(msg, e); throw new SamzaException(msg); } LOG.info("pid=" + processorId + " published new version: " + newVersion + "; expected data version = " + (dataVersion + 1) + "(actual data version after update = " + stat.getVersion() + ")"); }
Source:
private void validateIpAddress() { String address = getIpAddress(); if (address == null) { return; } if (address.trim().isEmpty()) { addError(IP_ADDRESS, "IpAddress cannot be empty if it is present."); return; } try { IpAddress.create(address); } catch (Exception e) { addError(IP_ADDRESS, String.format("'%s' is an invalid IP address.", address)); } }

Target:
private void validateIpAddress() { String address = getIpAddress(); if (address == null) { return; } if (StringUtil.isBlank(address)) { addError(IP_ADDRESS, "IpAddress cannot be empty if it is present."); return; } try { IpAddress.create(address); } catch (Exception e) { addError(IP_ADDRESS, String.format("'%s' is an invalid IP address.", address)); } }
Source:
public Frame getInvoke(RelNode r, RelNode parent) { final Frame frame = dispatcher.invoke(r); if (frame != null && parent instanceof Correlate && r instanceof Sort) { Sort sort = (Sort) r; if (sort.offset != null || sort.fetch != null) { currentRel = parent; return null; } } if (frame != null) { map.put(r, frame); } currentRel = parent; return frame; }

Target:
public Frame getInvoke(RelNode r, RelNode parent) { final Frame frame = dispatcher.invoke(r); currentRel = parent; if (frame != null && parent != null && r instanceof Sort) { final Sort sort = (Sort) r; if (sort.offset != null || sort.fetch != null) { return null; } } if (frame != null) { map.put(r, frame); } return frame; }
Source:
void start() { if (running) { LOG.info("FeatureStateConsumer has already been started."); } else { synchronized (this) { if (running) { LOG.info("FeatureStateConsumer has already been started."); } else { try { LOG.info("Starting to start FeatureStateConsumer."); new Thread(this::run).start(); LOG.info("Successfully started FeatureStateConsumer."); running = true; initializationLatch.await(initializationTimeout.toMillis(), MILLISECONDS); LOG.info("Successfully initialized FeatureStateConsumer."); } catch (InterruptedException e) { throw new RuntimeException("An error occurred while awaiting initialization.", e); } } } } }

Target:
private synchronized void start() { if (running) { LOG.info("FeatureStateConsumer has already been started."); } else { try { LOG.debug("Starting to start FeatureStateConsumer."); asThreadWithExceptionHandler(this::run).start(); LOG.debug("Successfully started FeatureStateConsumer."); if (initializationLatch.await(initializationTimeout.toMillis(), MILLISECONDS)) { LOG.debug("Successfully initialized FeatureStateConsumer."); } else { throw new RuntimeException("Failed to initialize FeatureStateConsumer."); } } catch (InterruptedException e) { LOG.warn("Starting of FeatureStateConsumer was interrupted.", e); currentThread().interrupt(); } } }
Source:
private String getAlternativeTitle(DocumentIndexingPackage dip) throws FedoraException, IndexingException { Resource resc = dip.getContentObject().getResource(); if (resc.hasProperty(DcElements.title)) { Statement dcTitle = resc.getProperty(DcElements.title); return dcTitle.getString(); } else if (resc.hasProperty(Ebucore.filename)) { Statement filename = resc.getProperty(Ebucore.filename); return filename.getString(); } else { return dip.getPid().getId(); } }

Target:
private String getAlternativeTitle(DocumentIndexingPackage dip) throws FedoraException, IndexingException { Resource resc = dip.getContentObject().getResource(); String dcTitle = titleText(resc, DcElements.title); String ebucoreTitle = titleText(resc, Ebucore.filename); if (!isBlank(dcTitle)) { return dcTitle; } else if (!isBlank(ebucoreTitle)) { return ebucoreTitle; } else { return dip.getPid().getId(); } }
Source:
private void assertJsonFormat(final String metricPath) { final String metric = WebClient.create(base.toExternalForm()) .path(metricPath) .accept(MediaType.APPLICATION_JSON) .get(String.class); assertTrue(metric.contains("count")); assertTrue(metric.contains("meanRate")); assertTrue(metric.contains("fifteenMinRate")); assertTrue(metric.contains("fiveMinRate")); assertTrue(metric.contains("oneMinRate")); assertTrue(metric.contains("min")); assertTrue(metric.contains("max")); assertTrue(metric.contains("mean")); assertTrue(metric.contains("stddev")); assertTrue(metric.contains("p50")); assertTrue(metric.contains("p75")); assertTrue(metric.contains("p95")); assertTrue(metric.contains("p98")); assertTrue(metric.contains("p99")); assertTrue(metric.contains("p999")); }

Target:
private void assertJsonFormat(final String metricPath) { WebTarget webTarget = client.target(base.toExternalForm()); String metric = webTarget .path(metricPath) .request() .accept(MediaType.APPLICATION_JSON) .buildGet() .invoke() .readEntity(String.class); JsonObject expectedJson = Json.createReader(new StringReader(metric)).readObject(); String[] expected = { "count", "meanRate", "fifteenMinRate", "fiveMinRate", "oneMinRate", "min", "max", "mean", "stddev", "p50", "p75", "p95", "p98", "p99", "p999" }; Stream.of(expected) .forEach(text -> assertTrue( "Expected: " + text + " to be present in " + metric, expectedJson.getJsonObject("weather_day_status").get(text) != null)); }
Source:
private void startSubscription() { Set<TopicPartition> registeredTopicPartitions = new HashSet<>(); registeredTopicPartitions.addAll(topicPartitionsToSSP.keySet()); registeredTopicPartitions.addAll(topicPartitionToStartpointMap.keySet()); LOG.info("{}: Consumer subscribes to {}", this, registeredTopicPartitions); try { synchronized (kafkaConsumer) { kafkaConsumer.assign(registeredTopicPartitions); } } catch (Exception e) { throw new SamzaException("Consumer subscription failed for " + this, e); } }

Target:
private void startSubscription() { Set<TopicPartition> registeredTopicPartitions = new HashSet<>(topicPartitionToStartpointMap.keySet()); LOG.info("{}: Consumer subscribes to {}", this, registeredTopicPartitions); try { synchronized (kafkaConsumer) { kafkaConsumer.assign(registeredTopicPartitions); } } catch (Exception e) { throw new SamzaException("Consumer subscription failed for " + this, e); } }
Source:
public CustomDatatype.Summary toHtmlSummary(CustomDatatype<T> datatype, String valueReference) { return new CustomDatatype.Summary(valueReference, true); }

Target:
public CustomDatatype.Summary toHtmlSummary(CustomDatatype<T> datatype, String valueReference) { return toHtmlSummary(datatype, valueReference); }
Source:
public ListBoxModel doFillProcessItems(@AncestorInPath Job defaultJob, @QueryParameter("jobName") String jobName) { if (!defaultJob.hasPermission(Item.CONFIGURE) && defaultJob.hasPermission(Item.EXTENDED_READ)) { return new ListBoxModel(); } defaultJob.checkPermission(Item.CONFIGURE); AbstractProject<?,?> j = null; if (jobName != null) { j = getProject(jobName); } ListBoxModel r = new ListBoxModel(); if (j!=null) { JobPropertyImpl pp = j.getProperty(JobPropertyImpl.class); if (pp!=null) { for (PromotionProcess proc : pp.getActiveItems()) { r.add(new Option(proc.getDisplayName(),proc.getName())); } } } return r; }

Target:
public ListBoxModel doFillProcessItems(@AncestorInPath Job defaultJob, @QueryParameter("jobName") String jobName) { if (!defaultJob.hasPermission(Item.CONFIGURE) && defaultJob.hasPermission(Item.EXTENDED_READ)) { return new ListBoxModel(); } defaultJob.checkPermission(Item.CONFIGURE); AbstractProject<?,?> j = null; if (jobName != null) { j = Jenkins.getInstance().getItemByFullName(jobName, AbstractProject.class); } ListBoxModel r = new ListBoxModel(); if (j!=null) { JobPropertyImpl pp = j.getProperty(JobPropertyImpl.class); if (pp!=null) { for (PromotionProcess proc : pp.getActiveItems()) { r.add(new Option(proc.getDisplayName(),proc.getName())); } } } return r; }
Source:
public <T> T execute(Request<T> request, boolean authenticateIfNeeded, IProgressMonitor monitor) throws IOException, GerritException { String openIdProvider = getOpenIdProvider(); hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); for (int attempt = 0; attempt < 2; attempt++) { if (authenticateIfNeeded) { if (needsAuthentication()) { AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (openIdProvider != null || credentials != null) { authenticate(openIdProvider, monitor); } } if (!obtainedXsrfKey) { updateXsrfKey(monitor); } } HttpMethodBase method = request.createMethod(); if (obtainedXsrfKey) { method.setRequestHeader("X-Gerrit-Auth", xsrfKey); } try { WebUtil.execute(httpClient, hostConfiguration, method, monitor); } catch (IOException e) { WebUtil.releaseConnection(method, monitor); throw e; } catch (RuntimeException e) { WebUtil.releaseConnection(method, monitor); throw e; } int code = method.getStatusCode(); if (code == HttpURLConnection.HTTP_OK) { try { return request.process(method); } finally { WebUtil.releaseConnection(method, monitor); } } else { request.handleError(method); WebUtil.releaseConnection(method, monitor); if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) { authenticate(openIdProvider, monitor); } else { throw new GerritHttpException(code); } } } throw new GerritLoginException(); }

Target:
public <T> T execute(Request<T> request, boolean authenticateIfNeeded, IProgressMonitor monitor) throws IOException, GerritException { String openIdProvider = getOpenIdProvider(); hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); for (int attempt = 0; attempt < 2; attempt++) { if (authenticateIfNeeded) { if (needsAuthentication()) { AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY); if (openIdProvider != null || credentials != null) { authenticate(openIdProvider, monitor); } } if (!obtainedXsrfKey) { updateXsrfKey(monitor); } } HttpMethodBase method = request.createMethod(); if (obtainedXsrfKey) { method.setRequestHeader("X-Gerrit-Auth", xsrfKey); } try { WebUtil.execute(httpClient, hostConfiguration, method, monitor); } catch (IOException e) { WebUtil.releaseConnection(method, monitor); throw e; } catch (RuntimeException e) { WebUtil.releaseConnection(method, monitor); throw e; } int code = method.getStatusCode(); if (code == HttpURLConnection.HTTP_OK) { try { return request.process(method); } finally { WebUtil.releaseConnection(method, monitor); } } else { try { request.handleError(method); } finally { WebUtil.releaseConnection(method, monitor); } if (code == HttpURLConnection.HTTP_UNAUTHORIZED || code == HttpURLConnection.HTTP_FORBIDDEN) { authenticate(openIdProvider, monitor); } else { throw new GerritHttpException(code); } } } throw new GerritLoginException(); }
Source:
public ClusterEvent readObject(ObjectInput input) throws IOException, ClassNotFoundException { return new ClusterEvent(input.readObject(), input.readObject(), input.readObject(), (Metadata)input.readObject(),(Type) MarshallUtil.unmarshallEnum(input, Type::valueOf), (Address)input.readObject(), (GlobalTransaction)input.readObject(), input.readBoolean()); }

Target:
public ClusterEvent readObject(ObjectInput input) throws IOException, ClassNotFoundException { return new ClusterEvent(input.readObject(), input.readObject(), input.readObject(), (Metadata)input.readObject(),MarshallUtil.unmarshallEnum(input, Type::valueOf), (Address)input.readObject(), (GlobalTransaction)input.readObject(), input.readBoolean()); }
Source:
protected boolean validatePage() { if (!getProjectName().isEmpty()) { IProject[] projects = IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getProjects(); for (IProject project : projects) { if (getProjectHandle().getName().toUpperCase().equals(project.getName().toUpperCase())) { setErrorMessage(IDEWorkbenchMessages.WizardNewProjectCreationPage_projectExistsMessage); return false; } } } return super.validatePage(); }

Target:
protected boolean validatePage() { boolean validProjectName = true; if (resourceExistsInWorkspace()) { validProjectName = false; } if (!StringUtil.isEmpty(getProjectName()) && validProjectName && isMacOrWindowsOS()) { if (resourceExistsOnDisk()) { validProjectName = false; } } if (validProjectName) { return super.validatePage(); } else { return false; } }
Source:
public CompactAllPolicyTest() throws InterruptedException { Pair<MockBlobStore, StoreConfig> initState = CompactionPolicyTest.initializeBlobStore(properties, time, -1, -1, -1); this.config = initState.getSecond(); this.messageRetentionTimeInMs = config.storeDeletedMessageRetentionDays * Time.HoursPerDay * Time.SecsPerHour * Time.MsPerSec; this.blobStore = initState.getFirst(); this.compactionPolicy = new CompactAllPolicy(config, time); }

Target:
public CompactAllPolicyTest() throws InterruptedException { Pair<MockBlobStore, StoreConfig> initState = CompactionPolicyTest.initializeBlobStore(properties, time, -1, -1, -1); config = initState.getSecond(); messageRetentionTimeInMs = config.storeDeletedMessageRetentionDays * Time.HoursPerDay * Time.SecsPerHour * Time.MsPerSec; blobStore = initState.getFirst(); compactionPolicy = new CompactAllPolicy(config, time); }
Source:
public void noTransactionsPerformanceReportEntitySerializesCorrectly() { given(mockPerformanceReportDao.aggregateNumberAndValueOfPaymentsByGatewayAccount()) .willReturn(noTransactionsPerformanceReportEntity.stream()); Response result = resource.getGatewayAccountPerformanceReport(); assertThat(result.getStatus(), is(OK.getStatusCode())); HashMap<String, ImmutableMap<String, Object>> unserializedResponse = (HashMap<String, ImmutableMap<String, Object>>) result.getEntity(); assertThat(unserializedResponse.size(), is(0)); }

Target:
public void noTransactionsPerformanceReportEntitySerializesCorrectly() { Stream<GatewayAccountPerformanceReportEntity> noTransactionsPerformanceReportEntity = Stream.empty(); given(mockPerformanceReportDao.aggregateNumberAndValueOfPaymentsByGatewayAccount()) .willReturn(noTransactionsPerformanceReportEntity); Response result = resource.getGatewayAccountPerformanceReport(); assertThat(result.getStatus(), is(OK.getStatusCode())); HashMap<String, ImmutableMap<String, Object>> unserializedResponse = (HashMap<String, ImmutableMap<String, Object>>) result.getEntity(); assertThat(unserializedResponse.size(), is(0)); }
Source:
private long getNumberIssues() { long count = 0; for (Map.Entry<VirtualFile, Collection<LocalIssuePointer>> entry : storePerFile.entrySet()) { count += entry.getValue().size(); } return count; }

Target:
private long getNumberIssues() { long count = 0; for (Collection<LocalIssuePointer> issuePointers : storePerFile.values()) { count += issuePointers.size(); } return count; }
Source:
public void close() throws IOException { LOG.info("Closing split (scanned rows)", scannedRows); currentRow = null; try { if (resultScanner != null) { resultScanner.close(); } if (table != null) { table.close(); } if (connection != null) { connection.close(); } } finally { resultScanner = null; table = null; connection = null; } }

Target:
public void close() throws IOException { LOG.info("Closing split (scanned rows)", scannedRows); currentRow = null; try { if (resultScanner != null) { resultScanner.close(); } closeTable(); } finally { resultScanner = null; } }
Source:
private void propagateSubject(final SecurityContext target, final SecurityContext source) { final SecurityContextUtil previousUtil = source.getUtil(); final SecurityContextUtil currentUtil = target.getUtil(); if(target.getSecurityDomain() != null && source.getSecurityDomain() != null && target.getSecurityDomain().equals(source.getSecurityDomain())){ target.setSubjectInfo(source.getSubjectInfo()); } else { currentUtil.createSubjectInfo(previousUtil.getUserPrincipal(), previousUtil.getCredential(), previousUtil.getSubject()); } if (previousUtil.getRoles() != null) { try { currentUtil.setRoles((RoleGroup) previousUtil.getRoles().clone()); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } currentUtil.setIdentities(previousUtil.getIdentities(Identity.class)); }

Target:
private void propagateSubject(final SecurityContext target, final SecurityContext source) { final SecurityContextUtil previousUtil = source.getUtil(); final SecurityContextUtil currentUtil = target.getUtil(); if(target.getSecurityDomain() != null && source.getSecurityDomain() != null && target.getSecurityDomain().equals(source.getSecurityDomain())){ target.setSubjectInfo(source.getSubjectInfo()); } else { currentUtil.createSubjectInfo(previousUtil.getUserPrincipal(), previousUtil.getCredential(), previousUtil.getSubject()); if (previousUtil.getRoles() != null) { try { currentUtil.setRoles((RoleGroup) previousUtil.getRoles().clone()); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } } currentUtil.setIdentities(previousUtil.getIdentities(Identity.class)); } }
Source:
private OrcsScriptOutputHandler getOutputHandler(ScriptContext context) { OrcsScriptOutputHandler handler = null; String mediaType = (String) context.getAttribute("MediaType"); if (mediaType != null && mediaType.compareTo("application/xml") == 0) { handler = new ExcelOutputHandler(context); } else { handler = new JsonOutputHandler(context); } return handler; }

Target:
private OrcsScriptOutputHandler getOutputHandler(ScriptContext context) { OrcsScriptOutputHandler handler = null; String mediaType = (String) context.getAttribute("MediaType"); if (mediaType != null && "application/vnd.ms-excel".equals(mediaType)) { handler = new ExcelOutputHandler(context); } else { handler = new JsonOutputHandler(context); } return handler; }
Source:
static void addDeleteFromColumnMods( ByteString familyByteString, Cell cell, com.google.cloud.bigtable.data.v2.models.MutationApi<?> mutation ) { ByteString cellQualifierByteString = ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); long endTimestamp = BigtableConstants.BIGTABLE_TIMEUNIT.convert( cell.getTimestamp() + 1, BigtableConstants.HBASE_TIMEUNIT); if (isPointDelete(cell)) { long startTimestamp = BigtableConstants.BIGTABLE_TIMEUNIT.convert( cell.getTimestamp(), BigtableConstants.HBASE_TIMEUNIT); mutation.deleteCells(familyByteString.toStringUtf8(), cellQualifierByteString, Range.TimestampRange.create(startTimestamp, endTimestamp)); } else { if (cell.getTimestamp() != HConstants.LATEST_TIMESTAMP) { mutation.deleteCells(familyByteString.toStringUtf8(), cellQualifierByteString, Range.TimestampRange.unbounded().endOpen(endTimestamp)); } else { mutation.deleteCells(familyByteString.toStringUtf8(), cellQualifierByteString); } } }

Target:
static void addDeleteFromColumnMods( ByteString familyByteString, Cell cell, com.google.cloud.bigtable.data.v2.models.MutationApi<?> mutation ) { ByteString cellQualifierByteString = ByteString.copyFrom( cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); long endTimestamp = BigtableConstants.BIGTABLE_TIMEUNIT.convert( cell.getTimestamp() + 1, BigtableConstants.HBASE_TIMEUNIT); if (isPointDelete(cell)) { long startTimestamp = BigtableConstants.BIGTABLE_TIMEUNIT.convert( cell.getTimestamp(), BigtableConstants.HBASE_TIMEUNIT); mutation.deleteCells(familyByteString.toStringUtf8(), cellQualifierByteString, TimestampRange.create(startTimestamp, endTimestamp)); } else { if (cell.getTimestamp() != HConstants.LATEST_TIMESTAMP) { mutation.deleteCells(familyByteString.toStringUtf8(), cellQualifierByteString, TimestampRange.unbounded().endOpen(endTimestamp)); } else { mutation.deleteCells(familyByteString.toStringUtf8(), cellQualifierByteString); } } }
Source:
public void stopRunning( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { if ( this.isStopped() || sdi.isDisposed() ) { return; } dbLock.writeLock().lock(); try { meta = (TableInputMeta) smi; data = (TableInputData) sdi; setStopped( true ); if ( data.db != null && data.db.getConnection() != null && !data.isCanceled ) { data.db.cancelQuery(); data.isCanceled = true; } } finally { dbLock.writeLock().unlock(); } }

Target:
public void stopRunning( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { if ( this.isStopped() || sdi.isDisposed() ) { return; } dbLock.lock(); try { meta = (TableInputMeta) smi; data = (TableInputData) sdi; setStopped( true ); if ( data.db != null && data.db.getConnection() != null && !data.isCanceled ) { data.db.cancelQuery(); data.isCanceled = true; } } finally { dbLock.unlock(); } }
Source:
protected Stream<Sample> loadParents(List<Long> ids) throws IOException { Collection<Sample> results = sampleService.listByIdList(ids); templatesByProjectId = results.stream() .map(sam -> sam.getProject().getId()) .distinct() .map(projectId -> { try { return libraryTemplateService.listLibraryTemplatesForProject(projectId); } catch (IOException e) { throw new RuntimeException(e); } }) .filter(list -> !list.isEmpty()) .map(Dtos::asLibraryTemplateDtos) .collect(Collectors.toMap(list -> list.get(0).getProjectId(), list -> list)); SampleClass sampleClass = null; boolean hasPlain = false; for (Sample sample : results) { if (sample instanceof DetailedSample) { DetailedSample detailed = (DetailedSample) sample; if (sampleClass == null) { sampleClass = detailed.getSampleClass(); } else if (sampleClass.getId() != detailed.getSampleClass().getId()) { throw new IOException("Can only create libraries when samples all have the same class."); } } else { hasPlain = true; } } if (hasPlain && sampleClass != null) { throw new IOException("Cannot mix plain and detailed samples."); } return results.stream().sorted(new AliasComparator<>()); }

Target:
protected Stream<Sample> loadParents(List<Long> ids) throws IOException { Collection<Sample> results = sampleService.listByIdList(ids); templatesByProjectId = results.stream() .map(sam -> sam.getProject().getId()) .distinct() .map(WhineyFunction.rethrow(projectId -> { Map<Long, List<LibraryTemplateDto>> map = new HashMap<>(); map.put(projectId, Dtos.asLibraryTemplateDtos(libraryTemplateService.listLibraryTemplatesForProject(projectId))); return map; })) .filter(map -> !map.values().stream().allMatch(value -> value.isEmpty())) .flatMap(map -> map.entrySet().stream()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); SampleClass sampleClass = null; boolean hasPlain = false; for (Sample sample : results) { if (sample instanceof DetailedSample) { DetailedSample detailed = (DetailedSample) sample; if (sampleClass == null) { sampleClass = detailed.getSampleClass(); } else if (sampleClass.getId() != detailed.getSampleClass().getId()) { throw new IOException("Can only create libraries when samples all have the same class."); } } else { hasPlain = true; } } if (hasPlain && sampleClass != null) { throw new IOException("Cannot mix plain and detailed samples."); } return results.stream().sorted(new AliasComparator<>()); }
Source:
protected void paint(Graphics graphics) { graphics.setColor(0x00FF0000); graphics.fillRect(0, 0, getWidth(), getHeight()); Image image = Image.createImage(150, 150); Graphics g = image.getGraphics(); g.setColor(0x00FFFFFF); g.fillRect(0, 0, 150, 150); g.setColor(0); g.setStrokeStyle(Graphics.SOLID); g.drawString("Roxors", 50, 50, Graphics.TOP | Graphics.LEFT); graphics.drawImage(image, 50, 50, Graphics.TOP | Graphics.LEFT); System.out.println("PAINTED"); }

Target:
protected void paint(Graphics graphics) { graphics.setColor(0x00FF0000); graphics.fillRect(0, 0, getWidth(), getHeight()); Image image = Image.createImage(150, 150); Graphics g = image.getGraphics(); g.setColor(0x00FFFFFF); g.fillRect(0, 0, 150, 150); g.setColor(0); g.setStrokeStyle(Graphics.SOLID); g.drawString("Roxors", 50, 50, Graphics.TOP | Graphics.LEFT); int[] rgbData = new int[150 * 150]; image.getRGB(rgbData, 0, 150, 0, 0, 150, 150); g.drawRGB(rgbData, 0, 150, 0, 0, 150, 150, true); graphics.drawImage(image, 50, 50, Graphics.TOP | Graphics.LEFT); System.out.println("PAINTED"); }
Source:
public void lookupAllByTypeCaching() throws Throwable { BaseService service = new AugmentedMethodService(); Method method = BaseService.class.getMethod("augmented"); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); verify(registry).lookupAllByType(any()); }

Target:
public void lookupAllByTypeCaching() throws Throwable { BaseService service = new AugmentedMethodService(); Method method = BaseService.class.getMethod("augmented"); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); injectParamsFromContextServiceMethodInvoker.invoke(service, method, null); verify(registry, times(1)).lookupAllByType(any()); }
Source:
private int sortByScheduledDate(ITask task1, ITask task2, int sortDirection) { if (task1 instanceof AbstractTask && task2 instanceof AbstractTask) { DateRange date1 = ((AbstractTask) task1).getScheduledForDate(); DateRange date2 = ((AbstractTask) task2).getScheduledForDate(); return compare(date1.getEndDate(), date2.getEndDate(), sortDirection); } return 0; }

Target:
private int sortByScheduledDate(ITask task1, ITask task2, int sortDirection) { if (task1 instanceof AbstractTask && task2 instanceof AbstractTask) { DateRange date1 = ((AbstractTask) task1).getScheduledForDate(); DateRange date2 = ((AbstractTask) task2).getScheduledForDate(); return compare(date1, date2, sortDirection); } return 0; }
Source:
void timeout() { if (status.compareAndSet(Status.WAITING, Status.TIMED_OUT)) { handler.handle(Future.failedFuture(new VertxException("Timed out waiting to get lock"))); } }

Target:
void timeout() { if (status.compareAndSet(Status.WAITING, Status.TIMED_OUT)) { handler.handle(Future.failedFuture("Timed out waiting to get lock")); } }
Source:
public static File fakeReplaceFile(String name, String newContent, InputStream in) throws IOException { Assert.notNull(name); Assert.notNull(in); File newArchive = FileUtils.createRandomTempFile(".tar.gz"); newArchive.deleteOnExit(); TarArchiveOutputStream newArchiveOut = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(newArchive))); newArchiveOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); TarArchiveInputStream archiveIn = new TarArchiveInputStream(new GZIPInputStream(in)); String pathToReplace = null; try { for (ArchiveEntry nextEntry; (nextEntry = archiveIn.getNextEntry()) != null;) { if (nextEntry.getName().endsWith(name)) { pathToReplace = nextEntry.getName(); } newArchiveOut.putArchiveEntry(nextEntry); IOUtils.copy(archiveIn, newArchiveOut); newArchiveOut.closeArchiveEntry(); } if (pathToReplace == null) { throw new IllegalStateException("Could not find file " + name + " in the given archive."); } TarArchiveEntry newEntry = new TarArchiveEntry(pathToReplace); newEntry.setSize(newContent.length()); newArchiveOut.putArchiveEntry(newEntry); IOUtils.copy(new ByteArrayInputStream(newContent.getBytes()), newArchiveOut); newArchiveOut.closeArchiveEntry(); return newArchive; } finally { newArchiveOut.finish(); newArchiveOut.flush(); StreamUtils.close(archiveIn); StreamUtils.close(newArchiveOut); } }

Target:
public static File fakeReplaceFile(String name, String newContent, InputStream in) throws IOException { Assert.notNull(name); Assert.notNull(in); File newArchive = FileUtils.createRandomTempFile(".tar.gz"); newArchive.deleteOnExit(); TarArchiveOutputStream newArchiveOut = new TarArchiveOutputStream(new GZIPOutputStream(new FileOutputStream(newArchive))); newArchiveOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU); TarArchiveInputStream archiveIn = new TarArchiveInputStream(new GZIPInputStream(in)); String pathToReplace = null; try { for (ArchiveEntry nextEntry = null; (nextEntry = archiveIn.getNextEntry()) != null;) { if (nextEntry.getName().endsWith(name)) { pathToReplace = nextEntry.getName(); } newArchiveOut.putArchiveEntry(nextEntry); IOUtils.copy(archiveIn, newArchiveOut); newArchiveOut.closeArchiveEntry(); } if (pathToReplace == null) { throw new IllegalStateException("Could not find file " + name + " in the given archive."); } TarArchiveEntry newEntry = new TarArchiveEntry(pathToReplace); newEntry.setSize(newContent.length()); newArchiveOut.putArchiveEntry(newEntry); IOUtils.copy(new ByteArrayInputStream(newContent.getBytes()), newArchiveOut); newArchiveOut.closeArchiveEntry(); return newArchive; } finally { newArchiveOut.finish(); newArchiveOut.flush(); StreamUtils.close(archiveIn); StreamUtils.close(newArchiveOut); } }
Source:
static <Z> Z transformUnsafe(ElasticsearchSearchProjection<?, Z> projection, LoadingResult<?> loadingResult, Object extractedData, SearchProjectionTransformContext context) { return (Z) projection.transform( loadingResult, extractedData, context ); }

Target:
static <Z> Z transformUnsafe(ElasticsearchSearchProjection<?, Z> projection, LoadingResult<?> loadingResult, Object extractedData, SearchProjectionTransformContext context) { return (Z) ( (ElasticsearchSearchProjection) projection ).transform( loadingResult, extractedData, context ); }
Source:
public static Scheduler initComputationScheduler(Callable<Scheduler> defaultScheduler) { Function<Scheduler, Scheduler> f = onInitComputationHandler; if (f == null) { return callOrNull(defaultScheduler); } return apply(f, defaultScheduler); }

Target:
public static Scheduler initComputationScheduler(Callable<Scheduler> defaultScheduler) { ObjectHelper.requireNonNull(defaultScheduler, "Scheduler Callable can't be null"); Function<Callable<Scheduler>, Scheduler> f = onInitComputationHandler; if (f == null) { return callRequireNonNull(defaultScheduler); } return applyRequireNonNull(f, defaultScheduler); }
Source:
public ScheduleToken schedule(Instant triggerDateTime, Object event) { shutdownLatch.ifShuttingDown("Cannot dispatch new events as this scheduler is being shutdown"); Channel channel = axonServerConnectionManager.getChannel(axonServerConfiguration.getContext()); EventSchedulerGrpc.EventSchedulerFutureStub scheduleStub = EventSchedulerGrpc.newFutureStub(channel); io.axoniq.axonserver.grpc.event.ScheduleToken response = null; try { response = scheduleStub.scheduleEvent(ScheduleEventRequest .newBuilder() .setInstant(triggerDateTime.toEpochMilli()) .setEvent(toEvent(event)) .build()) .get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw GrpcExceptionParser.parse(e); } catch (ExecutionException e) { throw GrpcExceptionParser.parse(e.getCause()); } return new SimpleScheduleToken(response.getToken()); }

Target:
public ScheduleToken schedule(Instant triggerDateTime, Object event) { Assert.isTrue(started.get(), () -> "Cannot dispatch new events as this scheduler is being shutdown"); io.axoniq.axonserver.grpc.event.ScheduleToken response = null; try { response = eventSchedulerStub().scheduleEvent(ScheduleEventRequest .newBuilder() .setInstant(triggerDateTime.toEpochMilli()) .setEvent(toEvent(event)) .build()) .get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw GrpcExceptionParser.parse(e); } catch (ExecutionException e) { throw GrpcExceptionParser.parse(e.getCause()); } return new SimpleScheduleToken(response.getToken()); }
Source:
public void notExisitQueue() throws IOException, InterruptedException { final Queue queue = this.client.getQueues().get("foo"); queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList(new String[] {"foo"}), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = new Thread() { @Override public void run() { try { Thread.sleep(2000); worker.shutDown(); } catch (final InterruptedException v) { System.out.println(v); } } }; signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory.get(0), equalTo(SerialWorkerTest.DEFAULT_JOB_NAME + ".process")); }

Target:
public void notExisitQueue() throws IOException, InterruptedException { final Queue queue = this.client.getQueue("foo"); queue.put(SerialWorkerTest.DEFAULT_JOB_NAME, null, null); final SerialWorker worker = new SerialWorker( Arrays.asList("foo"), this.client, null, 10); IntegrationTestJob.runningHistory.clear(); final Thread signal = this.getWorkerThread(worker, 2); signal.start(); worker.run(); assertThat(IntegrationTestJob.runningHistory.get(0), equalTo(SerialWorkerTest.DEFAULT_JOB_NAME + ".process")); }
Source:
private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); while (parser.getEventType() != XmlPullParser.END_DOCUMENT) { XmlUtils.nextElement(parser); ContentValues row = getRow(parser); if (row == null) { continue; } insertAddingDefaults(db, CARRIERS_TABLE, row); } db.setTransactionSuccessful(); } catch (XmlPullParserException e) { Log.e(TAG, "Got XmlPullParserException while loading apns.", e); } catch (IOException e) { Log.e(TAG, "Got IOException while loading apns.", e); } catch (SQLException e) { Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }

Target:
private void loadApns(SQLiteDatabase db, XmlPullParser parser) { if (parser != null) { try { db.beginTransaction(); while (parser.getEventType() != XmlPullParser.END_DOCUMENT) { XmlUtils.nextElement(parser); ContentValues row = getRow(parser); if (row == null) { if (parser.getName() == null) { continue; } else { throw new XmlPullParserException("Expected 'apn' tag", parser, null); } } insertAddingDefaults(db, CARRIERS_TABLE, row); } db.setTransactionSuccessful(); } catch (XmlPullParserException e) { Log.e(TAG, "Got XmlPullParserException while loading apns.", e); } catch (IOException e) { Log.e(TAG, "Got IOException while loading apns.", e); } catch (SQLException e) { Log.e(TAG, "Got SQLException while loading apns.", e); } finally { db.endTransaction(); } } }
Source:
protected Iterable<? extends RunningInstance> pollRunningInstances() { Iterable<? extends Set<? extends Reservation<? extends RunningInstance>>> reservations = transform(regions.get(), allInstancesInRegionFunction()); return concat(concat(reservations)); }

Target:
protected Iterable<? extends RunningInstance> pollRunningInstances() { Iterable<? extends Set<? extends Reservation<? extends RunningInstance>>> reservations = transform(regions.get(), allInstancesInRegion()); return concat(concat(reservations)); }
Source:
protected void writeAttributeRaw(String attributeName, String attributeValue) throws XMLStreamException { StringBuilder output = new StringBuilder(" "); output.append(attributeName); output.append("=\""); String escapedValue = attributeValue.replace("&", "&amp;"); escapedValue = escapedValue.replace("<", "&lt;"); escapedValue = escapedValue.replace(">", "&gt;"); escapedValue = escapedValue.replace("\"", "&quot;"); escapedValue = escapedValue.replace("\n", "&#10;"); output.append(escapedValue); output.append("\" "); try { outputStream.write(output.toString().getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw new XMLStreamException("Could not write raw attribute", e); } }

Target:
protected void writeAttributeRaw(String attributeName, String attributeValue) throws XMLStreamException { try { outputStream.write(" ".getBytes(StandardCharsets.UTF_8)); outputStream.write(attributeName.getBytes(StandardCharsets.UTF_8)); outputStream.write("=\"".getBytes(StandardCharsets.UTF_8)); String escapedValue = attributeValue.replace("&", "&amp;"); escapedValue = escapedValue.replace("<", "&lt;"); escapedValue = escapedValue.replace(">", "&gt;"); escapedValue = escapedValue.replace("\"", "&quot;"); escapedValue = escapedValue.replace("\n", "&#10;"); outputStream.write(escapedValue.getBytes(StandardCharsets.UTF_8)); outputStream.write("\" ".getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw new XMLStreamException("Could not write raw attribute", e); } }
Source:
private void showIntroductoryOverlay() { if (mIntroductoryOverlay != null) { mIntroductoryOverlay.remove(); } if ((mediaRouteMenuItem != null) && mediaRouteMenuItem.isVisible()) { new Handler().post(() -> { mIntroductoryOverlay = new IntroductoryOverlay .Builder(this, mediaRouteMenuItem) .setTitleText(R.string.introducing_cast) .setSingleTime() .setOnOverlayDismissedListener( () -> mIntroductoryOverlay = null) .build(); mIntroductoryOverlay.show(); }); } }

Target:
private void showIntroductoryOverlay() { if (mIntroductoryOverlay != null) { mIntroductoryOverlay.remove(); } if ((mediaRouteMenuItem != null) && mediaRouteMenuItem.isVisible()) { new Handler().post(() -> { mIntroductoryOverlay = new IntroductoryOverlay .Builder(this, mediaRouteMenuItem) .setTitleText("Introducing Cast") .setSingleTime() .setOnOverlayDismissedListener( () -> mIntroductoryOverlay = null) .build(); mIntroductoryOverlay.show(); }); } }
Source:
public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_UST); if (isVersionSupported("2.1.0")) { command.add(LTTngControlServiceConstants.OPTION_FIELDS); } ICommandResult result = executeCommand(command, monitor, false); List<IUstProviderInfo> allProviders = new ArrayList<>(); if (!isVersionSupported("2.1.0") && (result.getResult() != 0)) { return allProviders; } if (result.getErrorOutput().length > 0) { if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_UST_NO_UST_PROVIDER_PATTERN)) { return allProviders; } } if (isError(result)) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + toCommandString(command) + "\n" + result.toString()); } IUstProviderInfo provider = null; int index = 0; while (index < result.getOutput().length) { String line = result.getOutput()[index]; Matcher matcher = LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line); if (matcher.matches()) { provider = new UstProviderInfo(matcher.group(2).trim()); provider.setPid(Integer.valueOf(matcher.group(1).trim())); List<IBaseEventInfo> events = new ArrayList<>(); index = getProviderEventInfo(result.getOutput(), ++index, events); provider.setEvents(events); allProviders.add(provider); } else { index++; } } return allProviders; }

Target:
public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException { List<String> command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, LTTngControlServiceConstants.OPTION_UST); if (isVersionSupported("2.1.0")) { command.add(LTTngControlServiceConstants.OPTION_FIELDS); } ICommandResult result = executeCommand(command, monitor, false); List<IUstProviderInfo> allProviders = new ArrayList<>(); if (!isVersionSupported("2.1.0") && (result.getResult() != 0)) { return allProviders; } if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_UST_NO_UST_PROVIDER_PATTERN)) { return allProviders; } if (isError(result)) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + toCommandString(command) + "\n" + result.toString()); } IUstProviderInfo provider = null; int index = 0; while (index < result.getOutput().length) { String line = result.getOutput()[index]; Matcher matcher = LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line); if (matcher.matches()) { provider = new UstProviderInfo(matcher.group(2).trim()); provider.setPid(Integer.valueOf(matcher.group(1).trim())); List<IBaseEventInfo> events = new ArrayList<>(); index = getProviderEventInfo(result.getOutput(), ++index, events); provider.setEvents(events); allProviders.add(provider); } else { index++; } } return allProviders; }
Source:
public com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.UpdateFirmwareResponse getUpdateFirmwareResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final UpdateFirmwareAsyncRequest request) throws OsgpException { LOGGER.info("GetUpdateFirmwareResponse Request received from organisation for device: {}.", organisationIdentification, request.getDeviceIdentification()); final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.UpdateFirmwareResponse response = new com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.ObjectFactory() .createUpdateFirmwareResponse(); try { final MeterResponseData meterResponseData = this.configurationService.dequeueUpdateFirmwareResponse(request .getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "updating firmware."); if (meterResponseData != null) { response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() != null) { final List<FirmwareVersion> target = response.getFirmwareVersion(); final UpdateFirmwareResponse updateFirmwareResponse = (UpdateFirmwareResponse) meterResponseData .getMessageData(); target.addAll(this.configurationMapper.mapAsList(updateFirmwareResponse.getFirmwareVersions(), FirmwareVersion.class)); } else { LOGGER.info("Update Firmware response is null"); } } } catch (final Exception e) { this.handleException(e); } return response; }

Target:
public com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.UpdateFirmwareResponse getUpdateFirmwareResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final UpdateFirmwareAsyncRequest request) throws OsgpException { LOGGER.info("GetUpdateFirmwareResponse Request received from organisation for device: {}.", organisationIdentification, request.getDeviceIdentification()); final com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.UpdateFirmwareResponse response = new com.alliander.osgp.adapter.ws.schema.smartmetering.configuration.UpdateFirmwareResponse(); try { final MeterResponseData meterResponseData = this.configurationService.dequeueUpdateFirmwareResponse(request .getCorrelationUid()); this.throwExceptionIfResultNotOk(meterResponseData, "updating firmware"); if (meterResponseData != null) { response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() != null) { final List<FirmwareVersion> target = response.getFirmwareVersion(); final UpdateFirmwareResponse updateFirmwareResponse = (UpdateFirmwareResponse) meterResponseData .getMessageData(); target.addAll(this.configurationMapper.mapAsList(updateFirmwareResponse.getFirmwareVersions(), FirmwareVersion.class)); } else { LOGGER.info("Update Firmware response is null"); } } } catch (final Exception e) { this.handleException(e); } return response; }
Source:
public RateLimiter provideRateLimiter() { LocalRateLimiter localRateLimiter=getLocalRateLimiter(); RedisRateLimiter redisRateLimiter=getRedisRateLimiter(); return new RateLimiter(configuration.getRateLimiterConfig().getRate(), configuration.getRateLimiterConfig().getRateForPost(), configuration.getRateLimiterConfig().getAuditRate(), configuration.getRateLimiterConfig().getPerMillis(), configuration.getRateLimiterConfig().getNoOfNodes(), localRateLimiter, getRedisRateLimiter()); }

Target:
public RateLimiter provideRateLimiter() { LocalRateLimiter localRateLimiter = getLocalRateLimiter(); RedisRateLimiter redisRateLimiter = getRedisRateLimiter(); return new RateLimiter(localRateLimiter, redisRateLimiter); }
Source:
public void isInProgress_shouldReturnTrueIfPerformedStatusIsInProgress() throws Exception { RadiologyStudy radiologystudy = new RadiologyStudy(); radiologystudy.setPerformedStatus(PerformedProcedureStepStatus.IN_PROGRESS); assertTrue(radiologystudy.isInProgress()); }

Target:
public void isInProgress_shouldReturnTrueIfPerformedStatusIsInProgress() throws Exception { RadiologyStudy radiologyStudy = new RadiologyStudy(); radiologyStudy.setPerformedStatus(PerformedProcedureStepStatus.IN_PROGRESS); assertTrue(radiologyStudy.isInProgress()); }
Source:
private static void parseToken(DirectiveNode node) { String code = node.getCode(); StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(code)); tokenizer.quoteChar('"'); try { while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) { if (tokenizer.sval != null) { if (node.getNodeName() == null) { node.setNodeName(tokenizer.sval); } else { node.getAttributes().add(new Attribute(tokenizer.sval)); } } } } catch (IOException e) { } }

Target:
private static void parseToken(DirectiveNode node) { String code = node.getCode(); try(Reader reader = new StringReader(code)) { StreamTokenizer tokenizer = new StreamTokenizer(reader); tokenizer.quoteChar('"'); while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) { if (tokenizer.sval != null) { if (node.getNodeName() == null) { node.setNodeName(tokenizer.sval); } else { node.getAttributes().add(new Attribute(tokenizer.sval)); } } } } catch (IOException e) { } }