auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected SSLContext getSslContext(ElasticSearchClientConfig config) { if (StringUtils.isBlank(config.getOption(KEYSTORE_PATH_OPT))) { return null; } try { Path keyStorePath = Paths.get(config.getOption(KEYSTORE_PATH_OPT)); String keyStorePass = config.getOption(KEYSTORE_PASSWORD_OPT); String keyStoreType = config.getOption(KEYSTORE_TYPE, KeyStore.getDefaultType()); char[] keyPass = StringUtils.isEmpty(keyStorePass)?null:keyStorePass.toCharArray(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); try (InputStream is = Files.newInputStream(keyStorePath)) { keyStore.load(is, keyPass); } SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(keyStore, null); return sslBuilder.build(); } catch (GeneralSecurityException | IOException e) { throw new NuxeoException("Cannot setup SSL for RestClient: " + config, e); } }

Target:
protected SSLContext getSslContext(ElasticSearchClientConfig config) { if (StringUtils.isBlank(config.getOption(KEYSTORE_PATH_OPT))) { return null; } try { Path keyStorePath = Paths.get(config.getOption(KEYSTORE_PATH_OPT)); String keyStorePass = config.getOption(KEYSTORE_PASSWORD_OPT); String keyStoreType = StringUtils.defaultIfBlank(config.getOption(KEYSTORE_TYPE_OPT), KeyStore.getDefaultType()); char[] keyPass = StringUtils.isBlank(keyStorePass) ? null : keyStorePass.toCharArray(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); try (InputStream is = Files.newInputStream(keyStorePath)) { keyStore.load(is, keyPass); } SSLContextBuilder sslBuilder = SSLContexts.custom().loadTrustMaterial(keyStore, null); return sslBuilder.build(); } catch (GeneralSecurityException | IOException e) { throw new NuxeoException("Cannot setup SSL for RestClient: " + config, e); } }
Source:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Set<String> groupByFields = conf.getGroupByFields(); List<GroupByConfig.FunctionInfo> aggregates = conf.getAggregates(); StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer(); Schema inputSchema = stageConfigurer.getInputSchema(); if (inputSchema == null) { stageConfigurer.setOutputSchema(null); return; } List<Schema.Field> outputFields = new ArrayList<>(groupByFields.size() + aggregates.size()); for (String groupByField : groupByFields) { Schema.Field field = inputSchema.getField(groupByField); if (field == null) { throw new IllegalArgumentException(String.format( "Cannot group by field '%s' because it does not exist in input schema %s.", groupByField, inputSchema)); } outputFields.add(field); } for (GroupByConfig.FunctionInfo functionInfo : aggregates) { if (functionInfo.getField().equals("*")) { AggregateFunction aggregateFunction = functionInfo.getAggregateFunction(null); outputFields.add(Schema.Field.of(functionInfo.getName(), aggregateFunction.getOutputSchema())); continue; } Schema.Field inputField = inputSchema.getField(functionInfo.getField()); if (inputField == null) { throw new IllegalArgumentException(String.format( "Invalid aggregate %s(%s): Field '%s' does not exist in input schema %s.", functionInfo.getFunction(), functionInfo.getField(), functionInfo.getField(), inputSchema)); } AggregateFunction aggregateFunction = functionInfo.getAggregateFunction(inputField.getSchema()); outputFields.add(Schema.Field.of(functionInfo.getName(), aggregateFunction.getOutputSchema())); } Schema outputSchema = Schema.recordOf(inputSchema.getRecordName() + ".agg", outputFields); stageConfigurer.setOutputSchema(outputSchema); }

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { Set<String> groupByFields = conf.getGroupByFields(); List<GroupByConfig.FunctionInfo> aggregates = conf.getAggregates(); StageConfigurer stageConfigurer = pipelineConfigurer.getStageConfigurer(); Schema inputSchema = stageConfigurer.getInputSchema(); if (inputSchema == null) { stageConfigurer.setOutputSchema(null); return; } stageConfigurer.setOutputSchema(getOutputSchema(inputSchema, groupByFields, aggregates)); }
Source:
private boolean hasIndirectDependent(Set<StructDef<?>> visited, StructDef<?> structDef) { for (StructDef<?> next : this.dependents) { if (visited.contains(next)) { continue; } visited.add(next); if (next.equals(structDef)) { return true; } if (next.hasIndirectDependent(visited, structDef)) { return true; } } return false; }

Target:
private boolean hasIndirectDependent(Set<StructDef<?>> visited, StructDef<?> structDef) { for (StructDef<?> next : this.dependents) { if (!visited.add(next)) { continue; } if (next.equals(structDef)) { return true; } if (next.hasIndirectDependent(visited, structDef)) { return true; } } return false; }
Source:
public Map<String, Set<String>> getPrincipalRoles(PID pid) { String pidString = pid.getRepositoryPath(); List<Entry<String, String>> objAcls = objAclCache.getUnchecked(pidString); Map<String, Set<String>> result = objAcls.stream() .filter(p -> roleUris.contains(p.getKey())) .collect(Collectors.groupingBy( Entry<String, String>::getValue, Collectors.mapping(Entry<String, String>::getKey, Collectors.toSet()) )); return result; }

Target:
public Map<String, Set<String>> getPrincipalRoles(PID pid) { Map<String, Set<String>> result = getObjectAcls(pid).stream() .filter(p -> roleUris.contains(p.getKey())) .collect(Collectors.groupingBy( Entry<String, String>::getValue, Collectors.mapping(Entry<String, String>::getKey, Collectors.toSet()) )); return result; }
Source:
public int compare(T a, T b) { int res = sortAscending ? comparator.compare(a, b) : comparator.compare(b, a); return res != 0 ? res : Integer.signum(positions.get(b) - positions.get(a)); }

Target:
public int compare(T a, T b) { int res = sortAscending ? comparator.compare(a, b) : comparator.compare(b, a); return (res != 0) ? res : Integer.signum(insertionIndex.get(a) - insertionIndex.get(b)); }
Source:
private void renderRow(SafeHtmlBuilder sb) { sb.openDiv().setStyleName(RelatedChanges.R.css().row()); sb.openSpan().setStyleName(RelatedChanges.R.css().pointer()); sb.append(POINTER_HTML); sb.closeSpan(); sb.openSpan().setStyleName(RelatedChanges.R.css().subject()); String url = url(); if (url != null) { sb.openAnchor().setAttribute("href", url); if (url.startsWith("#")) { sb.setAttribute("onclick", OPEN); } if (showBranches) { sb.append(info.branch()).append(": "); } sb.append(info.commit().subject()); sb.closeAnchor(); } else { sb.append(info.commit().subject()); } sb.closeSpan(); sb.openSpan(); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && (!info.has_change_number() || !info.has_revision_number())) { sb.setStyleName(RelatedChanges.R.css().gitweb()); sb.setAttribute("title", gw.getLinkName()); sb.append('\u25CF'); } else if (connected) { sb.setStyleName(RelatedChanges.R.css().indirect()); sb.setAttribute("title", Resources.C.indirectAncestor()); sb.append('~'); } else if (info.has_current_revision_number() && info.has_revision_number() && info._current_revision_number() != info._revision_number()) { sb.setStyleName(RelatedChanges.R.css().notCurrent()); sb.setAttribute("title", Util.C.notCurrent()); sb.append('\u25CF'); } else { sb.setStyleName(RelatedChanges.R.css().current()); } sb.closeSpan(); sb.closeDiv(); }

Target:
private void renderRow(SafeHtmlBuilder sb) { sb.openDiv().setStyleName(RelatedChanges.R.css().row()); sb.openSpan().setStyleName(RelatedChanges.R.css().pointer()); sb.append(POINTER_HTML); sb.closeSpan(); sb.openSpan().setStyleName(RelatedChanges.R.css().subject()); String url = url(); if (url != null) { sb.openAnchor().setAttribute("href", url); if (url.startsWith("#")) { sb.setAttribute("onclick", OPEN); } if (showBranches) { sb.append(info.branch()).append(": "); } sb.append(info.commit().subject()); sb.closeAnchor(); } else { sb.append(info.commit().subject()); } sb.closeSpan(); sb.openSpan(); GitwebLink gw = Gerrit.getGitwebLink(); if (gw != null && (!info.has_change_number() || !info.has_revision_number())) { sb.setStyleName(RelatedChanges.R.css().gitweb()); sb.setAttribute("title", gw.getLinkName()); sb.append('\u25CF'); } else if (notConnected) { sb.setStyleName(RelatedChanges.R.css().indirect()); sb.setAttribute("title", Resources.C.indirectAncestor()); sb.append('~'); } else if (info.has_current_revision_number() && info.has_revision_number() && info._current_revision_number() != info._revision_number()) { sb.setStyleName(RelatedChanges.R.css().notCurrent()); sb.setAttribute("title", Util.C.notCurrent()); sb.append('\u25CF'); } else { sb.setStyleName(RelatedChanges.R.css().current()); } sb.closeSpan(); sb.closeDiv(); }
Source:
public void testAuthorResponse() { String xml = read(prefix("peer-review.pone.0207232.xml")); String html = service.transformXmlToHtml(xml, DEFAULT_PEER_REVIEW_XSL); Document doc = Jsoup.parse(html); assertThat(doc.select(".review-history .revision .letter__title").get(0).text(), containsString("Original Submission")); assertThat(doc.select(".review-history .revision .letter__date").get(0).text(), containsString("June 1, 2018")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(0).text(), containsString("September 12, 2018")); assertThat(doc.select(".review-history .decision-letter span[itemprop=name]").get(0).text(), containsString("Qinghui Zhang, Editor, Surachai Supattapone, Editor")); assertThat(doc.select(".review-history .revision .letter__title").get(1).text(), containsString("Revision 1")); Element authorResponseDiv = doc.select(".author-response").first(); assertThat(authorResponseDiv.text(), containsString("Author Response")); Element attachmentElem = authorResponseDiv.select(".review-files .supplementary-material").first(); assertThat(attachmentElem.text(), containsString("Response to Reviewers.docx")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(1).text(), containsString("October 9, 2018")); assertThat(doc.select(".review-history .decision-letter span[itemprop=name]").get(1).text(), containsString("Qinghui Zhang, Editor")); }

Target:
public void testAuthorResponse() { String xml = read(prefix("peer-review.pone.0207232.xml")); String html = service.transformXmlToHtml(xml, DEFAULT_PEER_REVIEW_XSL); Document doc = Jsoup.parse(html); assertThat(doc.select(".review-history .revision .letter__title").get(0).text(), containsString("Original Submission")); assertThat(doc.select(".review-history .revision .letter__date").get(0).text(), containsString("June 1, 2018")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(0).text(), containsString("September 12, 2018")); assertEquals("Qinghui Zhang, Editor, Surachai Supattapone, Editor", doc.select(".review-history .decision-letter span[itemprop=name]").get(0).text()); assertThat(doc.select(".review-history .revision .letter__title").get(1).text(), containsString("Revision 1")); Element authorResponseDiv = doc.select(".author-response").first(); assertThat(authorResponseDiv.text(), containsString("Author Response")); Element attachmentElem = authorResponseDiv.select(".review-files .supplementary-material").first(); assertThat(attachmentElem.text(), containsString("Response to Reviewers.docx")); assertThat(doc.select(".review-history .decision-letter .letter__date").get(1).text(), containsString("October 9, 2018")); assertEquals("Qinghui Zhang, Editor", doc.select(".review-history .decision-letter span[itemprop=name]").get(1).text()); }
Source:
public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); conf.set("dt.application.FilterExample.operator.selectedOutput.prop.filePath", outputDir); conf.set("dt.application.FilterExample.operator.rejectedOutput.prop.filePath", outputDir); File selectedfile = FileUtils.getFile(outputDir, "selected.txt_6.0"); File rejectedfile = FileUtils.getFile(outputDir, "rejected.txt_8.0"); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); while (!selectedfile.exists()) { System.out.println("Sleeping ...."); Thread.sleep(1000); } while (!rejectedfile.exists()) { System.out.println("Sleeping ...."); Thread.sleep(1000); } lc.shutdown(); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/selected.txt" ),selectedfile)); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/rejected.txt" ),rejectedfile)); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }

Target:
public void testApplication() throws IOException, Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); conf.addResource(this.getClass().getResourceAsStream("/META-INF/properties.xml")); conf.set("dt.application.FilterExample.operator.selectedOutput.prop.filePath", outputDir); conf.set("dt.application.FilterExample.operator.rejectedOutput.prop.filePath", outputDir); final File selectedfile = FileUtils.getFile(outputDir, "selected.txt_6.0"); final File rejectedfile = FileUtils.getFile(outputDir, "rejected.txt_8.0"); lma.prepareDAG(new Application(), conf); LocalMode.Controller lc = lma.getController(); lc.setHeartbeatMonitoringEnabled(false); ((StramLocalCluster)lc).setExitCondition(new Callable<Boolean>() { @Override public Boolean call() throws Exception { if (selectedfile.exists() && rejectedfile.exists()) { return true; } return false; } }); lc.run(40000); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/selected_output.txt" ),selectedfile)); Assert.assertTrue( FileUtils.contentEquals( FileUtils.getFile( "src/main/resources/META-INF/rejected_output.txt" ),rejectedfile)); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } }
Source:
default Object getProperty(String key, Object defaultValue) { Object value = getInternalProperty(key); if (value == null) { value = defaultValue; } return value; }

Target:
default Object getProperty(String key, Object defaultValue) { Object value = getInternalProperty(key); return value != null ? value : defaultValue; }
Source:
private void sortByTotalStudentsDescending(List<InstituteStats> list) { list.sort((institute1, institute2) -> { return Integer.compare(institute2.studentTotal, institute1.studentTotal); }); }

Target:
private void sortByTotalStudentsDescending(List<InstituteStats> list) { list.sort(Comparator.comparing((InstituteStats institute) -> institute.studentTotal).reversed()); }
Source:
public void release() { JdbcConnectionAccess connectionAccess = jdbcContext.getJdbcConnectionAccess(); if( !( connectionAccess instanceof JdbcConnectionAccessProvidedConnectionImpl ) ) { throw new IllegalStateException( "DdlTransactionIsolatorProvidedConnectionImpl should always use a JdbcConnectionAccessProvidedConnectionImpl" ); } JdbcConnectionAccessProvidedConnectionImpl connectionAccessProvidedConnection = (JdbcConnectionAccessProvidedConnectionImpl) connectionAccess; try { connectionAccess.releaseConnection( null ); } catch (SQLException ignore) { LOG.unableToReleaseIsolatedConnection( ignore ); } }

Target:
public void release() { JdbcConnectionAccess connectionAccess = jdbcContext.getJdbcConnectionAccess(); if( !( connectionAccess instanceof JdbcConnectionAccessProvidedConnectionImpl ) ) { throw new IllegalStateException( "DdlTransactionIsolatorProvidedConnectionImpl should always use a JdbcConnectionAccessProvidedConnectionImpl" ); } try { connectionAccess.releaseConnection( null ); } catch (SQLException ignore) { LOG.unableToReleaseIsolatedConnection( ignore ); } }
Source:
protected void onResume() { super.onResume(); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); boolean state = appPrefs.getBoolean(PassCodeActivity.PREFERENCE_SET_PASSCODE, false); pCode.setChecked(state); boolean patternState = appPrefs.getBoolean(PatternLockActivity.PREFERENCE_SET_PATTERN,false); patternCode.setChecked(patternState); }

Target:
protected void onResume() { super.onResume(); SharedPreferences appPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); boolean passCodeState = appPrefs.getBoolean(PassCodeActivity.PREFERENCE_SET_PASSCODE, false); pCode.setChecked(passCodeState); boolean patternState = appPrefs.getBoolean(PatternLockActivity.PREFERENCE_SET_PATTERN,false); pPattern.setChecked(patternState); }
Source:
public void testListFilesRecursiveWhenAllListingsAreAuthoritative() throws Exception { describe("listFiles does not make further calls to the fs when" + "all nested directory listings are authoritative"); Set<Path> files = new HashSet<>(); Path parentDir = dir; Path parentFile = dirFile; Path nestedDir1 = new Path(dir, "nested1"); Path nestedFile1 = new Path(nestedDir1, "nestedFile1"); Path nestedDir2 = new Path(nestedDir1, "nested2/"); Path nestedFile2 = new Path(nestedDir2, "nestedFile2"); files.add(parentFile); files.add(nestedFile1); files.add(nestedFile2); authFS.mkdirs(parentDir); authFS.mkdirs(nestedDir1); authFS.mkdirs(nestedDir2); touchFile(parentFile); touchFile(nestedFile1); touchFile(nestedFile2); authFS.listStatus(parentDir); authFS.listStatus(nestedDir1); authFS.listStatus(nestedDir2); S3AStorageStatistics statistics = authFS.getStorageStatistics(); statistics.reset(); RemoteIterator<LocatedFileStatus> statusIterator = authFS.listFiles(dir, true); while (statusIterator.hasNext()) { LocatedFileStatus locatedFileStatus = statusIterator.next(); assertTrue("This path does not exist in original listing: " + locatedFileStatus.getPath(), files.remove(locatedFileStatus.getPath())); } assertEquals("Some files were missing from authoritative listing:" + Arrays.toString(files.toArray()), 0, files.size()); assertEquals("There must not be any OBJECT_LIST requests" + "as all directory listings are authoritative.", 0, (long) statistics.getLong(OBJECT_LIST_REQUESTS.getSymbol())); }

Target:
public void testListFilesRecursiveWhenAllListingsAreAuthoritative() throws Exception { describe("listFiles does not make further calls to the fs when" + "all nested directory listings are authoritative"); Set<Path> originalFiles = new HashSet<>(); Path parentDir = dir; Path parentFile = dirFile; Path nestedDir1 = new Path(dir, "nested1"); Path nestedFile1 = new Path(nestedDir1, "nestedFile1"); Path nestedDir2 = new Path(nestedDir1, "nested2/"); Path nestedFile2 = new Path(nestedDir2, "nestedFile2"); originalFiles.add(parentFile); originalFiles.add(nestedFile1); originalFiles.add(nestedFile2); mkAuthDir(parentDir); mkAuthDir(nestedDir1); mkAuthDir(nestedDir2); touchFile(parentFile); touchFile(nestedFile1); touchFile(nestedFile2); S3ATestUtils.MetricDiff objListRequests = new S3ATestUtils.MetricDiff(authFS, OBJECT_LIST_REQUESTS); RemoteIterator<LocatedFileStatus> statusIterator = authFS.listFiles(dir, true); List<Path> pathsFromStatusIterator = toPaths(statusIterator); Assertions.assertThat(pathsFromStatusIterator) .as("listFiles should return all the items in actual" + "S3 directory and nothing more") .hasSameElementsAs(originalFiles) .hasSameSizeAs(originalFiles); objListRequests.assertDiffEquals("There must not be any OBJECT_LIST " + "requests as all directory listings are authoritative", 0); }
Source:
private void updateGitIgnore(File gitIgnore, String entry) throws CoreException { try { if (!gitIgnore.exists()) { if (!gitIgnore.createNewFile()) { String error = NLS.bind( CoreText.IgnoreOperation_creatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, null)); } } else entry = getEntry(gitIgnore, entry); FileOutputStream os = new FileOutputStream(gitIgnore, true); try { os.write(entry.getBytes()); } finally { os.close(); } } catch (IOException e) { String error = NLS.bind(CoreText.IgnoreOperation_updatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, e)); } }

Target:
private void updateGitIgnore(File gitIgnore, String entry) throws CoreException { try { String ignoreLine = entry; if (!gitIgnore.exists()) if (!gitIgnore.createNewFile()) { String error = NLS.bind( CoreText.IgnoreOperation_creatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, null)); } else ignoreLine = getEntry(gitIgnore, ignoreLine); FileOutputStream os = new FileOutputStream(gitIgnore, true); try { os.write(ignoreLine.getBytes()); } finally { os.close(); } } catch (IOException e) { String error = NLS.bind(CoreText.IgnoreOperation_updatingFailed, gitIgnore.getAbsolutePath()); throw new CoreException(Activator.error(error, e)); } }
Source:
public static TableName newTestTableName() { return TableName.valueOf("test_table-" + UUID.randomUUID().toString()); }

Target:
public static TableName newTestTableName() { return TableName.valueOf("test-dataflow-" + UUID.randomUUID().toString()); }
Source:
private TableRow<Replay> replayRowFactory() { TableRow<Replay> row = new TableRow<>(); ContextMenu contextMenu = new ContextMenu(); MenuItem copyReplayId = new MenuItem("Copy Replay Id"); copyReplayId.setOnAction(event -> { var replayId = row.getItem().getId(); final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putString(String.valueOf(replayId)); clipboard.setContent(content); }); MenuItem copyReplayPath = new MenuItem("Copy Replay Path"); copyReplayPath.setOnAction(event -> { var replayPath = row.getItem().getReplayFile(); final Clipboard clipboard = Clipboard.getSystemClipboard(); final ClipboardContent content = new ClipboardContent(); content.putString(String.valueOf(replayPath)); clipboard.setContent(content); }); contextMenu.getItems().addAll(copyReplayId, copyReplayPath); row.setContextMenu(contextMenu); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && !row.isEmpty() && row.getItem().getId() != 0) { replayService.runReplay(row.getItem()); } }); return row; }

Target:
private TableRow<Replay> replayRowFactory() { TableRow<Replay> row = new TableRow<>(); ContextMenu contextMenu = replayRowContextMenuFactory(row); row.setContextMenu(contextMenu); row.setOnMouseClicked(event -> { if (event.getClickCount() == 2 && !row.isEmpty() && row.getItem().getId() != 0) { replayService.runReplay(row.getItem()); } }); return row; }
Source:
public void clear() { try { getDiskCache().delete(); diskLruCache = null; } catch (IOException e) { if (Log.isLoggable(TAG, Log.WARN)) { Log.w(TAG, "Unable to clear disk cache", e); } } }

Target:
public synchronized void clear() { try { getDiskCache().delete(); resetDiskCache(); } catch (IOException e) { if (Log.isLoggable(TAG, Log.WARN)) { Log.w(TAG, "Unable to clear disk cache", e); } } }
Source:
public String validateSchema(FormDataMultiPart multiPart) { Schema schema = getSchemaFromMultiPart(multiPart); try { SchemaUtils.validate(schema); } catch (Exception e) { throw new ControllerApplicationException(LOGGER, String.format("Invalid schema:%s.", schema.getSchemaName()), Response.Status.BAD_REQUEST, e); } return schema.toPrettyJsonString(); }

Target:
public String validateSchema(FormDataMultiPart multiPart) { Schema schema = getSchemaFromMultiPart(multiPart); try { SchemaUtils.validate(schema); } catch (Exception e) { throw new ControllerApplicationException(LOGGER, "Invalid schema: " + schema.getSchemaName(), Response.Status.BAD_REQUEST, e); } return schema.toPrettyJsonString(); }
Source:
public void testServerInfo() throws Exception { final HttpGet get = new HttpGet(url.toExternalForm() + "jaxrs/test/server/info"); final HttpResponse response = HTTP_CLIENT.execute(get); final HttpEntity entity = response.getEntity(); Assert.assertNotNull("Null entity!", entity); final String content = EntityUtils.toString(response.getEntity()); Assert.assertTrue("Wrong content! " + content, content.contains("WildFly")); }

Target:
public void testServerInfo() throws Exception { final HttpGet get = new HttpGet(url.toExternalForm() + "jaxrs/test/server/info"); final HttpResponse response = HTTP_CLIENT.execute(get); final HttpEntity entity = response.getEntity(); Assert.assertNotNull("Null entity!", entity); final String content = EntityUtils.toString(response.getEntity()); Assert.assertTrue("Wrong content! " + content, content.matches("WildFly Full .*\\(WildFly Core .*\\) - .*")); }
Source:
public void testDisposalOfFileResources() throws Exception { final Application application = new UnitTestApplication(); final SessionID sessionID = new SessionID( FixVersions.BEGINSTRING_FIX44, "SENDER", "TARGET"); final MessageStoreFactory mockMessageStoreFactory = mock(MessageStoreFactory.class); final CloseableMessageStore mockMessageStore = mock(CloseableMessageStore.class); stub(mockMessageStoreFactory.create(sessionID)).toReturn( mockMessageStore); final LogFactory mockLogFactory = mock(LogFactory.class); final CloseableLog mockLog = mock(CloseableLog.class); stub(mockLogFactory.create(sessionID)).toReturn(mockLog); try (Session session = new Session(application, mockMessageStoreFactory, sessionID, null, null, mockLogFactory, new DefaultMessageFactory(), 30, false, 30, UtcTimestampPrecision.MILLIS, true, false, false, false, false, false, true, false, 1.5, null, true, new int[] { 5 }, false, false, false, false, true, false, true, false, null, true, 0, false, false, true, new ArrayList<>(), 1.4)) { session.setResponder(null); } verify(mockMessageStore).close(); verifyNoMoreInteractions(mockMessageStore); verify(mockLog, atLeastOnce()).onEvent(anyString()); verify(mockLog).close(); verifyNoMoreInteractions(mockLog); }

Target:
public void testDisposalOfFileResources() throws Exception { final Application application = new UnitTestApplication(); final SessionID sessionID = new SessionID( FixVersions.BEGINSTRING_FIX44, "SENDER", "TARGET"); final MessageStoreFactory mockMessageStoreFactory = mock(MessageStoreFactory.class); final CloseableMessageStore mockMessageStore = mock(CloseableMessageStore.class); stub(mockMessageStoreFactory.create(sessionID)).toReturn( mockMessageStore); final LogFactory mockLogFactory = mock(LogFactory.class); final CloseableLog mockLog = mock(CloseableLog.class); stub(mockLogFactory.create(sessionID)).toReturn(mockLog); try (Session session = new Session(application, mockMessageStoreFactory, sessionID, null, null, mockLogFactory, new DefaultMessageFactory(), 30, false, 30, UtcTimestampPrecision.MILLIS, true, false, false, false, false, false, true, false, 1.5, null, true, new int[] { 5 }, false, false, false, false, true, false, true, false, null, true, 0, false, false, true, new ArrayList<>(), Session.DEFAULT_HEARTBEAT_TIMEOUT_MULTIPLIER)) { session.setResponder(null); } verify(mockMessageStore).close(); verifyNoMoreInteractions(mockMessageStore); verify(mockLog, atLeastOnce()).onEvent(anyString()); verify(mockLog).close(); verifyNoMoreInteractions(mockLog); }
Source:
private void candidateBatchSizeDecreasesToAMinimumOfOne() { int newValue = adjustableConfig.getAdjustedSweepConfig().candidateBatchSize(); if (newValue == 1) { return; } assertThat(newValue, is(lessThan(previousCandidateBatchSize))); }

Target:
private void candidateBatchSizeDecreasesToAMinimumOfOne() { decreasesToOne(SweepBatchConfig::candidateBatchSize); }
Source:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, null)); } catch (OpenStackResponseException e) { StringBuilder builder = new StringBuilder(); builder.append(e.getMessage()).append("(").append(e.getStatus()).append(")"); log.error(builder.toString(), e); throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }

Target:
public void testConnection() { try { getClient().execute(new OpenStackRequest<>(getClient(), HttpMethod.GET, "", null, null)); } catch (OpenStackResponseException e) { log.error("{} (OpenStack response error code: {})", e.getMessage(), e.getStatus()); log.debug("Exception", e); throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } catch (RuntimeException e) { throw new VdcBLLException(VdcBllErrors.PROVIDER_FAILURE, e); } }
Source:
protected void initListeners() { super.initListeners(); infoItemBuilder.setOnStreamSelectedListener(new OnClickGesture<StreamInfoItem>() { @Override public void selected(StreamInfoItem selectedItem) { selectAndLoadVideo(selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName()); } @Override public void held(StreamInfoItem selectedItem) { showStreamDialog(selectedItem); } }); videoTitleRoot.setOnClickListener(this); uploaderRootLayout.setOnClickListener(this); thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); detailControlsPopup.setOnClickListener(this); detailControlsAddToPlaylist.setOnClickListener(this); detailControlsDownload.setOnClickListener(this); detailControlsDownload.setOnLongClickListener(this); relatedStreamExpandButton.setOnClickListener(this); switchAutoplay.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { SharedPreferences autoplaysetting = PreferenceManager.getDefaultSharedPreferences(activity); if(switchAutoplay.isChecked()){ autoplaysetting.edit().putBoolean(getString(R.string.auto_queue_key),true).apply(); }else{ autoplaysetting.edit().putBoolean(getString(R.string.auto_queue_key),false).apply(); } } }); detailControlsBackground.setLongClickable(true); detailControlsPopup.setLongClickable(true); detailControlsBackground.setOnLongClickListener(this); detailControlsPopup.setOnLongClickListener(this); detailControlsBackground.setOnTouchListener(getOnControlsTouchListener()); detailControlsPopup.setOnTouchListener(getOnControlsTouchListener()); }

Target:
protected void initListeners() { super.initListeners(); infoItemBuilder.setOnStreamSelectedListener(new OnClickGesture<StreamInfoItem>() { @Override public void selected(StreamInfoItem selectedItem) { selectAndLoadVideo(selectedItem.getServiceId(), selectedItem.getUrl(), selectedItem.getName()); } @Override public void held(StreamInfoItem selectedItem) { showStreamDialog(selectedItem); } }); videoTitleRoot.setOnClickListener(this); uploaderRootLayout.setOnClickListener(this); thumbnailBackgroundButton.setOnClickListener(this); detailControlsBackground.setOnClickListener(this); detailControlsPopup.setOnClickListener(this); detailControlsAddToPlaylist.setOnClickListener(this); detailControlsDownload.setOnClickListener(this); detailControlsDownload.setOnLongClickListener(this); relatedStreamExpandButton.setOnClickListener(this); switchAutoplay.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { PreferenceManager.getDefaultSharedPreferences(activity).edit() .putBoolean(getString(R.string.auto_queue_key),switchAutoplay.isChecked()) .apply(); } }); detailControlsBackground.setLongClickable(true); detailControlsPopup.setLongClickable(true); detailControlsBackground.setOnLongClickListener(this); detailControlsPopup.setOnLongClickListener(this); detailControlsBackground.setOnTouchListener(getOnControlsTouchListener()); detailControlsPopup.setOnTouchListener(getOnControlsTouchListener()); }
Source:
protected void initConditions() { conditionSpark1 = new MultiComponentCondition( new BasicExpression(SparkBatchConstant.SPARK_LOCAL_MODE_PARAMETER, EqualityOperator.EQ, "false"), BooleanOperator.AND, new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_1_6.getSparkVersion())); conditionSpark2 = new MultiComponentCondition( new BasicExpression(SparkBatchConstant.SPARK_LOCAL_MODE_PARAMETER, EqualityOperator.EQ, "false"), BooleanOperator.AND, new MultiComponentCondition( new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_2.getSparkVersion()), BooleanOperator.OR, new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_4.getSparkVersion())) ); }

Target:
protected void initConditions() { conditionSpark2 = new MultiComponentCondition( new BasicExpression(SparkBatchConstant.SPARK_LOCAL_MODE_PARAMETER, EqualityOperator.EQ, "false"), BooleanOperator.AND, new BasicExpression("SUPPORTED_SPARK_VERSION", EqualityOperator.EQ, ESparkVersion.SPARK_2_4.getSparkVersion())); }
Source:
private static boolean rename(File source, File target) throws IOException { Files.move(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING); return true; }

Target:
private static void rename(File source, File target) throws IOException { Files.move(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING); }
Source:
private void updateTranscriptVisibility(int visibility) { Fragment fragment = getParentFragment(); if (fragment instanceof CourseUnitVideoFragment) { ((CourseUnitVideoFragment) fragment).updateTranscriptVisibility(visibility); } }

Target:
private void updateTranscriptVisibility(int visibility) { final Fragment fragment = getParentFragment(); if (fragment instanceof CourseUnitVideoFragment) { ((CourseUnitVideoFragment) fragment).updateBottomSectionVisibility(visibility); } }
Source:
public int read(byte[] b, int off, int len) throws IOException { validateParameters(b, off, len); if (len == 0) { return 0; } if (!subscribed) { blockForData(); } if (this.buffer == null) { if (this.lastError != null) { throw logger.logThrowableAsError(this.lastError); } if (this.fluxComplete) { return -1; } this.buffer = new ByteArrayInputStream(new byte[0]); } if (this.buffer.available() == 0) { if (this.fluxComplete) { return -1; } blockForData(); } if (this.buffer.available() > 0) { return this.buffer.read(b, off, len); } if (this.fluxComplete) { return -1; } else { throw logger.logExceptionAsError(new IllegalStateException("An unexpected error occurred. No data was " + "read from the stream but the stream did not indicate completion.")); } }

Target:
public int read(byte[] b, int off, int len) throws IOException { validateParameters(b, off, len); if (len == 0) { return 0; } if (!subscribed) { blockForData(); } if (this.buffer == null) { if (this.lastError != null) { throw logger.logThrowableAsError(this.lastError); } if (this.fluxComplete) { return -1; } throw logger.logExceptionAsError(new IllegalStateException("An unexpected error occurred. No data was " + "read from the stream but the stream did not indicate completion.")); } if (this.buffer.available() == 0) { if (this.fluxComplete) { return -1; } blockForData(); } if (this.buffer.available() > 0) { return this.buffer.read(b, off, len); } if (this.fluxComplete) { return -1; } else { throw logger.logExceptionAsError(new IllegalStateException("An unexpected error occurred. No data was " + "read from the stream but the stream did not indicate completion.")); } }
Source:
public static VgpuPlacementEnum forValue(int value) { return values()[value]; }

Target:
public static VgpuPlacementEnum forValue(int value) { return Arrays.stream(values()).filter(e -> e.getValue() == value).findFirst().get(); }
Source:
public void testClearExpiredDeviceCodes() { expiredDeviceCodes1 = Sets.newHashSet(deviceCode1, deviceCode2); expiredDeviceCodes2 = Sets.newHashSet(); Mockito.when(repository.getExpiredCodes()).thenReturn(expiredDeviceCodes1, expiredDeviceCodes1,expiredDeviceCodes2); service.clearExpiredDeviceCodes(); Mockito.verify(repository, atLeast(2)).remove(Matchers.any(DeviceCode.class)); Mockito.verify(repository,times(4)).getExpiredCodes(); }

Target:
public void testClearExpiredDeviceCodes() { java.util.concurrent.ArrayBlockingQueue<DeviceCode> deviceCodesList = new ArrayBlockingQueue<>(2); deviceCodesList.add(deviceCode1); deviceCodesList.add(deviceCode2); when(repository.getExpiredCodes()).thenReturn(deviceCodesList); Answer<java.util.concurrent.ArrayBlockingQueue<DeviceCode>> answer = new Answer<java.util.concurrent.ArrayBlockingQueue<DeviceCode>>() { @Override public java.util.concurrent.ArrayBlockingQueue<DeviceCode> answer(InvocationOnMock invocation) throws Throwable { deviceCodesList.remove(); return deviceCodesList; } }; doAnswer(answer).when(repository).remove(Matchers.any(DeviceCode.class)); service.clearExpiredDeviceCodes(); assertThat(0, equalTo(deviceCodesList.size())); }
Source:
public void getAttributesByIdsAndPrimaryHolder() throws Exception { System.out.println(CLASS_NAME + "getAttributesByIdsAndPrimaryHolder"); Attribute groupAttr = setUpGroupAttribute(); Attribute groupResourceAttr = setUpGroupResourceAttribute(); AttributeDefinition groupAttrDef = setUpGroupAttributeDefinition(); AttributeDefinition resourceAttrDef = setUpResourceAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); cacheManager.setAttribute(groupResourceAttr, groupHolder, resourceHolder); List<Integer> attributeIds = new ArrayList<>(); attributeIds.add(groupAttr.getId()); attributeIds.add(groupResourceAttr.getId()); attributeIds.add(groupAttrDef.getId()); attributeIds.add(resourceAttrDef.getId()); List<Attribute> attrs = cacheManager.getAttributesByIds(attributeIds, groupHolder); assertTrue("result should contain group attribute", attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(new Attribute(groupAttrDef))); assertTrue("it should return 2 attributes", attrs.size() == 2); }

Target:
public void getAttributesByIdsAndPrimaryHolder() throws Exception { System.out.println(CLASS_NAME + "getAttributesByIdsAndPrimaryHolder"); Attribute groupAttr = setUpGroupAttribute(); Attribute groupResourceAttr = setUpGroupResourceAttribute(); AttributeDefinition groupAttrDef = setUpGroupAttributeDefinition(); AttributeDefinition resourceAttrDef = setUpResourceAttributeDefinition(); cacheManager.setAttribute(groupAttr, groupHolder, null); cacheManager.setAttribute(groupResourceAttr, groupHolder, resourceHolder); List<Integer> attributeIds = new ArrayList<>(); attributeIds.add(groupAttr.getId()); attributeIds.add(groupResourceAttr.getId()); attributeIds.add(groupAttrDef.getId()); attributeIds.add(resourceAttrDef.getId()); List<Attribute> attrs = cacheManager.getAttributesByIds(attributeIds, groupHolder); assertTrue("result should contain group attribute", attrs.contains(groupAttr)); assertTrue("result should contain group attribute definition", attrs.contains(groupAttrDef)); assertTrue("it should return 2 attributes", attrs.size() == 2); }
Source:
public Date getDate() { if (Objects.isNull(date) && Objects.nonNull(getValue())) { try { date = new SimpleDateFormat("yyyy-mm-dd").parse(getValue()); } catch (ParseException e) { logger.error(e.getLocalizedMessage()); } } return date; }

Target:
public Date getDate() { if (Objects.isNull(date) && Objects.nonNull(getValue())) { try { date = new SimpleDateFormat("yyyy-mm-dd").parse(getValue()); } catch (ParseException e) { logger.error(e.getLocalizedMessage(), e); } } return date; }
Source:
public boolean removeVertex(final V v) { final Set<V> neighbors = adjacent.remove(v); if (neighbors != null) { inDegrees.remove(v); for (final V neighbor : neighbors) { final int inDegree = inDegrees.get(neighbor) - 1; inDegrees.put(neighbor, inDegree); if (inDegree == 0) { rootVertices.add(neighbor); } } rootVertices.remove(v); return true; } else { LOG.log(Level.WARNING, "The vertex {0} does exists", new Object[]{v}); return false; } }

Target:
public boolean removeVertex(final V v) { final Set<V> neighbors = adjacent.remove(v); if (neighbors != null) { inDegrees.remove(v); for (final V neighbor : neighbors) { final int inDegree = inDegrees.get(neighbor) - 1; inDegrees.put(neighbor, inDegree); if (inDegree == 0) { rootVertices.add(neighbor); } } rootVertices.remove(v); return true; } else { LOG.log(Level.WARNING, "The vertex {0} does exists", v); return false; } }
Source:
private List<String> dbTablePK(DatabaseMetaData meta, String tableName) throws OrmException, SQLException { ResultSet cols = meta.getPrimaryKeys(null, null, tableName.toUpperCase()); Map<Short, String> seqToName = new HashMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); } List<String> pk = new ArrayList<>(); for (short i = 1; i <= seqToName.size(); i++) { pk.add(seqToName.get(i).toUpperCase()); } return pk; }

Target:
private List<String> dbTablePK(DatabaseMetaData meta, String tableName) throws OrmException, SQLException { ResultSet cols = meta.getPrimaryKeys(null, null, tableName.toUpperCase()); try { Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); } List<String> pk = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.add(name.toUpperCase(Locale.US)); } return pk; } finally { cols.close(); } }
Source:
private RootBeanDefinition createBeanDefinition() { RootBeanDefinition beanDefinition = new RootBeanDefinition("com.acme.MyRepository"); ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues(); constructorArgumentValues.addGenericArgumentValue(MyRepository.class); beanDefinition.setConstructorArgumentValues(constructorArgumentValues); return beanDefinition; }

Target:
private static RootBeanDefinition createBeanDefinition() { RootBeanDefinition beanDefinition = new RootBeanDefinition("com.acme.MyRepository"); ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues(); constructorArgumentValues.addGenericArgumentValue(MyRepository.class); beanDefinition.setConstructorArgumentValues(constructorArgumentValues); return beanDefinition; }
Source:
protected void innerDraw(GC gc) { Rectangle bounds = getBounds(); gc.fillRoundRectangle(bounds.x, bounds.y, bounds.width, bounds.height, fArc, fArc); RGBAColor backgroundColor = getBackgroundColor(); if (fLabel != null && !fLabel.isEmpty() && bounds.width > bounds.height && backgroundColor != null) { gc.setForeground(Utils.getDistinctColor(RGBAUtil.fromRGBAColor(backgroundColor).rgb)); Utils.drawText(gc, fLabel, bounds.x, bounds.y, bounds.width, bounds.height, true, true); } }

Target:
protected void innerDraw(GC gc) { Rectangle bounds = getBounds(); gc.fillRoundRectangle(bounds.x, bounds.y, bounds.width, bounds.height, fArc, fArc); }
Source:
private static void addUsbControllers(VmBase vm, int numOfControllers) { for (int index = 0; index < numOfControllers; index++) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.CONTROLLER, VmDeviceType.USB, getUsbControllerSpecParams(EHCI_MODEL, 1, index), true, false, ""); for (int companionIndex = 1; companionIndex <= COMPANION_USB_CONTROLLERS; companionIndex++) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.CONTROLLER, VmDeviceType.USB, getUsbControllerSpecParams(UHCI_MODEL, companionIndex, index), true, false, ""); } } }

Target:
private static void addUsbControllers(VmBase vm, int numOfControllers) { for (int index = 0; index < numOfControllers; index++) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.CONTROLLER, VmDeviceType.USB, getUsbControllerSpecParams(EHCI_MODEL, 1, index), true, false); for (int companionIndex = 1; companionIndex <= COMPANION_USB_CONTROLLERS; companionIndex++) { VmDeviceUtils.addManagedDevice(new VmDeviceId(Guid.NewGuid(), vm.getId()), VmDeviceType.CONTROLLER, VmDeviceType.USB, getUsbControllerSpecParams(UHCI_MODEL, companionIndex, index), true, false); } } }
Source:
public void setUpZap() throws Exception { super.setUpZap(); Path xmlDir = Files.createDirectories(Paths.get(Constant.getZapHome(), "xml")); Path testFile = xmlDir.resolve("application_errors.xml"); String content = "<?xml version=\"1.0\" standalone=\"no\"?>\n" + "<!-- \n" + "UnitTest File\n" + "-->\n" + "<Patterns>\n" + " <Pattern type=\"string\">Microsoft OLE DB Provider for ODBC Drivers</Pattern>\n" + " <Pattern type=\"regex\">(?i)Line\\s\\d+:\\sIncorrect\\ssyntax\\snear\\s'[^']*'</Pattern>\n" + "</Patterns>"; Files.write(testFile, content.getBytes()); }

Target:
public void setUpZap() throws Exception { super.setUpZap(); Path xmlDir = Files.createDirectories(Paths.get(Constant.getZapHome(), "xml")); Path testFile = xmlDir.resolve("application_errors.xml"); String content = "<?xml version=\"1.0\" standalone=\"no\"?>\n" + "<!-- \n" + "UnitTest File\n" + "-->\n" + "<Patterns>\n" + " <Pattern type=\"string\">Microsoft OLE DB Provider for ODBC Drivers</Pattern>\n" + " <Pattern type=\"regex\">(?i)Line\\s\\d+:\\sIncorrect\\ssyntax\\snear\\s'[^']*'</Pattern>\n" + "</Patterns>"; Files.write(testFile, content.getBytes(StandardCharsets.UTF_8)); }
Source:
public void run() { isLeaked = true; final StackTraceElement[] stackTrace = exception.getStackTrace(); final StackTraceElement[] trace = new StackTraceElement[stackTrace.length - 5]; System.arraycopy(stackTrace, 5, trace, 0, trace.length); exception.setStackTrace(trace); LOGGER.warn("Connection leak detection triggered for from thread {}, stack trace follows", connectionName, threadName, exception); }

Target:
public void run() { isLeaked = true; final StackTraceElement[] stackTrace = exception.getStackTrace(); final StackTraceElement[] trace = new StackTraceElement[stackTrace.length - 5]; System.arraycopy(stackTrace, 5, trace, 0, trace.length); exception.setStackTrace(trace); LOGGER.warn("Connection leak detection triggered for on thread {}, stack trace follows", connectionName, threadName, exception); }
Source:
public QueryResult executeQuery(Query query, Transaction transaction) { SqlTransaction sqlTransaction = (SqlTransaction) transaction; String connectionName = query.getTable().getDbConnectionName(); DataSource dataSource = getDataSource(connectionName); SQLDialect dialect = getSQLDialect(connectionName); sqlTransaction.initializeTransaction(dataSource, dialect); SQLQuery sql = toSQL(query, dialect); String queryString = sql.toString(); QueryResult.QueryResultBuilder resultBuilder = QueryResult.builder(); NamedParamPreparedStatement stmt; Pagination pagination = query.getPagination(); if (pagination != null) { queryString = appendOffsetLimit(queryString, dialect, pagination.getOffset(), pagination.getLimit()); if (pagination.returnPageTotals()) { resultBuilder.pageTotals(getPageTotal(query, sql, sqlTransaction)); } } log.debug("SQL Query: " + queryString); stmt = sqlTransaction.initializeStatement(queryString); supplyFilterQueryParameters(query, stmt); ResultSet resultSet = new TimedFunction<>(() -> { try { return stmt.executeQuery(); } catch (SQLException e) { throw new IllegalStateException(e); } }, "Running Query: " + queryString ).get(); resultBuilder.data(new EntityHydrator(resultSet, query, getMetadataDictionary()).hydrate()); return resultBuilder.build(); }

Target:
public QueryResult executeQuery(Query query, Transaction transaction) { SqlTransaction sqlTransaction = (SqlTransaction) transaction; String connectionName = query.getTable().getDbConnectionName(); ConnectionDetails details = getConnectionDetails(connectionName); DataSource dataSource = details.getDataSource(); SQLDialect dialect = details.getDialect(); SQLQuery sql = toSQL(query, dialect); String queryString = sql.toString(); QueryResult.QueryResultBuilder resultBuilder = QueryResult.builder(); NamedParamPreparedStatement stmt; Pagination pagination = query.getPagination(); if (returnPageTotals(pagination)) { resultBuilder.pageTotals(getPageTotal(query, sql, sqlTransaction)); } log.debug("SQL Query: " + queryString); stmt = sqlTransaction.initializeStatement(queryString, dataSource); supplyFilterQueryParameters(query, stmt); ResultSet resultSet = runQuery(stmt, queryString, Function.identity()); resultBuilder.data(new EntityHydrator(resultSet, query, getMetadataDictionary()).hydrate()); return resultBuilder.build(); }
Source:
public InputKind(String relpath, Class inputClass) { this( relpath, inputClass, relpath.contains("data/inputs") ? relpath.substring(relpath.indexOf("data/inputs") + 12) : relpath ); }

Target:
private InputKind(String relpath, Class inputClass) { this( relpath, inputClass, relpath ); }