auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testStitchBytes() { ArrayList<DSTFileGenerator.StitchPoint> stitchpoints = new ArrayList<>(); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(20, 0))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(20, 20))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 20))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); byte[] stitchBytes = fileGenerator.getStitchesBytes(stitchpoints); PointF lastPoint = stitchpoints.get(0).point; int index = 0; for (int i = 0; i < stitchBytes.length; i += 3) { PointF nextPoint = getNextPointFromByte(lastPoint, stitchBytes[i], stitchBytes[i + 1], stitchBytes[i + 2]); assertEquals(stitchpoints.get(index).point, nextPoint); lastPoint = nextPoint; index++; } assertEquals(index, stitchpoints.size()); }

Target:
public void testStitchBytes() { final byte[] expectedStitchBytes = new byte[] {0, 0, (byte) 0x3, (byte) 0xAA, (byte) 0x55, (byte) 0x03, (byte) 0x55, (byte) 0xAA, (byte) 0x03}; ArrayList<DSTFileGenerator.StitchPoint> stitchpoints = new ArrayList<>(); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(20, -20))); stitchpoints.add(new DSTFileGenerator.StitchPoint(new PointF(0, 0))); byte[] stitchBytes = fileGenerator.getStitchesBytes(stitchpoints); assertArrayEquals(expectedStitchBytes, stitchBytes); }
Source:
public void breakBlock(World world, int x, int y, int z, Block block, int par6) { Utils.preDestroyBlock(world, x, y, z); TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z); if (marker != null && marker.itemBlueprint != null) { float f1 = 0.7F; double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; EntityItem itemToDrop = new EntityItem(world, x + d, y + d1, z + d2, marker.itemBlueprint); itemToDrop.delayBeforeCanPickup = 10; if (!world.isRemote) world.spawnEntityInWorld(itemToDrop); } super.breakBlock(world, x, y, z, block, par6); }

Target:
public void breakBlock(World world, int x, int y, int z, Block block, int par6) { Utils.preDestroyBlock(world, x, y, z); TileConstructionMarker marker = (TileConstructionMarker) world.getTileEntity(x, y, z); if (marker != null && marker.itemBlueprint != null && !world.isRemote) { float f1 = 0.7F; double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D; EntityItem itemToDrop = new EntityItem(world, x + d, y + d1, z + d2, marker.itemBlueprint); itemToDrop.delayBeforeCanPickup = 10; world.spawnEntityInWorld(itemToDrop); } super.breakBlock(world, x, y, z, block, par6); }
Source:
public void testShowPartitions() { assertQueryFails("SHOW PARTITIONS FROM orders", "line \\S*: Table does not have partition columns: \\S+\\.orders"); assertQueryFails("SHOW PARTITIONS FROM orders WHERE orderkey < 10", "line \\S*: Table does not have partition columns: \\S+\\.orders"); assertQueryFails("SHOW PARTITIONS FROM orders WHERE invalid_column < 10", "line 1:35: Column 'invalid_column' cannot be resolved"); assertQueryFails("SHOW PARTITIONS FROM orders LIMIT 2", "line \\S*: Table does not have partition columns: \\S+\\.orders"); }

Target:
public void testShowPartitions() { assertQueryFails("SHOW PARTITIONS FROM orders", "line 1:1: Table does not have partition columns: \\S+\\.orders"); assertQueryFails("SHOW PARTITIONS FROM orders WHERE orderkey < 10", "line 1:1: Table does not have partition columns: \\S+\\.orders"); assertQueryFails("SHOW PARTITIONS FROM orders WHERE invalid_column < 10", "line 1:35: Column 'invalid_column' cannot be resolved"); assertQueryFails("SHOW PARTITIONS FROM orders LIMIT 2", "line 1:1: Table does not have partition columns: \\S+\\.orders"); }
Source:
static boolean isPackageExists(Context context, String targetPackage) { List<ApplicationInfo> packages; PackageManager pm; pm = context.getPackageManager(); packages = pm.getInstalledApplications(0); for (ApplicationInfo packageInfo : packages) { if (packageInfo.packageName.equals(targetPackage)) return true; } return false; }

Target:
static boolean isPackageExists(Context context, String targetPackage) { PackageManager pm = context.getPackageManager(); List<ApplicationInfo> packages = pm.getInstalledApplications(0); for (ApplicationInfo packageInfo : packages) { if (packageInfo.packageName.equals(targetPackage)) return true; } return false; }
Source:
public Statement createBootstrapScriptForGroup(String group) { return groupToBootScript.apply(group); }

Target:
public Statement createBootstrapScriptForGroup(String group) { return groupToBootScript.apply(group, null); }
Source:
private Map<String, Map<Long, List<VDS>>> refreshLunSizeAllVds(List<String> luns) { Map<String, Map<Long, List<VDS>>> lunToSize = new HashMap<>(); for (String lun : luns) { Map<Long, List<VDS>> lunSizeToVDs = new HashMap<>(); lunToSize.put(lun, lunSizeToVDs); for (VDS vds : getAllRunningVdssInPool()) { Long size = refreshLun(vds, lun); List<VDS> vdsForSize = lunSizeToVDs.get(size); if (vdsForSize == null) { vdsForSize = new ArrayList<>(); lunSizeToVDs.put(size, vdsForSize); } vdsForSize.add(vds); } } return lunToSize; }

Target:
private Map<String, List<VDS>> refreshLunSizeAllVds(List<String> luns) { Map<String, LUNs> allLuns = getLuns(); Map<String, List<VDS>> lunToVds = new HashMap<>(); for (String lun : luns) { int actualSize = allLuns.get(lun).getDeviceSize(); for (VDS vds : getAllRunningVdssInPool()) { int size = (int) (refreshLun(vds, lun) / SizeConverter.BYTES_IN_GB); if (size != actualSize) { List<VDS> vdsForSize = lunToVds.get(lun); if (vdsForSize == null) { vdsForSize = new ArrayList<>(); lunToVds.put(lun, vdsForSize); } vdsForSize.add(vds); } } } return lunToVds; }
Source:
public Array<Array<T>> permutations() { final Array<T> src = distinct(); if (src.isEmpty()) { return Array.empty(); } else if (src.size() == 1) { return Array.of(src); } else { java.util.List<Array<T>> result = new java.util.ArrayList<>(); int[] pi = new int[src.size()]; for (int i = 0; i < pi.length; i++) { pi[i] = i; } int i, j; while (true) { Object[] next = new Object[src.size()]; for (int k = 0; k < next.length; k++) { next[k] = src.delegate[pi[k]]; } result.add(wrap(next)); i = pi.length - 2; while (i >= 0 && pi[i] > pi[i + 1]) { i--; } if (i < 0) { break; } j = pi.length - 1; while (pi[i] > pi[j]) { j--; } swapIndices(pi, i, j); i++; j = pi.length - 1; while (i < j) { swapIndices(pi, i, j); i++; j--; } } return Array.ofAll(result); } }

Target:
public Array<Array<T>> permutations() { if (isEmpty()) { return empty(); } else if (delegate.length == 1) { return of(this); } else { final Array<Array<T>> zero = empty(); return distinct().foldLeft(zero, (xs, x) -> { final Function<Array<T>, Array<T>> prepend = l -> l.prepend(x); return xs.appendAll(remove(x).permutations().map(prepend)); }); } }
Source:
public static <T, R> Subscriber<T> subscribe(Subscriber<? super R> s, Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch, ErrorMode errorMode) { Subscriber<T> parent = null; switch (errorMode) { case BOUNDARY: parent = new ConcatMapDelayed<T, R>(s, mapper, prefetch, false); break; case END: parent = new ConcatMapDelayed<T, R>(s, mapper, prefetch, true); break; default: parent = new ConcatMapImmediate<T, R>(s, mapper, prefetch); } return parent; }

Target:
public static <T, R> Subscriber<T> subscribe(Subscriber<? super R> s, Function<? super T, ? extends Publisher<? extends R>> mapper, int prefetch, ErrorMode errorMode) { switch (errorMode) { case BOUNDARY: return new ConcatMapDelayed<T, R>(s, mapper, prefetch, false); case END: return new ConcatMapDelayed<T, R>(s, mapper, prefetch, true); default: return new ConcatMapImmediate<T, R>(s, mapper, prefetch); } }
Source:
public void visitToken(DetailAST ast) { final DetailAST parametersNode = ast.findFirstToken(TokenTypes.PARAMETERS); if (parametersNode == null && ast.getParent().getType() != TokenTypes.SWITCH_RULE) { super.visitToken(ast); } else if (parametersNode != null) { for (DetailAST parameterDef = parametersNode.getFirstChild(); parameterDef != null; parameterDef = parameterDef.getNextSibling()) { if (parameterDef.getType() == TokenTypes.PARAMETER_DEF) { super.visitToken(parameterDef); } } } }

Target:
public void visitToken(DetailAST ast) { final boolean isInSwitchRule = ast.getParent().getType() == TokenTypes.SWITCH_RULE; if (Objects.nonNull(ast.findFirstToken(TokenTypes.PARAMETERS))) { final DetailAST parametersNode = ast.findFirstToken(TokenTypes.PARAMETERS); TokenUtil.forEachChild(parametersNode, TokenTypes.PARAMETER_DEF, super::visitToken); } else if (!isInSwitchRule) { super.visitToken(ast); } }
Source:
public void execute() { duplicateRow(); }

Target:
public void execute() { final Setting setting = getActionContext().getSetting(); final EObject eObject = setting.getEObject(); final EStructuralFeature eStructuralFeature = setting.getEStructuralFeature(); final List<?> toDuplicate = Arrays.asList( ((IStructuredSelection) getTableViewer().getSelection()).toArray()); final Collection<Object> copies = copyElements( eObject, eStructuralFeature, getEditingDomainForContainment(), toDuplicate); getTableViewer().setSelection(new StructuredSelection(copies.iterator().next()), true); }
Source:
static ClearPassword parseClearPassword(ConfigurationXMLStreamReader reader) throws ConfigXMLParseException { final int attributeCount = reader.getAttributeCount(); char[] password = null; for (int i = 0; i < attributeCount; i ++) { checkAttributeNamespace(reader, i); if (reader.getAttributeLocalName(i).equals("password")) { password = reader.getAttributeValue(i).toCharArray(); } else { throw reader.unexpectedAttribute(i); } } if (password == null) { throw missingAttribute(reader, "password"); } if (reader.hasNext()) { final int tag = reader.nextTag(); if (tag == START_ELEMENT) { throw reader.unexpectedElement(); } else if (tag == END_ELEMENT) { try { PasswordFactory factory = PasswordFactory.getInstance(ClearPassword.ALGORITHM_CLEAR); return factory.generatePassword(new ClearPasswordSpec(password)).castAs(ClearPassword.class); } catch (InvalidKeySpecException | NoSuchAlgorithmException cause) { throw xmlLog.xmlFailedToCreateCredential(reader.getLocation(), cause); } } else { throw reader.unexpectedContent(); } } throw reader.unexpectedDocumentEnd(); }

Target:
static ClearPassword parseClearPassword(ConfigurationXMLStreamReader reader) throws ConfigXMLParseException { final int attributeCount = reader.getAttributeCount(); char[] password = null; for (int i = 0; i < attributeCount; i ++) { checkAttributeNamespace(reader, i); if (reader.getAttributeLocalName(i).equals("password")) { password = reader.getAttributeValue(i).toCharArray(); } else { throw reader.unexpectedAttribute(i); } } if (password == null) { throw missingAttribute(reader, "password"); } if (reader.hasNext()) { final int tag = reader.nextTag(); if (tag == START_ELEMENT) { throw reader.unexpectedElement(); } else if (tag == END_ELEMENT) { try { PasswordFactory factory = PasswordFactory.getInstance(ClearPassword.ALGORITHM_CLEAR); return Assert.assertNotNull(factory.generatePassword(new ClearPasswordSpec(password)).castAs(ClearPassword.class)); } catch (InvalidKeySpecException | NoSuchAlgorithmException cause) { throw xmlLog.xmlFailedToCreateCredential(reader.getLocation(), cause); } } else { throw reader.unexpectedContent(); } } throw reader.unexpectedDocumentEnd(); }
Source:
private void readNodeSourceConfigurationFile(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); try { DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(4096); factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); ServletFileUpload upload = new ServletFileUpload(factory); upload.setSizeMax(MAX_UPLOAD_SIZE); List<FileItem> fileItems = upload.parseRequest(request); Iterator<?> i = fileItems.iterator(); while (i.hasNext()) { FileItem item = (FileItem) i.next(); String name = item.getFieldName(); InputStream stream = item.getInputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream(); int len; byte[] buffer = new byte[8192]; while ((len = stream.read(buffer, 0, buffer.length)) != -1) { out.write(buffer, 0, len); } response.getWriter().write(new String(out.toByteArray(), StandardCharsets.UTF_8)); } } catch (Exception e) { handleNodeSourceImportException(response, e); throw new RuntimeException(e); } }

Target:
private void readNodeSourceConfigurationFile(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); try { for (FileItem formItem : new ServletRequestTransformer().getFormItems(request)) { try (InputStream in = formItem.getInputStream()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); IOUtils.copy(in, out); response.getWriter().write(new String(out.toByteArray(), StandardCharsets.UTF_8)); } } } catch (Exception e) { handleNodeSourceImportException(response, e); throw new RuntimeException(e); } }
Source:
private void generateXmlTest(XmlTest xmlTest, ITestContext context, Set<ITestResult> failedTests, Set<ITestResult> skippedTests) { if (skippedTests.size() > 0 || failedTests.size() > 0) { Set<ITestNGMethod> methodsToReRun = Sets.newHashSet(); Set<ITestResult> allTests = new HashSet<>(); allTests.addAll(failedTests); allTests.addAll(skippedTests); for (ITestResult failedTest : allTests) { ITestNGMethod current = failedTest.getMethod(); if (! current.isTest()) { continue; } methodsToReRun.add(current); List<ITestNGMethod> methodsDependedUpon = MethodHelper.getMethodsDependedUpon(current, context.getAllTestMethods()); for (ITestNGMethod m : methodsDependedUpon) { if (m.isTest()) { methodsToReRun.add(m); } } } List<ITestNGMethod> result = Lists.newArrayList(); Set<ITestNGMethod> relevantConfigs = Sets.newHashSet(); for (ITestNGMethod m : context.getAllTestMethods()) { if (methodsToReRun.contains(m)) { result.add(m); relevantConfigs.addAll(getAllApplicableConfigs(m.getTestClass())); } } result.addAll(relevantConfigs); createXmlTest(context, result, xmlTest); } }

Target:
private void generateXmlTest(XmlTest xmlTest, ITestContext context, Set<ITestResult> failedTests, Set<ITestResult> skippedTests) { if (skippedTests.size() > 0 || failedTests.size() > 0) { Set<ITestNGMethod> methodsToReRun = Sets.newHashSet(); Set<ITestResult> allTests = new HashSet<>(); allTests.addAll(failedTests); allTests.addAll(skippedTests); for (ITestResult failedTest : allTests) { ITestNGMethod current = failedTest.getMethod(); if (! current.isTest()) { continue; } methodsToReRun.add(current); List<ITestNGMethod> methodsDependedUpon = MethodHelper.getMethodsDependedUpon(current, context.getAllTestMethods()); for (ITestNGMethod m : methodsDependedUpon) { if (m.isTest()) { methodsToReRun.add(m); } } } List<ITestNGMethod> result = Lists.newArrayList(); Set<ITestNGMethod> relevantConfigs = Sets.newHashSet(); for (ITestNGMethod m : context.getAllTestMethods()) { if (methodsToReRun.contains(m)) { result.add(m); getAllApplicableConfigs(relevantConfigs, m.getTestClass()); } } result.addAll(relevantConfigs); createXmlTest(context, result, xmlTest); } }
Source:
default boolean isCreated() { if (getContainerId() == null) { return false; } try { Boolean created = getCurrentContainerInfo().getState().getStatus().equalsIgnoreCase("Created"); return Boolean.TRUE.equals(created); } catch (DockerException e) { return false; } }

Target:
default boolean isCreated() { if (getContainerId() == null) { return false; } try { String status = getCurrentContainerInfo().getState().getStatus(); return "created".equalsIgnoreCase(status) || isRunning(); } catch (DockerException e) { return false; } }
Source:
public void onBuildComplete(AbstractBuild<?, ?> build, TaskListener listener, GHRepository repo) throws GhprbCommitStatusException { List<GhprbBuildResultMessage> completedStatus = getDescriptor().getCompletedStatusDefault(this); boolean showMatrixStatus = getDescriptor().getShowMatrixStatusDefault(this); GHCommitState state = Ghprb.getState(build); StringBuilder sb = new StringBuilder(); if (completedStatus == null || completedStatus.isEmpty()) { sb.append("Build finished."); } else { for (GhprbBuildResultMessage buildStatus : completedStatus) { sb.append(buildStatus.postBuildComment(build, listener)); } if (StringUtils.equals(sb.toString(), "--none--")) { return; } } sb.append(" "); GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger == null) { listener.getLogger().println("Unable to get pull request builder trigger!!"); } else { JobConfiguration jobConfiguration = JobConfiguration.builder() .printStackTrace(trigger.getDisplayBuildErrorsOnDownstreamBuilds()).build(); GhprbBuildManager buildManager = GhprbBuildManagerFactoryUtil.getBuildManager(build, jobConfiguration); if (getAddTestResults()) { sb.append(buildManager.getOneLineTestResults()); } } if((showMatrixStatus && build.getProject() instanceof MatrixProject)){ return; } createCommitStatus(build, listener, sb.toString(), repo, state); }

Target:
public void onBuildComplete(AbstractBuild<?, ?> build, TaskListener listener, GHRepository repo) throws GhprbCommitStatusException { List<GhprbBuildResultMessage> completedStatus = getDescriptor().getCompletedStatusDefault(this); boolean showMatrixStatus = getDescriptor().getShowMatrixStatusDefault(this); GHCommitState state = Ghprb.getState(build); StringBuilder sb = new StringBuilder(); if (completedStatus == null || completedStatus.isEmpty()) { sb.append("Build finished."); } else { for (GhprbBuildResultMessage buildStatus : completedStatus) { sb.append(buildStatus.postBuildComment(build, listener)); } if (StringUtils.equals(sb.toString(), "--none--")) { return; } } sb.append(" "); GhprbTrigger trigger = Ghprb.extractTrigger(build); if (trigger == null) { listener.getLogger().println("Unable to get pull request builder trigger!!"); } else { JobConfiguration jobConfiguration = JobConfiguration.builder() .printStackTrace(trigger.getDisplayBuildErrorsOnDownstreamBuilds()).build(); GhprbBuildManager buildManager = GhprbBuildManagerFactoryUtil.getBuildManager(build, jobConfiguration); if (getAddTestResults()) { sb.append(buildManager.getOneLineTestResults()); } } if(showMatrixStatus && !(build.getProject() instanceof MatrixProject)){ return; } createCommitStatus(build, listener, sb.toString(), repo, state); }
Source:
public double estimateRemainingWeight (State s) { final Vertex v = s.getVertex(); if (v instanceof StreetLocation || v instanceof TemporaryVertex) { return 0; } else if (v instanceof TransitVertex) { double h = transitVertexWeights.get(v); if (h == Double.POSITIVE_INFINITY) { return maxWeightSeen; } else { return h; } } else if (!s.isEverBoarded() && preTransitVertices.containsKey(v)) { VertexModeWeight weight = preTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return weight.carWeight == Double.POSITIVE_INFINITY ? Double.POSITIVE_INFINITY : 0; } else { return weight.walkWeight == Double.POSITIVE_INFINITY ? Double.POSITIVE_INFINITY : 0; } } else if (s.isEverBoarded() && postTransitVertices.containsKey(v)) { VertexModeWeight weight = postTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return weight.carWeight; } else { return weight.walkWeight; } } return Double.POSITIVE_INFINITY; }

Target:
public double estimateRemainingWeight (State s) { final Vertex v = s.getVertex(); if (v instanceof TransitVertex) { double h = transitVertexWeights.get(v); if (h == Double.POSITIVE_INFINITY) { return maxWeightSeen; } else { return h; } } else if (v instanceof StreetLocation || v instanceof TemporaryVertex) { return 0; } else if (!s.isEverBoarded() && preTransitVertices.containsKey(v)) { VertexModeWeight weight = preTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return getPreTransitRemainingWeightEstimate(v, weight.carWeight); } else { return getPreTransitRemainingWeightEstimate(v, weight.walkWeight); } } else if (s.isEverBoarded() && postTransitVertices.containsKey(v)) { VertexModeWeight weight = postTransitVertices.get(v); TraverseMode nonTransitMode = s.getNonTransitMode(); if (nonTransitMode != null && nonTransitMode.isDriving()) { return weight.carWeight; } else { return weight.walkWeight; } } return Double.POSITIVE_INFINITY; }
Source:
public void loggedInUserCanVoteOnceInPollOnDesktop() { Poll poll = new PostsListPage().open().getPost().clickNthPostWithPoll(0).getPoll(); Assert.assertTrue(poll.getAnswersRadioButtonsList().size() > 0); poll.clickNthAnswer(0); poll.clickNthAnswer(1); poll.clickVoteButton(); Assert.assertTrue(poll.isChosenResultBarDisplayed()); Assert.assertTrue(poll.getBarResultsList().size() > 0); Assert.assertTrue(poll.isAlreadyVotedMessageVisible()); }

Target:
public void loggedInUserCanVoteOnceInPollOnDesktop() { Poll poll = new PostsListPage().open().getPost().clickNthPostWithPoll(0).getPoll(); poll.clickNthAnswer(0); poll.clickVoteButton(); Assert.assertTrue(poll.isChosenResultBarDisplayed()); Assert.assertTrue(poll.getBarResultsList().size() > 0); Assert.assertTrue(poll.isAlreadyVotedMessageVisible()); }
Source:
private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new SidebarCheckBox(tr("Patch required")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new SidebarGroup<>("Filters"); this.filterGroup.getComponents() .addAll(testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }

Target:
private void populateFilters() { this.testingCheck = new SidebarCheckBox(tr("Testing")); this.testingCheck.selectedProperty().bindBidirectional(filter.containTestingApplicationsProperty()); this.requiresPatchCheck = new SidebarCheckBox(tr("Patch required")); this.requiresPatchCheck.selectedProperty().bindBidirectional(filter.containRequiresPatchApplicationsProperty()); this.commercialCheck = new SidebarCheckBox(tr("Commercial")); this.commercialCheck.selectedProperty().bindBidirectional(filter.containCommercialApplicationsProperty()); this.commercialCheck.setSelected(true); this.operatingSystemCheck = new SidebarCheckBox(tr("All Operating Systems")); this.operatingSystemCheck.selectedProperty().bindBidirectional(filter.containAllOSCompatibleApplications()); this.operatingSystemCheck.setSelected(false); this.filterGroup = new SidebarGroup<>(tr("Filters")); this.filterGroup.getComponents() .addAll(testingCheck, requiresPatchCheck, commercialCheck, operatingSystemCheck); }
Source:
static final URI hrefToUri(String href) { try { return new URI(href); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage(), e); } }

Target:
public static final URI hrefToUri(String href) { try { return new URI(href); } catch (URISyntaxException e) { throw new IllegalArgumentException("Erroneous URI: \"" + href + "\" (" + e.getMessage() + ')', e); } }
Source:
public InferredType type() { return ((SymbolImpl) symbol).inferredType(); }

Target:
public InferredType type() { if (symbol == null) { return InferredTypes.anyType(); } return ((SymbolImpl) symbol).inferredType(); }
Source:
private Journal findJournal(String journalKey) { return (Journal) DataAccessUtils.uniqueResult( hibernateTemplate.findByCriteria(DetachedCriteria .forClass(Journal.class) .add(Restrictions.eq("journalKey", journalKey)) .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY) )); }

Target:
public Journal findJournal(String journalKey) { Journal journal = (Journal) DataAccessUtils.singleResult((List<?>) hibernateTemplate.findByCriteria(journalCriteria() .add(Restrictions.eq("journalKey", journalKey)) )); if (journal == null) { throw new RestClientException(journalNotFoundMessage(journalKey), HttpStatus.NOT_FOUND); } return journal; }
Source:
private static void checkValidJoins(Collection<Node> g) { @SuppressWarnings("checkstyle:AbbreviationAsWordInName") boolean hasDRPCSpout = false; boolean hasBatchSpout = false; for (Node n : g) { if (n instanceof SpoutNode) { SpoutNode.SpoutType type = ((SpoutNode) n).type; if (type == SpoutNode.SpoutType.BATCH) { hasBatchSpout = true; } else if (type == SpoutNode.SpoutType.DRPC) { hasDRPCSpout = true; } } } if (hasBatchSpout && hasDRPCSpout) { throw new RuntimeException("Cannot join DRPC stream with streams originating from other spouts"); } }

Target:
private static void checkValidJoins(Collection<Node> g) { boolean hasDrpcSpout = false; boolean hasBatchSpout = false; for (Node n : g) { if (n instanceof SpoutNode) { SpoutNode.SpoutType type = ((SpoutNode) n).type; if (type == SpoutNode.SpoutType.BATCH) { hasBatchSpout = true; } else if (type == SpoutNode.SpoutType.DRPC) { hasDrpcSpout = true; } } } if (hasBatchSpout && hasDrpcSpout) { throw new RuntimeException("Cannot join DRPC stream with streams originating from other spouts"); } }
Source:
public void execute() throws FluoCommandException { getJars(); }

Target:
public void execute() throws FluoCommandException { FluoConfiguration config = getConfig(); CommandUtil.verifyAppInitialized(config); config = FluoAdminImpl.mergeZookeeperConfig(config); if (config.getObserverJarsUrl().isEmpty()) { log.info("No observer jars found for the '{}' Fluo application!", getApplicationName()); return; } if (config.getObserverJarsUrl().startsWith("hdfs://")) { try (FileSystem fs = FileSystem.get(new URI(config.getDfsRoot()), new Configuration())) { File downloadPathFile = new File(getDownloadPath()); if (downloadPathFile.exists()) { FileUtils.deleteDirectory(downloadPathFile); } fs.copyToLocalFile(new Path(config.getObserverJarsUrl()), new Path(getDownloadPath())); } catch (URISyntaxException e) { throw new FluoCommandException( String.format("Error parsing DFS ROOT URI: %s", e.getMessage()), e); } catch (IOException e) { throw new FluoCommandException(e); } } else { throw new FluoCommandException(String.format("Unsupported url prefix for %s=%s", FluoConfiguration.OBSERVER_JARS_URL_PROP, config.getObserverJarsUrl())); } }
Source:
public static final List<DateRange> sliceRange(DateTime fromDate, DateTime toDate, int rangeSize) { List<DateRange> ranges = new ArrayList<>(); while (true) { DateTime nextToDate = fromDate.plusDays(rangeSize); if (nextToDate.isAfter(toDate)) { ranges.add(new DateRange(fromDate, toDate)); break; } ranges.add(new DateRange(fromDate, nextToDate)); fromDate = nextToDate.plusSeconds(1); } return ranges; }

Target:
public static final List<DateRange> sliceRange(DateTime fromDate, DateTime toDate, int rangeSize) { List<DateRange> ranges = new ArrayList<>(); while (fromDate.isBefore(toDate)) { DateTime nextToDate = fromDate.plusDays(rangeSize); if (nextToDate.isAfter(toDate)) { ranges.add(new DateRange(fromDate, toDate)); break; } ranges.add(new DateRange(fromDate, nextToDate)); fromDate = nextToDate.plusSeconds(1); } return ranges; }
Source:
public void fill(Control control, MouseEvent event, Point pt) { Chart chart = getChart(); IAxisSet axisSet = chart.getAxisSet(); IAxis xAxis = axisSet.getXAxis(0); IAxis yAxis = axisSet.getYAxis(0); double xCoordinate = xAxis.getDataCoordinate(pt.x); double yCoordinate = yAxis.getDataCoordinate(pt.y); ITmfChartTimeProvider viewer = getChartViewer(); ITmfTimestamp time = TmfTimestamp.fromNanos((long) xCoordinate + viewer.getTimeOffset()); addTimeItem(null,"x", time.toNanos(), time.toString()); addTimeItem(null, "y", null, Double.toString(yCoordinate)); }

Target:
public void fill(Control control, MouseEvent event, Point pt) { Chart chart = getChart(); IAxisSet axisSet = chart.getAxisSet(); IAxis xAxis = axisSet.getXAxis(0); IAxis yAxis = axisSet.getYAxis(0); double xCoordinate = xAxis.getDataCoordinate(pt.x); double yCoordinate = yAxis.getDataCoordinate(pt.y); ITmfChartTimeProvider viewer = getChartViewer(); ITmfTimestamp time = TmfTimestamp.fromNanos((long) xCoordinate + viewer.getTimeOffset()); addItem(null,"x", time.toString(), time.toNanos()); addItem(null, "y", Double.toString(yCoordinate), null); }
Source:
private static LauncherStatus run(final String[] args) throws IOException, InjectionException { final Configuration commandLineConf = parseCommandLine(args); final Injector commandLineInjector = Tang.Factory.getTang().newInjector(commandLineConf); final Set<String> inputs = commandLineInjector.getNamedInstance(LineCountingDriver.Inputs.class); final boolean onLocal = commandLineInjector.getNamedInstance(Parameters.OnLocal.class); final int splits = commandLineInjector.getNamedInstance(Parameters.Splits.class); final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(Parameters.OnLocal.class, Boolean.toString(onLocal)) .bindNamedParameter(Parameters.Splits.class, Integer.toString(splits)); inputs.forEach(input -> jcb.bindSetEntry(LineCountingDriver.Inputs.class, processInputDir(input, onLocal))); final Configuration paramConf = jcb.build(); final Configuration driverConf = getDriverConfiguration(paramConf); final Configuration runTimeConf = onLocal ? getLocalRuntimeConfiguration(splits) : getYarnRuntimeConfiguration(); final int timeout = commandLineInjector.getNamedInstance(Parameters.Timeout.class); return DriverLauncher.getLauncher(runTimeConf).run(driverConf, timeout); }

Target:
private static LauncherStatus run(final String[] args) throws IOException, InjectionException { final Configuration commandLineConf = parseCommandLine(args); final Injector commandLineInjector = Tang.Factory.getTang().newInjector(commandLineConf); final Set<String> inputs = commandLineInjector.getNamedInstance(LineCountingDriver.Inputs.class); final boolean onLocal = commandLineInjector.getNamedInstance(Parameters.OnLocal.class); final int splits = commandLineInjector.getNamedInstance(Parameters.Splits.class); final JavaConfigurationBuilder jcb = Tang.Factory.getTang().newConfigurationBuilder() .bindNamedParameter(Parameters.OnLocal.class, Boolean.toString(onLocal)) .bindNamedParameter(Parameters.Splits.class, Integer.toString(splits)); inputs.forEach(input -> jcb.bindSetEntry(LineCountingDriver.Inputs.class, processInputDir(input, onLocal))); final Configuration paramConf = jcb.build(); final Configuration driverConf = getDriverConfiguration(paramConf); final Configuration runtimeConf = onLocal ? getLocalRuntimeConfiguration(splits) : getYarnRuntimeConfiguration(); final int timeout = commandLineInjector.getNamedInstance(Parameters.Timeout.class); return DriverLauncher.getLauncher(runtimeConf).run(driverConf, timeout); }
Source:
public void addingComponents() { new SpecialInfoboxBuilderPageObject(driver).open("addingComponents") .switchToIFrame() .verifyRowAdded() .verifyTitleAdded() .verifyImageAdded(); }

Target:
public void addingComponents() { InfoboxBuilderPage builder = new InfoboxBuilderPage(); builder.open("addingComponents").switchToIFrame(); int rowComponents = builder.countRows(); int titleComponents = builder.countTitles(); int imageComponents = builder.countImages(); builder.addRowComponent().addImageComponent().addTitleComponent(); Assertion.assertEquals(rowComponents + 1, builder.countRows()); Assertion.assertEquals(titleComponents + 1, builder.countTitles()); Assertion.assertEquals(imageComponents + 1, builder.countImages()); }
Source:
public String toString() { return "OwnableReentrantStripedLockContainer{" + "sharedLocks=" + (Arrays.asList(sharedLocks)) + '}'; }

Target:
public String toString() { return "OwnableReentrantStripedLockContainer{" + "sharedLocks=" + Arrays.toString(sharedLocks) + '}'; }
Source:
public Response getWorkflowZip(@ApiParam(hidden = true) @Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); if (workflow.getIsPublished()) { workflow = workflowDAO.findPublishedById(workflowId); checkEntry(workflow); } else { checkEntry(workflow); if (user.isPresent()) { checkCanReadWorkflow(user.get(), workflow); } else { throw new CustomWebApplicationException("Forbidden: you do not have the credentials required to access this entry.", HttpStatus.SC_FORBIDDEN); } } WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); Set<SourceFile> sourceFiles = workflowVersion.getSourceFiles(); if (sourceFiles == null || sourceFiles.size() == 0) { throw new CustomWebApplicationException("no files found to zip", HttpStatus.SC_NO_CONTENT); } String fileName = workflow.getWorkflowPath().replaceAll("/", "-") + ".zip"; return Response.ok().entity((StreamingOutput)output -> writeStreamAsZip(sourceFiles, output)) .header("Content-Disposition", "attachment; filename=\"" + fileName + "\"").build(); }

Target:
public Response getWorkflowZip(@ApiParam(hidden = true) @Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); if (workflow.getIsPublished()) { checkEntry(workflow); } else { checkEntry(workflow); if (user.isPresent()) { checkCanReadWorkflow(user.get(), workflow); } else { throw new CustomWebApplicationException("Forbidden: you do not have the credentials required to access this entry.", HttpStatus.SC_FORBIDDEN); } } WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); Set<SourceFile> sourceFiles = workflowVersion.getSourceFiles(); if (sourceFiles == null || sourceFiles.size() == 0) { throw new CustomWebApplicationException("no files found to zip", HttpStatus.SC_NO_CONTENT); } String fileName = workflow.getWorkflowPath().replaceAll("/", "-") + ".zip"; return Response.ok().entity((StreamingOutput)output -> writeStreamAsZip(sourceFiles, output)) .header("Content-Disposition", "attachment; filename=\"" + fileName + "\"").build(); }
Source:
public Mono<CloseableChannel> start(ConnectionAcceptor acceptor, int mtu) { Objects.requireNonNull(acceptor, "acceptor must not be null"); ChannelGroup group = new DefaultChannelGroup(new DefaultEventExecutor()); return server .doOnConnection( c -> { group.add(c.channel()); c.addHandlerLast(new RSocketLengthCodec()); DuplexConnection connection; if (mtu > 0) { connection = new FragmentationDuplexConnection( new TcpDuplexConnection(c, false), ByteBufAllocator.DEFAULT, mtu, true, "server"); } else { connection = new TcpDuplexConnection(c); } acceptor.apply(connection).then(Mono.<Void>never()).subscribe(c.disposeSubscriber()); }) .bind() .doOnNext( disposableChannel -> disposableChannel.channel().closeFuture().addListener(f -> group.close())) .map(CloseableChannel::new); }

Target:
public Mono<CloseableChannel> start(ConnectionAcceptor acceptor, int mtu) { Objects.requireNonNull(acceptor, "acceptor must not be null"); return server .doOnConnection( c -> { c.addHandlerLast(new RSocketLengthCodec()); DuplexConnection connection; if (mtu > 0) { connection = new FragmentationDuplexConnection( new TcpDuplexConnection(c, false), ByteBufAllocator.DEFAULT, mtu, true, "server"); } else { connection = new TcpDuplexConnection(c); } acceptor.apply(connection).then(Mono.<Void>never()).subscribe(c.disposeSubscriber()); }) .bind() .map(CloseableChannel::new); }
Source:
public static EmptyMessage manageError(OSException e, Response response) { if (e == null) { LOGGER.error(Error.EXCEPTION_NULL); throw new NullPointerException(Error.EXCEPTION_NULL); } String errMess = e.getMessage(); if (errMess == null) { LOGGER.error(Error.ERROR_MESS_NULL); throw new NullPointerException(Error.ERROR_MESS_NULL); } if (!response.isConfirmable()) { LOGGER.error("An Empty Message will not be created"); return null; } return EmptyMessage.newACK(response); }

Target:
public static EmptyMessage manageError(OSException e, Response response) { if (e == null) { LOGGER.error(ErrorDescriptions.EXCEPTION_NULL); throw new NullPointerException(ErrorDescriptions.EXCEPTION_NULL); } String errMess = e.getMessage(); if (errMess == null) { LOGGER.error(ErrorDescriptions.ERROR_MESS_NULL); throw new NullPointerException(ErrorDescriptions.ERROR_MESS_NULL); } if (!response.isConfirmable()) { LOGGER.error("An Empty Message will not be created"); return null; } return EmptyMessage.newRST(response); }
Source:
public Notification listByApplication( @PathVariable(value = "type") String type, @PathVariable(value = "name") String name) { HierarchicalLevel level = getLevel(type); final Notification notification = notificationDAO.get(level, name); if (level.equals(HierarchicalLevel.APPLICATION)) { final Object global = getGlobal(); NotificationDAO.NOTIFICATION_FORMATS.forEach( it -> { if (UntypedUtils.hasProperty(global, it)) { if (!UntypedUtils.hasProperty(notification, it)) { UntypedUtils.setProperty(notification, it, new ArrayList<>()); } UntypedUtils.setProperty(notification, it, UntypedUtils.getProperty(global, it)); } }); } return notification; }

Target:
public Notification listByApplication( @PathVariable(value = "type") String type, @PathVariable(value = "name") String name) { HierarchicalLevel level = getLevel(type); final Notification notification = notificationDAO.get(level, name); if (level.equals(HierarchicalLevel.APPLICATION)) { final Object global = getGlobal(); NotificationDAO.NOTIFICATION_FORMATS.forEach( it -> { if (UntypedUtils.hasProperty(global, it)) { if (!UntypedUtils.hasProperty(notification, it)) { UntypedUtils.setProperty(notification, it, new ArrayList<>()); } ((List) UntypedUtils.getProperty(notification, it)) .addAll((List) UntypedUtils.getProperty(global, it)); } }); } return notification; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) request; HttpServletResponse httpResp = (HttpServletResponse) response; String[] allowOriginsA = System.getProperty("apiman-manager-ui.allowed-cors-origins", "*").split(","); String allowOrigins = String.join(" ", allowOriginsA); if (isPreflightRequest(httpReq)) { httpResp.setHeader("Access-Control-Allow-Origin", allowOrigins); httpResp.setHeader("Access-Control-Allow-Credentials", "true"); httpResp.setHeader("Access-Control-Max-Age", "1800"); httpResp.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,HEAD,DELETE"); httpResp.setHeader("Access-Control-Allow-Headers", "X-Requested-With,Content-Type,Accept,Origin,Authorization"); httpResp.setHeader("Access-Control-Expose-Headers", "X-Apiman-Error"); } else { if (hasOriginHeader(httpReq)) { httpResp.setHeader("Access-Control-Allow-Origin", allowOrigins); httpResp.setHeader("Access-Control-Allow-Credentials", "true"); httpResp.setHeader("Access-Control-Expose-Headers", "X-Apiman-Error"); } chain.doFilter(httpReq, httpResp); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest httpReq = (HttpServletRequest) request; HttpServletResponse httpResp = (HttpServletResponse) response; if (isPreflightRequest(httpReq) && originIsAllowed(httpReq)) { httpResp.setHeader("Access-Control-Allow-Origin", httpReq.getHeader("Origin")); if(!allowedCorsOrigins.contains("*")){ httpResp.setHeader("Vary", "Origin"); } httpResp.setHeader("Access-Control-Allow-Credentials", "true"); httpResp.setHeader("Access-Control-Max-Age", "1800"); httpResp.setHeader("Access-Control-Allow-Methods", "GET,POST,PUT,HEAD,DELETE"); httpResp.setHeader("Access-Control-Allow-Headers", "X-Requested-With,Content-Type,Accept,Origin,Authorization"); httpResp.setHeader("Access-Control-Expose-Headers", "X-Apiman-Error"); } else { if (hasOriginHeader(httpReq) && originIsAllowed(httpReq)) { httpResp.setHeader("Access-Control-Allow-Origin", httpReq.getHeader("Origin")); if(!allowedCorsOrigins.contains("*")){ httpResp.setHeader("Vary", "Origin"); } httpResp.setHeader("Access-Control-Allow-Credentials", "true"); httpResp.setHeader("Access-Control-Expose-Headers", "X-Apiman-Error"); } chain.doFilter(httpReq, httpResp); } }
Source:
private void parseSimpleLoadProvider(XMLExtendedStreamReader reader, List<ModelNode> list, PathAddress parent) throws XMLStreamException { PathAddress address = parent.append(SimpleLoadProviderResourceDefinition.PATH); ModelNode operation = Util.createAddOperation(address); int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); XMLAttribute attribute = XMLAttribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case FACTOR: { readAttribute(reader, i, operation, SimpleLoadProviderResourceDefinition.Attribute.FACTOR); break; } default: { throw unexpectedAttribute(reader, i); } } } list.add(operation); }

Target:
private void parseSimpleLoadProvider(XMLExtendedStreamReader reader, List<ModelNode> list, PathAddress parent) throws XMLStreamException { PathAddress address = parent.append(SimpleLoadProviderResourceDefinition.PATH); ModelNode operation = Util.createAddOperation(address); int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); XMLAttribute attribute = XMLAttribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case FACTOR: { readAttribute(reader, i, operation, SimpleLoadProviderResourceDefinition.Attribute.FACTOR); break; } default: { throw unexpectedAttribute(reader, i); } } } ParseUtils.requireNoContent(reader); list.add(operation); }
Source:
private CloseableIterator<SupervisorStatus> getAuthorizedSupervisors( JsonParserIterator<SupervisorStatus> it, DataContext root ) { final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); Function<SupervisorStatus, Iterable<ResourceAction>> raGenerator = supervisor -> Collections.singletonList( AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getSource())); final Iterable<SupervisorStatus> authorizedTasks = AuthorizationUtils.filterAuthorizedResources( authenticationResult, () -> it, raGenerator, authorizerMapper ); return wrap(authorizedTasks.iterator(), it); }

Target:
private CloseableIterator<SupervisorStatus> getAuthorizedSupervisors( JsonParserIterator<SupervisorStatus> it, DataContext root ) { final AuthenticationResult authenticationResult = (AuthenticationResult) root.get(PlannerContext.DATA_CTX_AUTHENTICATION_RESULT); Function<SupervisorStatus, Iterable<ResourceAction>> raGenerator = supervisor -> Collections.singletonList( AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(supervisor.getSource())); final Iterable<SupervisorStatus> authorizedSupervisors = AuthorizationUtils.filterAuthorizedResources( authenticationResult, () -> it, raGenerator, authorizerMapper ); return wrap(authorizedSupervisors.iterator(), it); }
Source:
private Map<String, DbParameterAccessor> readIntoParams( String[] queryParameters, String query) throws SQLException { try (PreparedStatement dc = currentConnection.prepareStatement(query)) { for (int i = 0; i < queryParameters.length; i++) { dc.setString(i + 1, NameNormaliser.normaliseName(queryParameters[i])); } ResultSet rs = dc.executeQuery(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); int position = 0; while (rs.next()) { String paramName = rs.getString(1); if (paramName == null) paramName = ""; String dataType = rs.getString(2); DbParameterAccessor dbp = new DbParameterAccessor(paramName, Direction.INPUT, getSqlType(dataType), getJavaClass(dataType), position++); allParams.put(NameNormaliser.normaliseName(paramName), dbp); } rs.close(); return allParams; } }

Target:
private Map<String, DbParameterAccessor> readIntoParams( String[] queryParameters, String query) throws SQLException { try (PreparedStatement dc = currentConnection.prepareStatement(query)) { for (int i = 0; i < queryParameters.length; i++) { dc.setString(i + 1, NameNormaliser.normaliseName(queryParameters[i])); } ResultSet rs = dc.executeQuery(); Map<String, DbParameterAccessor> allParams = new HashMap<String, DbParameterAccessor>(); int position = 0; while (rs.next()) { String paramName = rs.getString(1); if (paramName == null) { paramName = ""; } String dataType = rs.getString(2); DbParameterAccessor dbp = new DbParameterAccessor(paramName, Direction.INPUT, getSqlType(dataType), getJavaClass(dataType), position++); allParams.put(NameNormaliser.normaliseName(paramName), dbp); } rs.close(); return allParams; } }
Source:
public List<Datastream> getAllDatastreams() throws DatastreamException { GetAllRequest<Datastream> request = _builders.getAll().build(); ResponseFuture<CollectionResponse<Datastream>> datastreamResponseFuture = _restClient.sendRequest(request); try { return datastreamResponseFuture.getResponse().getEntity().getElements(); } catch (RemoteInvocationException e) { throw new DatastreamException("Get All Datastreams failed with error.", e); } }

Target:
public List<Datastream> getAllDatastreams() throws DatastreamException { return getAllDatastreams(_builders.getAll().build()); }
Source:
public void execScript(String id, String serviceName, String script) { String scriptDockerLocalDir = "/opt/hawkular-apm-test-local"; String[] command = new String[] { "docker-compose", "-f", id, "exec", serviceName, "bash", "-c", "mkdir " + scriptDockerLocalDir + " && " + "cp /opt/hawkular-apm-test/" + script + " " + scriptDockerLocalDir + " && " + "chmod +x " + scriptDockerLocalDir + "/" + script + " && " + scriptDockerLocalDir + "/" + script }; runShellCommand(command); }

Target:
public void execScript(String id, String serviceName, String script) { String[] command = new String[] { "docker-compose", "-f", scenarioDirectory + File.separator + id, "exec", serviceName, "bash", "-c", scriptExecCommand(script), }; runShellCommand(command); }