auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testModelWithImportsAndFactName() { final ScoreCardModel model = new ScoreCardModel(); model.setName("test"); model.setPackageName("org.drools.workbench.models.guided.scorecard.backend"); model.getImports().addImport(new Import("org.smurf.Pupa")); model.setFactName("org.drools.MoreCheese"); PMML pmmlDocument = GuidedScoreCardDRLPersistence.createPMMLDocument(model); final String drl = GuidedScoreCardDRLPersistence.marshal(model); assertNotNull(drl); assertTrue(drl.contains("package org.drools.workbench.models.guided.scorecard.backend")); assertEquals(16, StringUtil.countMatches(drl, "rule \"")); assertEquals(15, StringUtil.countMatches(drl, "import ")); assertTrue(drl.contains("import org.smurf.Pupa")); assertTrue(drl.contains("import org.drools.MoreCheese")); }

Target:
public void testModelWithImportsAndFactName() { final ScoreCardModel model = new ScoreCardModel(); model.setName("test"); model.setPackageName("org.drools.workbench.models.guided.scorecard.backend"); model.getImports().addImport(new Import("org.smurf.Pupa")); model.setFactName("org.drools.MoreCheese"); PMML pmmlDocument = GuidedScoreCardDRLPersistence.createPMMLDocument(model); final String drl = GuidedScoreCardDRLPersistence.marshal(model); assertNotNull(drl); assertTrue(drl.contains("package org.drools.workbench.models.guided.scorecard.backend")); assertTrue(drl.contains("import org.smurf.Pupa")); assertTrue(drl.contains("import org.drools.MoreCheese")); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { BasicConfigurationDialog.show(); IStructuredSelection selection = (IStructuredSelection) HandlerUtil .getCurrentSelectionChecked(event); Object selected = selection.getFirstElement(); Ref ref = getRef(selected); final Repository repository = getRepository(event); if (ref == null) { RebaseTargetSelectionDialog rebaseTargetSelectionDialog = new RebaseTargetSelectionDialog( getShell(event), repository); if (rebaseTargetSelectionDialog.open() == IDialogConstants.OK_ID) { String refName = rebaseTargetSelectionDialog.getRefName(); try { ref = repository.getRef(refName); } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } else return null; } String jobname = NLS.bind( UIText.RebaseCurrentRefCommand_RebasingCurrentJobName, ref .getName()); RebaseHelper.runRebaseJob(repository, jobname, ref); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { BasicConfigurationDialog.show(); Ref ref; ISelection currentSelection = getCurrentSelectionChecked(event); if (currentSelection instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) currentSelection; Object selected = selection.getFirstElement(); ref = getRef(selected); } else ref = null; final Repository repository = getRepository(event); if (ref == null) { RebaseTargetSelectionDialog rebaseTargetSelectionDialog = new RebaseTargetSelectionDialog( getShell(event), repository); if (rebaseTargetSelectionDialog.open() == IDialogConstants.OK_ID) { String refName = rebaseTargetSelectionDialog.getRefName(); try { ref = repository.getRef(refName); } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } else return null; } String jobname = NLS.bind( UIText.RebaseCurrentRefCommand_RebasingCurrentJobName, ref .getName()); RebaseHelper.runRebaseJob(repository, jobname, ref); return null; }
Source:
INDArray phi(INDArray diffSquared, INDArray sigma) { INDArray minustwovariance = Transforms.pow(sigma, 2).mul(2).negi(); INDArray normalPart = Transforms.pow(sigma.mul(SQRT_TWO_PI), (double)mLabelWidth); INDArray exponentPart = Transforms.exp( diffSquared.div(minustwovariance) ); INDArray likelihoods = exponentPart.div(normalPart); return likelihoods; }

Target:
private INDArray phi(INDArray diffSquared, INDArray sigma) { INDArray minustwovariance = sigma.mul(sigma).muli(2).negi(); INDArray likelihoods = Transforms.exp(diffSquared.divi(minustwovariance)) .divi(Transforms.pow(sigma.mul(SQRT_TWO_PI), (double)mLabelWidth)); return likelihoods; }
Source:
private String getKey(MongoClientSettings clientSettings) { String hosts = clientSettings.getClusterSettings().getHosts().stream().map(h -> h.getHost() + ":" + h.getPort()) .collect(Collectors.joining(",")); String replicaSet = clientSettings.getClusterSettings().getRequiredReplicaSetName(); String userName = clientSettings.getCredential() == null ? "" : clientSettings.getCredential().getUserName(); return String.join(";", Arrays.asList(hosts, replicaSet, userName, databaseName)); }

Target:
private String getKey(MongoClientSettings clientSettings) { String hosts = clientSettings.getClusterSettings().getHosts().stream().map(h -> h.getHost() + ":" + h.getPort()) .collect(Collectors.joining(",")); String replicaSet = clientSettings.getClusterSettings().getRequiredReplicaSetName(); String userName = Optional.ofNullable(clientSettings.getCredential()).map(MongoCredential::getUserName).orElse(""); return String.join(";", Arrays.asList(hosts, replicaSet, userName, databaseName)); }
Source:
public void endInput() throws Exception { if (owner instanceof BoundedOneInput && inputId == 1) { ((BoundedOneInput) owner).endInput(); } else if (owner instanceof BoundedMultiInput) { ((BoundedMultiInput) owner).endInput(inputId); } }

Target:
public void endInput() throws Exception { EndOfInputUtil.endInput(owner, inputId); }
Source:
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException { String token = request.getHeader(OpenShiftAuthenticationFilter.AUTHORIZATION_HEADER); String tenant = request.getHeader(HAWKULAR_TENANT); if (token == null || tenant == null) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "The '" + OpenShiftAuthenticationFilter.AUTHORIZATION_HEADER + "' and '" + HAWKULAR_TENANT + "' headers" + " are required"); return; } if (isAuthorized(request.getMethod(), token, tenant)) { filterChain.doFilter(request, response); return; } else { response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } }

Target:
public void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws IOException, ServletException { String token = request.getHeader(OpenShiftAuthenticationFilter.AUTHORIZATION_HEADER); String tenant = request.getHeader(HAWKULAR_TENANT); if (token == null || tenant == null) { response.sendError(HttpServletResponse.SC_BAD_REQUEST, "The '" + OpenShiftAuthenticationFilter.AUTHORIZATION_HEADER + "' and '" + HAWKULAR_TENANT + "' headers" + " are required"); } else if (isAuthorized(request.getMethod(), token, tenant)) { filterChain.doFilter(request, response); } else { response.sendError(HttpServletResponse.SC_FORBIDDEN); } }
Source:
public void toWordML(Producer producer, IOseeBranch branch, RelationOrderData relationOrderData) { WordMLProducer writer = (WordMLProducer) producer; try { writer.startTable(); writer.addWordMl("<w:tblPr><w:tblW w:w=\"8200\" w:type=\"dxa\"/><w:jc w:val=\"center\"/></w:tblPr>"); if (!relationOrderData.hasEntries()) { writer.addTableRow(NO_DATA_TAG); } else { writer.addTableRow("Relation Type", "Side Name", "Side", "Order Type", "Related Artifacts"); for (Entry<Pair<String, String>, Pair<String, List<String>>> entry : relationOrderData.getOrderedEntrySet()) { String relationTypeName = entry.getKey().getFirst(); String relationSide = entry.getKey().getSecond(); String sorterGuid = entry.getValue().getFirst(); List<String> guidList = entry.getValue().getSecond(); List<String> mlLinks = guidResolver.resolveAsOseeLinks(branch, guidList); RelationType relationType = relationCache.getUniqueByName(relationTypeName); RelationSide side = RelationSide.fromString(relationSide); try { writeTableRow(writer, relationType, side, resolveSorter(sorterGuid), mlLinks); } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } } writer.endTable(); } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } finally { try { writer.endTable(); } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } }

Target:
public void toWordML(Producer producer, IOseeBranch branch, RelationOrderData relationOrderData) { WordMLProducer writer = (WordMLProducer) producer; try { writer.startTable(); writer.addWordMl("<w:tblPr><w:tblW w:w=\"8200\" w:type=\"dxa\"/><w:jc w:val=\"center\"/></w:tblPr>"); if (!relationOrderData.hasEntries()) { writer.addTableRow(NO_DATA_TAG); } else { writer.addTableRow("Relation Type", "Side Name", "Side", "Order Type", "Related Artifacts"); for (Entry<Pair<String, String>, Pair<String, List<String>>> entry : relationOrderData.getOrderedEntrySet()) { String relationTypeName = entry.getKey().getFirst(); String relationSide = entry.getKey().getSecond(); String sorterGuid = entry.getValue().getFirst(); List<String> guidList = entry.getValue().getSecond(); List<String> mlLinks = guidResolver.resolveAsOseeLinks(branch, guidList); RelationType relationType = relationCache.getUniqueByName(relationTypeName); RelationSide side = RelationSide.fromString(relationSide); try { writeTableRow(writer, relationType, side, resolveSorter(sorterGuid), mlLinks); } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } } } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } finally { try { writer.endTable(); } catch (Exception ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } }
Source:
public GatewayConnectionConfig getGatewayConnectionConfig() { return gatewayConnectionConfig; }

Target:
GatewayConnectionConfig getGatewayConnectionConfig() { return gatewayConnectionConfig; }
Source:
default <U> Validation<U, T> mapError(Function<Seq<? extends E>, ? extends U> f) { Objects.requireNonNull(f, "f is null"); if (isInvalid()) { final Seq<? extends E> errors = this.getErrors(); return Validation.invalid(f.apply(errors)); } else { return Validation.valid(this.get()); } }

Target:
default <U> Validation<U, T> mapError(Function<Seq<? extends E>, ? extends U> f) { Objects.requireNonNull(f, "f is null"); if (isInvalid()) { return Validation.invalid(f.apply(this.getErrors())); } else { return Validation.valid(this.get()); } }
Source:
public boolean isReserved(String componentId) { final SnomedIdentifier identifier = SnomedIdentifiers.of(componentId); synchronized (reservations) { for (Reservation reservation : getReservations()) { if (reservation.conflicts(identifier)) { return true; } } } return false; }

Target:
public boolean isReserved(String componentId) { final SnomedIdentifier identifier = SnomedIdentifiers.of(componentId); for (Reservation reservation : getReservations()) { if (reservation.includes(identifier)) { return true; } } return false; }
Source:
public boolean onCreateActionMode(final ActionMode mode, Menu menu) { mode.setTag(ACTION_MODE_TAG); mode.getMenuInflater().inflate(R.menu.menu_action_mode_search, menu); searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search_view)); searchView.setIconified(false); searchView.setQueryHint(getSearchHintString()); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String s) { onQueryChange(s); return true; } }); searchView.setOnCloseListener(new SearchView.OnCloseListener() { @Override public boolean onClose() { mode.finish(); return false; } }); return true; }

Target:
public boolean onCreateActionMode(final ActionMode mode, Menu menu) { mode.setTag(ACTION_MODE_TAG); mode.getMenuInflater().inflate(R.menu.menu_action_mode_search, menu); searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_search_view)); searchView.setIconified(false); searchView.setQueryHint(getSearchHintString()); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String s) { onQueryChange(s); return true; } }); searchView.setOnCloseListener(new SearchView.OnCloseListener() { @Override public boolean onClose() { searchView.setOnQueryTextListener(null); searchView.setOnCloseListener(null); mode.finish(); return true; } }); return true; }
Source:
public void testIsSubStageNode() throws Exception { setupForSubStage(); assertTrue(CaseManagementCommandUtil.isSubStageNode(child)); }

Target:
public void testIsSubStageNode() { setupForSubStage(); assertTrue(CaseManagementCommandUtil.isSubStageNode(child)); }
Source:
public EntitySpec<?> resolve(String type, BrooklynClassLoadingContext loader, Set<String> encounteredTypes) { String yaml; try { yaml = ResourceUtils.create(this).getResourceAsString(type); } catch (Exception e) { log.warn("AssemblyTemplate type " + type + " which looks like a URL can't be fetched.", e); return null; } List<EntitySpec<?>> serviceSpecs = CampUtils.createServiceSpecs(yaml, loader, encounteredTypes); if (serviceSpecs.size() > 1) { throw new UnsupportedOperationException("Only supporting single service in remotely referenced plans: got "+serviceSpecs); } return serviceSpecs.get(0); }

Target:
public EntitySpec<?> resolve(String type, BrooklynClassLoadingContext loader, Set<String> encounteredTypes) { String yaml; try { yaml = ResourceUtils.create(this).getResourceAsString(type); } catch (Exception e) { log.warn("AssemblyTemplate type " + type + " looks like a URL that can't be fetched.", e); return null; } List<EntitySpec<?>> serviceSpecs = CampUtils.createServiceSpecs(yaml, loader, encounteredTypes); if (serviceSpecs.size() > 1) { throw new UnsupportedOperationException("Only supporting single service in remotely referenced plans: got "+serviceSpecs); } return serviceSpecs.get(0); }
Source:
public BVDesignOutput runBVDesign(final WorkbenchService workbenchService, final FieldbookProperties fieldbookProperties, final MainDesign design) throws IOException { final String bvDesignPath = fieldbookProperties.getBvDesignPath(); DESIGN_RUNNER_TIMEOUT_MILLIS *= Long.valueOf(fieldbookProperties.getBvDesignRunnerTimeout()); int returnCode = -1; if (bvDesignPath != null && design != null && design.getDesign() != null) { final String xml = this.getXMLStringForDesign(design); final String filepath = this.inputWriter.write(xml, fieldbookProperties); returnCode = this.processRunner.run(bvDesignPath, "-i" + filepath); } final BVDesignOutput output = new BVDesignOutput(returnCode); if (returnCode == 0) { output.setResults(outputReader.read(design.getDesign().getParameterValue(ExperimentDesignGenerator.OUTPUTFILE_PARAM))); } return output; }

Target:
public BVDesignOutput runBVDesign(final WorkbenchService workbenchService, final FieldbookProperties fieldbookProperties, final MainDesign design) throws IOException { final String bvDesignPath = fieldbookProperties.getBvDesignPath(); bvDesignRunnerTimeout = 60 * 1000 * Long.valueOf(fieldbookProperties.getBvDesignRunnerTimeout()); int returnCode = -1; if (bvDesignPath != null && design != null && design.getDesign() != null) { final String xml = this.getXMLStringForDesign(design); final String filepath = this.inputWriter.write(xml, fieldbookProperties); returnCode = this.processRunner.run(bvDesignPath, "-i" + filepath); } final BVDesignOutput output = new BVDesignOutput(returnCode); if (returnCode == 0) { output.setResults(outputReader.read(design.getDesign().getParameterValue(ExperimentDesignGenerator.OUTPUTFILE_PARAM))); } return output; }
Source:
public void run(String paragraphId) { Paragraph p = getParagraph(paragraphId); p.setListener(jobListenerFactory.getParagraphJobListener(this)); String requiredReplName = p.getRequiredReplName(); Interpreter intp = factory.getInterpreter(getId(), requiredReplName); if (intp == null) { if (conf.getUseJdbcAlias() && null != (intp = factory.getInterpreter(getId(), "jdbc"))) { String pText = p.getText().replaceFirst(requiredReplName, "jdbc(" + requiredReplName + ")"); logger.debug("New paragraph: {}", pText); p.setEffectiveText(pText); } else { InterpreterException intpException; intpException = new InterpreterException( "Pargaraph " + p.getJobName() + "'s Interpreter " + requiredReplName + " not found"); p.setReturn( new InterpreterResult(InterpreterResult.Code.ERROR, intpException.getMessage()), intpException); p.setStatus(Job.Status.ERROR); throw intpException; } } if (p.getConfig().get("enabled") == null || (Boolean) p.getConfig().get("enabled")) { intp.getScheduler().submit(p); } }

Target:
public void run(String paragraphId) { Paragraph p = getParagraph(paragraphId); p.setListener(jobListenerFactory.getParagraphJobListener(this)); String requiredReplName = p.getRequiredReplName(); Interpreter intp = factory.getInterpreter(getId(), requiredReplName); if (intp == null) { if (conf.getUseJdbcAlias() && null != (intp = factory.getInterpreter(getId(), "jdbc"))) { String pText = p.getText().replaceFirst(requiredReplName, "jdbc(" + requiredReplName + ")"); logger.debug("New paragraph: {}", pText); p.setEffectiveText(pText); } else { String intpExceptionMsg = String.format("%s", p.getJobName() + "'s Interpreter " + requiredReplName + " not found" ); InterpreterException intpException = new InterpreterException(intpExceptionMsg); InterpreterResult intpResult = new InterpreterResult( InterpreterResult.Code.ERROR, intpException.getMessage() ); p.setReturn(intpResult, intpException); p.setStatus(Job.Status.ERROR); throw intpException; } } if (p.getConfig().get("enabled") == null || (Boolean) p.getConfig().get("enabled")) { intp.getScheduler().submit(p); } }
Source:
private boolean isEquals(Object value1, Object value2, String fieldName) { if (Objects.equals(value1, value2)) { return true; } else { logger.info("Field value does not match between ledger and connector [field_name={}] {}", fieldName, kv(FIELD_NAME, fieldName)); return false; } }

Target:
private boolean isEquals(Object value1, Object value2, String fieldName) { if (Objects.equals(value1, value2)) { return true; } else { logger.info("Field value does not match between ledger and connector [field_name={}]", fieldName, kv(FIELD_NAME, fieldName)); return false; } }
Source:
private static void createSolrCore(String coreName, CloseableHttpClient httpClient) throws IOException, SolrServerException { String solrUrl = getSolrUrl(); try (CloseableHttpClient closeableHttpClient = httpClient; HttpSolrClient client = (httpClient != null ? new HttpSolrClient.Builder(solrUrl).withHttpClient(httpClient).build() : new HttpSolrClient.Builder(solrUrl).build())) { HttpResponse ping = client.getHttpClient().execute(new HttpHead(solrUrl)); if (ping != null && ping.getStatusLine().getStatusCode() == 200) { ConfigurationFileProxy configProxy = new ConfigurationFileProxy(ConfigurationStore.getInstance()); configProxy.writeSolrConfiguration(coreName); if (!solrCoreExists(client, coreName)) { LOGGER.debug("Solr({}): Creating Solr core", coreName); String dataDir = getCoreDataDir(coreName); CoreAdminRequest.createCore( coreName, getCoreDir(coreName), client, DEFAULT_SOLRCONFIG_XML, DEFAULT_SCHEMA_XML, dataDir, dataDir); } else { LOGGER.debug("Solr({}): Solr core already exists; reloading it", coreName); CoreAdminRequest.reloadCore(coreName, client); } } else { LOGGER.debug("Solr({}): Unable to ping Solr core at {}", coreName, solrUrl); throw new SolrServerException("Unable to ping Solr core"); } } }

Target:
private void createSolrCore(String coreName, CloseableHttpClient httpClient) throws IOException, SolrServerException { String solrUrl = getSolrUrl(); try (CloseableHttpClient closeableHttpClient = httpClient; HttpSolrClient client = (httpClient != null ? new HttpSolrClient.Builder(solrUrl).withHttpClient(httpClient).build() : new HttpSolrClient.Builder(solrUrl).build())) { HttpResponse ping = client.getHttpClient().execute(new HttpHead(solrUrl)); if (ping != null && ping.getStatusLine().getStatusCode() == 200) { ConfigurationFileProxy configProxy = new ConfigurationFileProxy(ConfigurationStore.getInstance()); configProxy.writeSolrConfiguration(coreName); if (!solrCoreExists(client, coreName)) { LOGGER.debug("Solr({}): Creating Solr core", coreName); String dataDir = getCoreDataDir(coreName); CoreAdminRequest.createCore( coreName, getCoreDir(coreName), client, DEFAULT_SOLRCONFIG_XML, DEFAULT_SCHEMA_XML, dataDir, dataDir); } else { LOGGER.debug("Solr({}): Solr core already exists; reloading it", coreName); CoreAdminRequest.reloadCore(coreName, client); } } else { LOGGER.debug("Solr({}): Unable to ping Solr core at {}", coreName, solrUrl); throw new SolrServerException("Unable to ping Solr core"); } } }
Source:
public GraphicsConsole get() { List<String> supportedIds = new ArrayList<>(); for (GraphicsConsole graphicsConsole : parent.list().getGraphicsConsoles()) { if (consoleId.equals(graphicsConsole.getId())) { return graphicsConsole; } supportedIds.add(graphicsConsole.getId()); } Fault fault = new Fault(); fault.setReason("Unsupported console ID"); fault.setDetail("Supported console IDs are: " + StringUtils.join(supportedIds, ", ")); throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(fault).build()); }

Target:
public GraphicsConsole get() { List<String> supportedIds = new ArrayList<>(); for (GraphicsConsole graphicsConsole : parent.list().getGraphicsConsoles()) { if (consoleId.equals(graphicsConsole.getId())) { return graphicsConsole; } supportedIds.add(graphicsConsole.getId()); } throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND).build()); }
Source:
public static SourceFile scan(String target, CodeVisitor visitor) { final File baseDir = new File("src/test/java/"); File file = new File(baseDir, "org/sonar/java/checks/targets/" + target + ".java"); File bytecodeFile = new File("target/test-classes/"); if (!file.isFile()) { throw new IllegalArgumentException("File '" + file.getName() + "' not found."); } Project project = mock(Project.class); ProjectFileSystem pfs = mock(ProjectFileSystem.class); SuppressWarningsFilter filter = mock(SuppressWarningsFilter.class); when(project.getFileSystem()).thenReturn(pfs); when(pfs.getBasedir()).thenReturn(baseDir); DefaultJavaResourceLocator javaResourceLocator = new DefaultJavaResourceLocator(project, null, filter); JavaSquid javaSquid = new JavaSquid(new JavaConfiguration(Charset.forName("UTF-8")), javaResourceLocator, visitor); javaSquid.scan(Collections.singleton(file), Collections.<File>emptyList(), Collections.singleton(bytecodeFile)); Collection<SourceCode> sources = javaSquid.getIndex().search(new QueryByType(SourceFile.class)); if (sources.size() != 1) { throw new IllegalStateException("Only one SourceFile was expected whereas " + sources.size() + " has been returned."); } return (SourceFile) sources.iterator().next(); }

Target:
public static SourceFile scan(String target, CodeVisitor visitor) { final File baseDir = new File("src/test/java/"); File file = new File(baseDir, "org/sonar/java/checks/targets/" + target + ".java"); File bytecodeFile = new File("target/test-classes/"); if (!file.isFile()) { throw new IllegalArgumentException("File '" + file.getName() + "' not found."); } SensorContext sensorContext = mock(SensorContext.class); when(sensorContext.getResource(Matchers.any(org.sonar.api.resources.File.class))).thenAnswer(new Answer<org.sonar.api.resources.File>() { @Override public org.sonar.api.resources.File answer(InvocationOnMock invocation) throws Throwable { org.sonar.api.resources.File response = (org.sonar.api.resources.File) invocation.getArguments()[0]; response.setEffectiveKey(""); return response; } }); Project project = mock(Project.class); ProjectFileSystem pfs = mock(ProjectFileSystem.class); when(project.getFileSystem()).thenReturn(pfs); when(pfs.getBasedir()).thenReturn(baseDir); DefaultJavaResourceLocator javaResourceLocator = new DefaultJavaResourceLocator(project, null, new SuppressWarningsFilter()); javaResourceLocator.setSensorContext(sensorContext); JavaSquid javaSquid = new JavaSquid(new JavaConfiguration(Charset.forName("UTF-8")), javaResourceLocator, visitor); javaSquid.scan(Collections.singleton(file), Collections.<File>emptyList(), Collections.singleton(bytecodeFile)); Collection<SourceCode> sources = javaSquid.getIndex().search(new QueryByType(SourceFile.class)); if (sources.size() != 1) { throw new IllegalStateException("Only one SourceFile was expected whereas " + sources.size() + " has been returned."); } return (SourceFile) sources.iterator().next(); }
Source:
public void startSwitch(String filename, int uploadId) { synchronized (switchLock) { if (!switching && new File(filename) != currentFile) { switchFilename = filename; switchUploadId = uploadId; switchData = 0; switching = true; doSwitch(); } } }

Target:
public void startSwitch(String filename, int uploadId) { synchronized (switchLock) { if (!switching && !new File(filename).equals(currentFile)) { switchFilename = filename; switchUploadId = uploadId; switchData = 0; switching = true; doSwitch(); } } }
Source:
public void testSourceSymbolNotReferenced() throws Exception { tester().assertThat(new PruneMarkDistinctColumns()) .on(p -> { Symbol key = p.symbol("key", BIGINT); Symbol mark = p.symbol("mark", BIGINT); Symbol hash = p.symbol("hash", BIGINT); Symbol unused = p.symbol("unused", BIGINT); return p.project( Assignments.identity(mark), p.markDistinct( mark, ImmutableList.of(key), Optional.of(hash), p.values(key, hash, unused))); }) .matches( strictProject( ImmutableMap.of("mark", PlanMatchPattern.expression("mark")), markDistinct("mark", ImmutableList.of("key"), Optional.of("hash"), strictProject( ImmutableMap.of( "key", PlanMatchPattern.expression("key"), "hash", PlanMatchPattern.expression("hash")), values(ImmutableList.of("key", "hash", "unused")))))); }

Target:
public void testSourceSymbolNotReferenced() throws Exception { tester().assertThat(new PruneMarkDistinctColumns()) .on(p -> { Symbol key = p.symbol("key", BIGINT); Symbol mark = p.symbol("mark", BIGINT); Symbol hash = p.symbol("hash", BIGINT); Symbol unused = p.symbol("unused", BIGINT); return p.project( Assignments.identity(mark), p.markDistinct( mark, ImmutableList.of(key), hash, p.values(key, hash, unused))); }) .matches( strictProject( ImmutableMap.of("mark", expression("mark")), markDistinct("mark", ImmutableList.of("key"), "hash", strictProject( ImmutableMap.of( "key", expression("key"), "hash", expression("hash")), values(ImmutableList.of("key", "hash", "unused")))))); }
Source:
public Sequence<Cursor> makeCursors( @Nullable final Filter filter, @Nonnull final Interval interval, @Nonnull final VirtualColumns virtualColumns, @Nonnull final Granularity gran, final boolean descending, @Nullable final QueryMetrics<?> queryMetrics ) { final Set<String> baseColumns = new HashSet<>(); Iterables.addAll(baseColumns, baseAdapter.getAvailableDimensions()); Iterables.addAll(baseColumns, baseAdapter.getAvailableMetrics()); final List<VirtualColumn> preJoinVirtualColumns = new ArrayList<>(); final List<VirtualColumn> postJoinVirtualColumns = new ArrayList<>(); for (VirtualColumn virtualColumn : virtualColumns.getVirtualColumns()) { if (baseColumns.containsAll(virtualColumn.requiredColumns())) { preJoinVirtualColumns.add(virtualColumn); baseColumns.add(virtualColumn.getOutputName()); } else { postJoinVirtualColumns.add(virtualColumn); } } JoinFilterSplit joinFilterSplit = JoinFilterAnalyzer.splitFilter( this, baseColumns, filter, enableFilterPushDown ); preJoinVirtualColumns.addAll(joinFilterSplit.getPushDownVirtualColumns()); final Sequence<Cursor> baseCursorSequence = baseAdapter.makeCursors( joinFilterSplit.getBaseTableFilter().isPresent() ? joinFilterSplit.getBaseTableFilter().get() : null, interval, VirtualColumns.create(preJoinVirtualColumns), gran, descending, queryMetrics ); return Sequences.map( baseCursorSequence, cursor -> { Cursor retVal = cursor; for (JoinableClause clause : clauses) { retVal = HashJoinEngine.makeJoinCursor(retVal, clause); } return PostJoinCursor.wrap( retVal, VirtualColumns.create(postJoinVirtualColumns), joinFilterSplit.getJoinTableFilter().isPresent() ? joinFilterSplit.getJoinTableFilter().get() : null ); } ); }

Target:
public Sequence<Cursor> makeCursors( @Nullable final Filter filter, @Nonnull final Interval interval, @Nonnull final VirtualColumns virtualColumns, @Nonnull final Granularity gran, final boolean descending, @Nullable final QueryMetrics<?> queryMetrics ) { final List<VirtualColumn> preJoinVirtualColumns = new ArrayList<>(); final List<VirtualColumn> postJoinVirtualColumns = new ArrayList<>(); final Set<String> baseColumns = determineBaseColumnsWithPreAndPostJoinVirtualColumns( virtualColumns, preJoinVirtualColumns, postJoinVirtualColumns ); JoinFilterSplit joinFilterSplit = JoinFilterAnalyzer.splitFilter( this, baseColumns, filter, enableFilterPushDown ); preJoinVirtualColumns.addAll(joinFilterSplit.getPushDownVirtualColumns()); final Sequence<Cursor> baseCursorSequence = baseAdapter.makeCursors( joinFilterSplit.getBaseTableFilter().isPresent() ? joinFilterSplit.getBaseTableFilter().get() : null, interval, VirtualColumns.create(preJoinVirtualColumns), gran, descending, queryMetrics ); return Sequences.map( baseCursorSequence, cursor -> { Cursor retVal = cursor; for (JoinableClause clause : clauses) { retVal = HashJoinEngine.makeJoinCursor(retVal, clause); } return PostJoinCursor.wrap( retVal, VirtualColumns.create(postJoinVirtualColumns), joinFilterSplit.getJoinTableFilter().isPresent() ? joinFilterSplit.getJoinTableFilter().get() : null ); } ); }
Source:
public void testActionParameters() { hostService.setupNetworks() .modifiedBonds( hostNic() .name("bond0") .bonding( bonding() .options( option() .name("mode") .type("4") .build() ) .slaves( hostNic() .name("eth1") .build(), hostNic() .name("eth2") .build() ) .build() ) .build() ).send(); }

Target:
public void testActionParameters() { hostService.setupNetworks() .modifiedBonds( hostNic() .name("bond0") .bonding( bonding() .options( option() .name("mode") .type("4") ) .slaves( hostNic() .name("eth1"), hostNic() .name("eth2") ) ) ).send(); }
Source:
private void checkFieldSeparator(String separator) { if (separator.contains("\t") || separator.contains("\n") || separator.contains("=")) { throw new IllegalArgumentException("Illegal field separator: " + separator); } }

Target:
private void checkFieldSeparator(String separator) { if (ILLEGAL_SEPARATORS.contains(separator)) { throw new IllegalArgumentException("Illegal field separator: " + separator); } }
Source:
private CompletableFuture<Void> executeInternal(boolean skipIndex) { if (lock.lock()) { List<CompletableFuture<Void>> futures = new ArrayList<>(); Deque<IndexedTypeIdentifier> toFlush = new LinkedList<>(); BiConsumer<Void, Throwable> flushIfNeeded = (v, t) -> { try { indexUpdater.flush(toFlush); } finally { lock.unlock(); } }; Set<IndexedTypeIdentifier> indexedTypes = new HashSet<>(); for (IndexedTypeIdentifier indexedType : searchIntegrator.getIndexBindings().keySet()) { indexedTypes.add(indexedType); } try { IndexWorker indexWork = new IndexWorker(cache.getName(), indexedTypes, skipIndex, null); futures.add(executor.submitConsumer(indexWork, TRI_CONSUMER)); CompletableFuture<Void> compositeFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); return compositeFuture.whenComplete(flushIfNeeded); } catch (Throwable t) { lock.unlock(); return CompletableFutures.completedExceptionFuture(t); } } else { return CompletableFutures.completedExceptionFuture(new MassIndexerAlreadyStartedException()); } }

Target:
private CompletableFuture<Void> executeInternal(boolean skipIndex) { if (lock.lock()) { List<CompletableFuture<Void>> futures = new ArrayList<>(); Deque<IndexedTypeIdentifier> toFlush = new LinkedList<>(); BiConsumer<Void, Throwable> flushIfNeeded = (v, t) -> { try { indexUpdater.flush(toFlush); } finally { lock.unlock(); } }; Set<IndexedTypeIdentifier> indexedTypes = new HashSet<>(); for (IndexedTypeIdentifier indexedType : searchIntegrator.getIndexBindings().keySet()) { indexedTypes.add(indexedType); } try { IndexWorker indexWork = new IndexWorker(cache.getName(), indexedTypes, skipIndex, null); futures.add(executor.submitConsumer(indexWork, TRI_CONSUMER)); CompletableFuture<Void> compositeFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); return compositeFuture.whenCompleteAsync(flushIfNeeded, localExecutor); } catch (Throwable t) { lock.unlock(); return CompletableFutures.completedExceptionFuture(t); } } else { return CompletableFutures.completedExceptionFuture(new MassIndexerAlreadyStartedException()); } }
Source:
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) { EEFWidgetFactory widgetFactory = formContainer.getWidgetFactory(); FormData buttonFormData = new FormData(); buttonFormData.left = new FormAttachment(0, LABEL_WIDTH); this.checkbox = widgetFactory.createButton(parent, "", SWT.CHECK); this.checkbox.setLayoutData(buttonFormData); if (!isEnabled()) { this.checkbox.setEnabled(false); } this.controller = new EEFControllersFactory().createCheckboxController(this.description, this.variableManager, this.interpreter, this.editingDomain); }

Target:
protected void createMainControl(Composite parent, IEEFFormContainer formContainer) { EEFWidgetFactory widgetFactory = formContainer.getWidgetFactory(); FormData buttonFormData = new FormData(); buttonFormData.left = new FormAttachment(0, LABEL_WIDTH); this.checkbox = widgetFactory.createButton(parent, "", SWT.CHECK); this.checkbox.setLayoutData(buttonFormData); this.controller = new EEFControllersFactory().createCheckboxController(this.description, this.variableManager, this.interpreter, this.editingDomain); }
Source:
public @NonNull String getSymbolText(long address) { if ((address & (0xFFFFFFFF << 32)) != 0) { return String.format("%08x", address); } return String.format("%016x", address); }

Target:
public @NonNull String getSymbolText(long address) { if ((address & (0xFFFFFFFF << 32)) == 0) { return String.format("%08x", address); } return String.format("%016x", address); }
Source:
public boolean verifySchema(Config configType, String jsonConfig) throws IOException, ProcessingException { ProcessingReport results = null; boolean isSuccess = false; switch (configType) { case TABLE : results = this.tableSchema.validate(new ObjectMapper().readTree(jsonConfig)); break; case SECURITY : results = this.securitySchema.validate(new ObjectMapper().readTree(jsonConfig)); break; case VARIABLE : results = this.variableSchema.validate(new ObjectMapper().readTree(jsonConfig)); break; default : log.error("Not a valid config type :" + configType); return false; } isSuccess = results.isSuccess(); if (!isSuccess) { throw new ProcessingException("Schema validation failed"); } return isSuccess; }

Target:
public boolean verifySchema(Config configType, String jsonConfig) throws IOException, ProcessingException { ProcessingReport results = null; boolean isSuccess = false; switch (configType) { case TABLE : results = this.tableSchema.validate(new ObjectMapper().readTree(jsonConfig)); break; case SECURITY : results = this.securitySchema.validate(new ObjectMapper().readTree(jsonConfig)); break; case VARIABLE : results = this.variableSchema.validate(new ObjectMapper().readTree(jsonConfig)); break; default : log.error("Not a valid config type :" + configType); break; } isSuccess = (results == null ? false : results.isSuccess()); if (!isSuccess) { throw new ProcessingException("Schema validation failed"); } return isSuccess; }
Source:
public void addListenerOnMainMenuButton(){ mainMenu = (Button) findViewById(R.id.main_menu_button_puzzle); mainMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(v.getContext(), MainMenuActivity.class); startActivity(i); } }); }

Target:
private void addListenerOnMainMenuButton() { mainMenu = (Button) findViewById(R.id.main_menu_button_puzzle); mainMenu.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(v.getContext(), MainMenuActivity.class); startActivity(i); } }); }
Source:
private String getWebConsoleUrl(Connection connection, IResource resource) { StringBuilder url = new StringBuilder(connection.getHost()).append("/console"); String projectName = resource == null? null : resource.getNamespace(); if (projectName != null) { url.append("/project/").append(projectName); } if (resource != null && !(resource instanceof IProject)) { url.append("/browse"); if (resource instanceof IBuildConfig ) { url.append("/builds/").append(resource.getName()); } else if ( resource instanceof IBuild) { String buildConfig = resource.getLabels().get("buildconfig"); url.append("/builds/").append(buildConfig).append("/").append(resource.getName()); } else if (resource instanceof IDeploymentConfig) { url.append("/deployments/").append(resource.getName()); } else if (resource instanceof IPod) { url.append("/pods/").append(resource.getName()); } else if (resource instanceof IService) { url.append("/services/").append(resource.getName()); } else if (resource instanceof IImageStream) { url.append("/images/").append(resource.getName()); } else if (resource instanceof IPersistentVolumeClaim) { url.append("/persistentvolumeclaims/").append(resource.getName()); } } return url.toString(); }

Target:
protected String getWebConsoleUrl(Connection connection, IResource resource) { StringBuilder url = new StringBuilder(connection.getHost()).append("/console"); String projectName = resource == null? null : resource.getNamespace(); if (projectName != null) { url.append("/project/").append(projectName); } if (resource != null && !(resource instanceof IProject)) { url.append(getResourceURL(resource)); } return url.toString(); }
Source:
public MetronomeBuilder withRatePerSecond(double ratePerSecond) { if (ratePerSecond <= 0) { throw new IllegalArgumentException("ratePerSecond can't smaller than 0"); } long intervalMicros = round(SECONDS.toMicros(1) / ratePerSecond); return withIntervalMicros(intervalMicros); }

Target:
public MetronomeBuilder withRatePerSecond(double ratePerSecond) { long intervalMicros = round(SECONDS.toMicros(1) / ratePerSecond); return withIntervalMicros(intervalMicros); }
Source:
public void visitVariable(VariableTree tree) { ExpressionTree initializer = tree.initializer(); boolean newArray = initializer != null && initializer.is(Kind.NEW_ARRAY) && ((NewArrayTree) initializer).newKeyword() != null; if (newArray || !ModifiersUtils.hasModifier(tree.modifiers(), Modifier.FINAL)) { super.visitVariable(tree); } }

Target:
public void visitVariable(VariableTree tree) { ExpressionTree initializer = tree.initializer(); boolean arrayNotInitialized = initializer != null && initializer.is(Kind.NEW_ARRAY) && ((NewArrayTree) initializer).initializers().size() == 0; if (arrayNotInitialized || !ModifiersUtils.hasModifier(tree.modifiers(), Modifier.FINAL)) { super.visitVariable(tree); } }
Source:
private void checkFstab() { File f = new File(getBasePath(), ETC_FSTAB_LOCATION); if (f.exists()) { String line = null; status = RsyncStatus.ETC_FSTAB_INVALID; try (BufferedReader reader = new BufferedReader(new FileReader(f))) { while ((line = reader.readLine()) != null) { if (!line.startsWith("#")) { if (line.contains("cygdrive") && line.contains("noacl")) { status = RsyncStatus.OK; } } } } catch (IOException e) { status = RsyncStatus.ETC_FSTAB_INVALID; } } else { status = RsyncStatus.ETC_FSTAB_NOT_FOUND; } }

Target:
private void checkFstab() { File f = new File(getBasePath(), ETC_FSTAB_LOCATION); if (f.exists()) { String line = null; status = RsyncStatus.ETC_FSTAB_INVALID; try (BufferedReader reader = new BufferedReader(new FileReader(f))) { while ((line = reader.readLine()) != null) { if (!line.startsWith(COMMENT_PREFIX) && line.contains(CYGDRIVE) && line.contains(NOACL_FLAG)) { status = RsyncStatus.OK; } } } catch (IOException e) { status = RsyncStatus.ETC_FSTAB_INVALID; } } else { status = RsyncStatus.ETC_FSTAB_NOT_FOUND; } }
Source:
private void onPendingResolution(@Nullable PendingResolution resolution) { if (resolution == null) { Log.e(TAG, "Got null resolution, can't do anything"); return; } try { startIntentSenderForResult(resolution.getPendingIntent().getIntentSender(), resolution.getRequestCode(), null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "Failed to send resolution.", e); finish(); } }

Target:
private void onPendingResolution(@Nullable PendingResolution resolution) { if (resolution == null) { Log.e(TAG, "Got null resolution, can't do anything"); return; } try { startIntentSenderForResult(resolution.getPendingIntent().getIntentSender(), resolution.getRequestCode(), null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "Failed to send resolution.", e); IdpResponse errorResponse = IdpResponse.fromError( new FirebaseUiException(ErrorCodes.UNKNOWN_ERROR, getString(R.string.fui_general_error), e)); finish(RESULT_OK, errorResponse.toIntent()); } }
Source:
public WorkunitInfo setApplicationValues(org.hpccsystems.ws.client.gen.wsworkunits.v1_69.ApplicationValue[] vals) { if (vals==null) { return this; } applicationValues=new ArrayList<ApplicationValueInfo>(); for (int i=0; i < vals.length;i++) { applicationValues.add(new ApplicationValueInfo(vals[i])); } return this; }

Target:
public WorkunitInfo setApplicationValues(org.hpccsystems.ws.client.gen.wsworkunits.v1_69.ApplicationValue[] vals) { if (vals==null) { return this; } applicationValues=new ArrayList<ApplicationValueWrapper>(); for (int i=0; i < vals.length;i++) { applicationValues.add(new ApplicationValueWrapper(vals[i])); } return this; }
Source:
public void onCompleted() { synchronized (this) { if (parentCompleted) { delegate.onCompleted(); } childCompleted = true; } }

Target:
public void onCompleted() { boolean bothCompleted = false; synchronized (this) { if (parentCompleted) { bothCompleted = true; } childCompleted = true; } if (bothCompleted) { delegate.onCompleted(); } }
Source:
protected List<String> getTokens() { return tokenExpirations.keySet().stream().collect(Collectors.toList()); }

Target:
protected List<String> getTokens() { synchronized (tokenExpirations) { return tokenExpirations.keySet().stream().collect(Collectors.toList()); } }
Source:
public static ConfigEntry newConfigEntry(String name, String value, ConfigEntry.ConfigSource source, boolean isSensitive, boolean isReadOnly, List<ConfigEntry.ConfigSynonym> synonyms) { return new ConfigEntry(name, value, source, isSensitive, isReadOnly, synonyms, null, null); }

Target:
public static ConfigEntry newConfigEntry(String name, String value, ConfigEntry.ConfigSource source, boolean isSensitive, boolean isReadOnly, List<ConfigEntry.ConfigSynonym> synonyms) { return new ConfigEntry(name, value, source, isSensitive, isReadOnly, synonyms, ConfigType.UNKNOWN, null); }
Source:
void emit(CodeWriter codeWriter) { codeWriter.emitAnnotations(annotations); codeWriter.emitModifiers(modifiers); codeWriter.emit("$T $L", type, name); }

Target:
void emit(CodeWriter codeWriter) { codeWriter.emitAnnotations(annotations, true); codeWriter.emitModifiers(modifiers); codeWriter.emit("$T $L", type, name); }
Source:
public void testSimple() throws Exception { Coordinate coordinate = new Coordinate( 42 , "service", "user", "cell", false ); assertEquals("/cn/cell/user/service/42/config", ZkCoordinatePath.getConfigPath(coordinate, null)); assertEquals("/cn/cell/user/service/42/config/name", ZkCoordinatePath.getConfigPath(coordinate, "name")); assertEquals("/cn/cell/user/service/42", ZkCoordinatePath.getCoordinateRoot(coordinate)); assertEquals("/cn/cell/user/service/42/status", ZkCoordinatePath.getStatusPath(coordinate)); assertEquals("/cn/cell/user/service", ZkCoordinatePath.coordinateWithoutInstanceAsPath( "cell", "user", "service")); assertEquals("/cn/cell/user/service/42/status", ZkCoordinatePath.getStatusPath("cell", "user", "service", 42)); }

Target:
public void testSimple() throws Exception { final Coordinate coordinate = new Coordinate( 42 , "service", "user", "cell", false ); assertEquals("/cn/cell/user/service/42/config", ZkCoordinatePath.getConfigPath(coordinate, null)); assertEquals("/cn/cell/user/service/42/config/name", ZkCoordinatePath.getConfigPath(coordinate, "name")); assertEquals("/cn/cell/user/service/42", ZkCoordinatePath.getCoordinateRoot(coordinate)); assertEquals("/cn/cell/user/service/42/status", ZkCoordinatePath.getStatusPath(coordinate)); assertEquals("/cn/cell/user/service", ZkCoordinatePath.coordinateWithoutInstanceAsPath( "cell", "user", "service")); assertEquals("/cn/cell/user/service/42/status", ZkCoordinatePath.getStatusPath("cell", "user", "service", 42)); }
Source:
public void testWriteAttributeWithCredentialReferenceWithAliasOnly() throws Exception { try { getNonEmptyCredentialStore(); addKeyStoreWithCredentialReference(KS_NAME, NON_EMPTY_CS_NAME, EXISTING_ALIAS, null, true); testWriteCredentialReferenceAttribute("key-store", KS_NAME, null, NEW_ALIAS, null, true); assertEquals(null, readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); assertEquals(EXISTING_ALIAS, readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); assertEquals(NON_EMPTY_CS_NAME, readAttribute(KS_NAME, STORE_ATTRIBUTE_NAME)); } finally { removeKeyStore(KS_NAME); } }

Target:
public void testWriteAttributeWithCredentialReferenceWithAliasOnly() throws Exception { try { getNonEmptyCredentialStore(); addKeyStoreWithCredentialReference(KS_NAME, NON_EMPTY_CS_NAME, EXISTING_ALIAS, null, true); testWriteCredentialReferenceAttribute("key-store", KS_NAME, null, NEW_ALIAS, null, true); assertNull(readAttribute(KS_NAME, CLEAR_TEXT_ATTRIBUTE_NAME)); assertEquals(EXISTING_ALIAS, readAttribute(KS_NAME, ALIAS_ATTRIBUTE_NAME)); assertEquals(NON_EMPTY_CS_NAME, readAttribute(KS_NAME, STORE_ATTRIBUTE_NAME)); } finally { removeKeyStore(KS_NAME); } }
Source:
public boolean existsAnyEmPcrLibrary(Collection<LibraryDilution> projectLibraryDilutions) throws IOException { for (LibraryDilution dil : projectLibraryDilutions) { if (PlatformType.valueOf(dil.getLibrary().getPlatformName()).usesEmPCR()) { return true; } } return false; }

Target:
public boolean existsAnyEmPcrLibrary(Collection<LibraryDilution> projectLibraryDilutions) throws IOException { for (LibraryDilution dil : projectLibraryDilutions) { if (PlatformType.valueOf(dil.getLibrary().getPlatformName().toUpperCase()).usesEmPCR()) { return true; } } return false; }
Source:
public long receivePower(long microJoules, boolean simulate) { if (toWaitTicks > 0) { return microJoules; } EnumFacing openFace = getOpenFace(); if(openFace != null){ for (int d = 1; d < 5; d++) { AxisAlignedBB aabb = getSuckingBox(openFace, d); List<Entity> discoveredEntities = pipe.getHolder().getPipeWorld().getEntitiesWithinAABB(Entity.class, aabb); for (Entity entity : discoveredEntities) { long leftOver = trySuckEntity(entity, openFace, microJoules, simulate); if (leftOver < microJoules) { return leftOver; } } } return microJoules - MjAPI.MJ; }else{ return microJoules; } }

Target:
public long receivePower(long microJoules, boolean simulate) { if (toWaitTicks > 0) { return microJoules; } EnumFacing openFace = getOpenFace(); if(openFace == null) { return microJoules; } for (int d = 1; d < 5; d++) { AxisAlignedBB aabb = getSuckingBox(openFace, d); List<Entity> discoveredEntities = pipe.getHolder().getPipeWorld().getEntitiesWithinAABB(Entity.class, aabb); for (Entity entity : discoveredEntities) { long leftOver = trySuckEntity(entity, openFace, microJoules, simulate); if (leftOver < microJoules) { return leftOver; } } } return microJoules - MjAPI.MJ; }
Source:
private void deleteSuccessVideos(ITestResult result, String className) { if (result.isSuccess() && (null != System.getenv("KEEP_ALL_VIDEOS")) && !(System.getenv("KEEP_ALL_VIDEOS").equalsIgnoreCase("true"))) { File videoFile = new File(System.getProperty("user.dir") + FileLocations.ANDROID_SCREENSHOTS_DIRECTORY + AppiumDeviceManager.getAppiumDevice().getDevice().getUdid() + "/" + className + "/" + result.getMethod().getMethodName() + "/" + result.getMethod().getMethodName() + ".mp4"); System.out.println(String.format("Deleting video file - %s, if it exists", videoFile)); if (videoFile.exists()) { videoFile.delete(); } } }

Target:
private void deleteSuccessVideos(ITestResult result, String className) { if (result.isSuccess() && (null != System.getenv("KEEP_ALL_VIDEOS")) && !(System.getenv("KEEP_ALL_VIDEOS").equalsIgnoreCase("true"))) { File videoFile = new File(System.getProperty("user.dir") + FileLocations.ANDROID_SCREENSHOTS_DIRECTORY + AppiumDeviceManager.getAppiumDevice().getDevice().getUdid() + "/" + className + "/" + result.getMethod().getMethodName() + "/" + result.getMethod().getMethodName() + ".mp4"); if (videoFile.exists()) { videoFile.delete(); } } }