auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean allowsSNS( NodeCache cache ) { RepositoryEnvironment repositoryEnvironment = workspace(cache).repositoryEnvironment(); if ( repositoryEnvironment == null) { return true; } NodeTypes nodeTypes = repositoryEnvironment.nodeTypes(); if (nodeTypes == null) { return true; } Name primaryType = getPrimaryType(cache); if (nodeTypes.isUnorderedCollection(primaryType)) { return false; } Set<Name> mixinTypes = getMixinTypes(cache); <START> return nodeTypes.allowsNameSiblings(primaryType, mixinTypes); <END> }</code><technical_language>Another option change NodeTypes.allowsNameSiblings check unordered, unordered collections do allow SNS. if logic is repeated elsewhere</technical_language>

Target:
private boolean allowsSNS( NodeCache cache ) { Name primaryType = getPrimaryType(cache); Set<Name> mixinTypes = getMixinTypes(cache); RepositoryEnvironment repositoryEnvironment = workspace(cache).repositoryEnvironment(); if ( repositoryEnvironment == null) { return true; } NodeTypes nodeTypes = repositoryEnvironment.nodeTypes(); return nodeTypes == null || nodeTypes.allowsNameSiblings(primaryType, mixinTypes); }
Source:
<code>public int compareTo(Object obj) { return 0; <START> } <END></code><technical_language>a bit dumb :/ Ah well</technical_language>

Target:
public int compareTo(Object obj) { if (obj instanceof ICommand) return this.compareTo((ICommand)obj); else return 0; }
Source:
<code>public List<AgentInfo> getAllActive() { return getAllLocal() .stream() .filter(agentInfo -> !agentInfo.getState().equals(UNKNOWN)) <START> .filter(agentInfo -> !agentInfo.getState().equals(WRONG_REGION)) <END> .filter(this::activeRegionOnly) .collect(toList()); }</code><technical_language>this deletable</technical_language>

Target:
public List<AgentInfo> getAllActive() { return getAllAttached() .stream() .filter(agentInfo -> !agentInfo.getState().equals(UNKNOWN)) .filter(this::activeRegionOnly) .collect(toList()); }
Source:
<code>private void onOpenPack() throws IOException { final PackIndex idx = idx(); final byte[] buf = new byte[20]; fd.seek(0); fd.readFully(buf, 0, 12); if (RawParseUtils.match(buf, 0, Constants.PACK_SIGNATURE) != 4) { throw new NoPackSignatureException(JGitText.get().notAPACKFile); } final long vers = NB.decodeUInt32(buf, 4); final long packCnt = NB.decodeUInt32(buf, 8); if (vers != 2 && vers != 3) { throw new <START> UnsupportedPackVersionException(MessageFormat.format( JGitText.get().unsupportedPackVersion, Long.valueOf(vers))); <END> } if (packCnt != idx.getObjectCount()) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch, Long.valueOf(packCnt), Long.valueOf(idx.getObjectCount()), getPackFile())); } fd.seek(length - 20); fd.readFully(buf, 0, 20); if (!Arrays.equals(buf, packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch , ObjectId.fromRaw(buf).name() , ObjectId.fromRaw(idx.packChecksum).name() , getPackFile())); } }</code><technical_language>Pass format string constructor</technical_language>

Target:
private void onOpenPack() throws IOException { final PackIndex idx = idx(); final byte[] buf = new byte[20]; fd.seek(0); fd.readFully(buf, 0, 12); if (RawParseUtils.match(buf, 0, Constants.PACK_SIGNATURE) != 4) { throw new NoPackSignatureException(JGitText.get().notAPACKFile); } final long vers = NB.decodeUInt32(buf, 4); final long packCnt = NB.decodeUInt32(buf, 8); if (vers != 2 && vers != 3) { throw new UnsupportedPackVersionException(vers); } if (packCnt != idx.getObjectCount()) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch, Long.valueOf(packCnt), Long.valueOf(idx.getObjectCount()), getPackFile())); } fd.seek(length - 20); fd.readFully(buf, 0, 20); if (!Arrays.equals(buf, packChecksum)) { throw new PackMismatchException(MessageFormat.format( JGitText.get().packObjectCountMismatch , ObjectId.fromRaw(buf).name() , ObjectId.fromRaw(idx.packChecksum).name() , getPackFile())); } }
Source:
<code>public void process(CopierData data) { for (DataCopyrule rule : rules) { try { rule.apply(data); } catch (RuntimeException nA) { if (LOG.isInfoEnabled()) { LOG.info("Metadata copy rule »" + rule + "« not applicable for process »" + data.getProcessTitle() + "«. Rule skipped."); <START> } <END> } } }</code><technical_language>nice is innovative (first time is in goobi-production), I suggest fashioned "" instead. :-)</technical_language>

Target:
public void process(CopierData data) { for (DataCopyrule rule : rules) { try { rule.apply(data); } catch (RuntimeException notApplicable) { if (LOG.isInfoEnabled()) { LOG.info("Rule not applicable for \"" + data.getProcessTitle() + "\", skipped: " + rule); } } } }
Source:
<code>protected void iterationConditionResult(boolean result, PendingFeatureIf annotation, IMethodInvocation invocation) throws Throwable { if (result) { <START> new PendingFeatureInterceptor(annotation.exceptions(), annotation.reason(), PENDING_FEATURE_IF, false) <END> .intercept(invocation); } }</code><technical_language>is secondary false here</technical_language>

Target:
protected void iterationConditionResult(boolean result, PendingFeatureIf annotation, IMethodInvocation invocation) throws Throwable { if (result) { new PendingFeatureInterceptor(annotation.exceptions(), annotation.reason(), PENDING_FEATURE_IF).intercept(invocation); } }
Source:
<code>public String getEncodedParam(String fileName, String functionName, String type) { String combinedParam = lenientFormat("%s %s %s", fileName, functionName, type); BigInteger uniqueIdentifier = getUniqueIdentifier(combinedParam); BigInteger maxInteger = new BigInteger(Integer.toString(Integer.MAX_VALUE)); <START> if (uniqueIdentifier.compareTo(maxInteger) > 0) { <END> throw new ArithmeticException( "Unique Identifier exceeds value of Integer.MAX_VALUE, could not encode with Base 64 VLQ"); } StringBuilder sb = new StringBuilder(); try { Base64VLQ.encode(sb, uniqueIdentifier.intValue()); } catch (IOException e) { throw new AssertionError("Encountered unexpected IOException error"); } String result = sb.toString(); addParamMapping(result, combinedParam); return result; }</code><technical_language>longs java long id = ++nextId; if (id > Integer.MAX_VALUE) { throw ... }</technical_language>

Target:
public String getEncodedParam(String fileName, String functionName, String type) { String combinedParam = lenientFormat("%s %s %s", fileName, functionName, type); long uniqueIdentifier = getUniqueIdentifier(combinedParam); if (uniqueIdentifier > Integer.MAX_VALUE) { throw new ArithmeticException( "Unique Identifier exceeds value of Integer.MAX_VALUE, could not encode with Base 64 VLQ"); } StringBuilder sb = new StringBuilder(); try { Base64VLQ.encode(sb, Math.toIntExact(uniqueIdentifier)); } catch (IOException e) { throw new AssertionError("Encountered unexpected IOException error"); } String result = sb.toString(); addParamMapping(result, combinedParam); return result; }
Source:
<code>public ListItem(String value) { <START> super(); <END> this.value = value; }</code><technical_language>calling super needed</technical_language>

Target:
public ListItem(String value) { this.value = value; }
Source:
<code>private void ls(AlluxioURI path, boolean recursive, boolean forceLoadMetadata, boolean dirAsFile, boolean hSize, boolean pinnedOnly, String sortField, boolean reverse, String timestampOption) throws AlluxioException, IOException { <START> Function<URIStatus, Long> timestampFuncion = TIMESTAMP_FIELDS.get(timestampOption); <END> URIStatus pathStatus = mFileSystem.getStatus(path); if (dirAsFile) { if (pinnedOnly && !pathStatus.isPinned()) { return; } printLsString(pathStatus, hSize, timestampFuncion); return; } ListStatusPOptions.Builder optionsBuilder = ListStatusPOptions.newBuilder(); if (forceLoadMetadata) { optionsBuilder.setLoadMetadataType(LoadMetadataPType.ALWAYS); } optionsBuilder.setRecursive(recursive); Timer timer = new Timer(); if (pathStatus.isFolder()) { timer.schedule(new TimerTask() { @Override public void run() { System.out.printf("Getting directory status of %s files or sub-directories " + "may take a while.%n", pathStatus.getLength()); } }, 10000); } Stream<URIStatus> statusStream = mFileSystem.listStatusInStream(path, optionsBuilder.build()); timer.cancel(); if (sortField == null) { statusStream.forEach( status -> { if (!pinnedOnly || status.isPinned()) { printLsString(status, hSize, timestampFuncion); } } ); return; } List<URIStatus> sorted = sortByFieldAndOrder( statusStream.collect(Collectors.toList()), sortField, reverse); for (URIStatus status : sorted) { if (!pinnedOnly || status.isPinned()) { printLsString(status, hSize, timestampFuncion); } } }</code><technical_language>spelling timestampFunction</technical_language>

Target:
private void ls(AlluxioURI path, boolean recursive, boolean forceLoadMetadata, boolean dirAsFile, boolean hSize, boolean pinnedOnly, String sortField, boolean reverse, String timestampOption) throws AlluxioException, IOException { Function<URIStatus, Long> timestampFunction = TIMESTAMP_FIELDS.get(timestampOption); URIStatus pathStatus = mFileSystem.getStatus(path); if (dirAsFile) { printLsString(pathStatus, hSize, timestampFunction, pinnedOnly, pathStatus.isPinned()); return; } ListStatusPOptions.Builder optionsBuilder = ListStatusPOptions.newBuilder(); if (forceLoadMetadata) { optionsBuilder.setLoadMetadataType(LoadMetadataPType.ALWAYS); } optionsBuilder.setRecursive(recursive); if (sortField == null) { mFileSystem.iterateStatus(path, optionsBuilder.build(), status -> printLsString(status, hSize, timestampFunction, pinnedOnly, status.isPinned())); return; } List<URIStatus> statusList = mFileSystem.listStatus(path, optionsBuilder.build()); List<URIStatus> sorted = sortByFieldAndOrder(statusList, sortField, reverse); for (URIStatus status : sorted) { printLsString(status, hSize, timestampFunction, pinnedOnly, status.isPinned()); } }
Source:
<code><START> public static boolean isExtensionsAvailable() { <END> final Jenkins jenkins = Jenkins.getInstance(); return jenkins == null ? false : jenkins.getInitLevel().compareTo(InitMilestone.EXTENSIONS_AUGMENTED) >= 0; }</code><technical_language>@since</technical_language>

Target:
public static boolean isExtensionsAvailable() { final Jenkins jenkins = Jenkins.getInstance(); return jenkins != null && jenkins.getInitLevel().compareTo(InitMilestone.EXTENSIONS_AUGMENTED) >= 0; }
Source:
<code>protected FluentList<FluentWebElement> find() { FluentListImpl<FluentWebElement> elements = new FluentListImpl<>(); <START> if (this.untilElements != null) { <END> for (FluentWebElement untilElement : this.untilElements) { try { untilElement.getTagName(); elements.add(untilElement); } catch (NoSuchElementException e) { } } } return elements; }</code><technical_language>is this operator required</technical_language>

Target:
protected FluentList<FluentWebElement> find() { FluentListImpl<FluentWebElement> elements = new FluentListImpl<>(); if (untilElements != null) { for (FluentWebElement untilElement : untilElements) { try { untilElement.getTagName(); elements.add(untilElement); } catch (NoSuchElementException e) { } } } return elements; }
Source:
<code>public static UserResponse newUserResponse(UserAccountJoinVO usr, Long domainId) { UserResponse response = s_userAccountJoinDao.newUserResponse(usr); <START> if(AccountManager.UseSecretKeyInResponse.value() == false){ <END> response.setSecretKey(null); } if (usr.getAccountRoleId() != null) { Role role = s_roleService.findRole( usr.getAccountRoleId()); if (role != null) { response.setRoleId(role.getUuid()); response.setRoleType(role.getRoleType()); response.setRoleName(role.getName()); } } if (domainId != null && usr.getDomainId() != domainId) response.setIsCallerChildDomain(true); else response.setIsCallerChildDomain(false); return response; }</code><technical_language>!<rest of code></technical_language>

Target:
public static UserResponse newUserResponse(UserAccountJoinVO usr, Long domainId) { UserResponse response = s_userAccountJoinDao.newUserResponse(usr); if(!AccountManager.UseSecretKeyInResponse.value()){ response.setSecretKey(null); } if (usr.getAccountRoleId() != null) { Role role = s_roleService.findRole( usr.getAccountRoleId()); if (role != null) { response.setRoleId(role.getUuid()); response.setRoleType(role.getRoleType()); response.setRoleName(role.getName()); } } if (domainId != null && usr.getDomainId() != domainId) response.setIsCallerChildDomain(true); else response.setIsCallerChildDomain(false); return response; }
Source:
<code>public void testRebaseWithUnstagedTopicChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "unstaged file2"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); <START> assertEquals(result.getStatus(), Status.CONFLICTS); <END> }</code><technical_language>Assert name of conflicted file too. elsewhere</technical_language>

Target:
public void testRebaseWithUnstagedTopicChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "unstaged file2"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(result.getStatus(), Status.CONFLICTS); assertEquals(result.getConflicts().size(), 1); assertEquals(result.getConflicts().get(0), "file2"); }
Source:
<code>private static String clozeText(String txt, String ord, char type) { <START> Matcher n = Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt); <END> if (!n.find()) { return ""; } txt = removeFormattingFromMathjax(txt, ord); Matcher m = Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt); StringBuffer repl = new StringBuffer(); while (m.find()) { String buf; if (type == 'q') { if (!TextUtils.isEmpty(m.group(4))) { buf = "[$4]"; } else { buf = "[...]"; } } else { buf = m.group(2); } StringBuilder replacement = new StringBuilder(); if (m.group(1).equals("c")) { replacement.append("<span class=cloze>"); replacement.append(buf); replacement.append("</span>"); } else { replacement.append(buf); } m.appendReplacement(repl, replacement.toString()); } txt = m.appendTail(repl).toString(); return txt.replaceAll(String.format(Locale.US, clozeReg, "\\d+"), "$2"); }</code><technical_language>This variable Matcher n is right? I readability improved making this a one-liner m n variables</technical_language>

Target:
private static String clozeText(String txt, String ord, char type) { if (!Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt).find()) { return ""; } txt = removeFormattingFromMathjax(txt, ord); Matcher m = Pattern.compile(String.format(Locale.US, clozeReg, ord)).matcher(txt); StringBuffer repl = new StringBuffer(); while (m.find()) { String buf; if (type == 'q') { if (!TextUtils.isEmpty(m.group(4))) { buf = "[$4]"; } else { buf = "[...]"; } } else { buf = m.group(2); } if (m.group(1).equals("c")) { buf = String.format("<span class=cloze>%s</span>", buf); } m.appendReplacement(repl, buf); } txt = m.appendTail(repl).toString(); return txt.replaceAll(String.format(Locale.US, clozeReg, "\\d+"), "$2"); }
Source:
<code>public void aggregate() { <START> if (foundValue == null && !valueSelector.isNull()) { <END> foundValue = valueSelector.getDouble(); } }</code><technical_language>valueSelector.isNull() true this factory is NullableNumericAggregatorFactory</technical_language>

Target:
public void aggregate() { if (!isFound) { foundValue = valueSelector.getDouble(); isFound = true; } }
Source:
<code>public void write(String line) { if (!StringUtils.isNotEmpty(line)) { return; } JSONObject payload = new JSONObject(); try { BuildData buildData = new BuildData(this.run, null); payload.put("ddtags", String.join(",", TagsUtil.convertTagsToArray(buildData.getTags()))); payload = buildData.addLogAttributes(payload); payload.put("message", line); payload.put("ddsource", "jenkins"); payload.put("service", "jenkins"); DatadogClient client = ClientFactory.getClient(); if(client == null){ return; } boolean status = client.sendLogs(payload.toString()); if(!status){ client.sendLogs(payload.toString()); } } catch (IOException | InterruptedException e){ <START> String msg = "Failed to send log data. No Further logs will be sent to Datadog."; <END> DatadogUtilities.severe(logger, e, msg); try { errorStream.write(msg.getBytes(charset)); errorStream.flush(); } catch (IOException ex) { ex.printStackTrace(); } } }</code><technical_language>For subsequent build</technical_language>

Target:
public void write(String line) { if (!StringUtils.isNotEmpty(line)) { return; } JSONObject payload = new JSONObject(); try { BuildData buildData = new BuildData(this.run, null); payload.put("ddtags", String.join(",", TagsUtil.convertTagsToArray(buildData.getTags()))); payload = buildData.addLogAttributes(payload); payload.put("message", line); payload.put("ddsource", "jenkins"); payload.put("service", "jenkins"); DatadogClient client = ClientFactory.getClient(); if(client == null){ return; } boolean status = client.sendLogs(payload.toString()); if(!status){ client.sendLogs(payload.toString()); } } catch (IOException | InterruptedException e){ DatadogUtilities.severe(logger, e, null); } }
Source:
<code>public static void viewStatsSinglePostDetails(Context context, SiteModel site, PostModel post, boolean isPage) { if (post == null) return; <START> org.wordpress.android.ui.stats.models.PostModel postModel = <END> new org.wordpress.android.ui.stats.models.PostModel(site.getSiteId(), String.valueOf(post.getRemotePostId()), post.getTitle(), post.getLink(), isPage ? StatsConstants.ITEM_TYPE_PAGE : StatsConstants.ITEM_TYPE_POST); viewStatsSinglePostDetails(context, postModel); }</code><technical_language>rename org.wordpress.android.ui.stats.models.PostModel StatsPostModel avoid confusion</technical_language>

Target:
public static void viewStatsSinglePostDetails(Context context, SiteModel site, PostModel post, boolean isPage) { if (post == null) return; StatsPostModel statsPostModel = new StatsPostModel(site.getSiteId(), String.valueOf(post.getRemotePostId()), post.getTitle(), post.getLink(), isPage ? StatsConstants.ITEM_TYPE_PAGE : StatsConstants.ITEM_TYPE_POST); viewStatsSinglePostDetails(context, statsPostModel); }
Source:
<code>public boolean hasError() { <START> return result != null && result.getType() != null && CommandResult.Type.ERROR.equals(result.getType()); <END> }</code><technical_language>slightly simplify: java return result != null && Objects.equals(CommandResult.Type.ERROR, result.getType());</technical_language>

Target:
public boolean hasError() { return result != null && CommandResult.Type.ERROR.equals(result.getType()); }
Source:
<code>public ExitStatus afterStep(StepExecution stepExecution) { <START> return null; <END> }</code><technical_language><code>return ExitStatus.COMPLETED</code></technical_language>

Target:
public ExitStatus afterStep(StepExecution stepExecution) { return ExitStatus.COMPLETED; }
Source:
<code>protected String formatIfNotEmpty(String pattern, Object param) { if (param == null ) return ""; <START> return Strings.isNullOrEmpty(param.toString()) ? "" : String.format(pattern, param); <END> }</code><technical_language>[minor] do in a more elegant as: java return Strings.emptyToNull(param) == null ? "" : String.format(pattern, param);</technical_language>

Target:
protected String formatIfNotEmpty(String pattern, Object param) { return Strings.isNullOrEmpty(nullableToString( param )) ? "" : String.format(pattern, param); }
Source:
<code>public void sendEmail(EmailWrapper wrapper) throws SendGridException { Email email = parseToEmail(wrapper); SendGrid sendgrid = new SendGrid(Config.SENDGRID_APIKEY); <START> sendgrid.send(email); <END> }</code><technical_language>I in [example shown](<LINK_0>, do additional check for response code 200, do need include check throw exception if 200</technical_language>

Target:
public void sendEmail(EmailWrapper wrapper) throws SendGridException { Email email = parseToEmail(wrapper); SendGrid sendgrid = new SendGrid(Config.SENDGRID_APIKEY); Response response = sendgrid.send(email); if (response.getCode() != SUCCESS_CODE) { log.severe("Email failed to send: " + response.getMessage()); } }
Source:
<code>int prepareContext(Xid xid, boolean onePhaseCommit) { PrepareTransactionOperation operation; Collection<Modification> modifications; try { modifications = toModification(); if (trace) { log.tracef("Preparing transaction xid=%s, remote-cache=%s, modification-size=%d", xid, cacheName, modifications.size()); } if (modifications.isEmpty()) { return XAResource.XA_RDONLY; } } catch (Exception e) { return Integer.MIN_VALUE; } try { int xaReturnCode; do { operation = operationsFactory.newPrepareTransactionOperation(xid, onePhaseCommit, modifications); xaReturnCode = operation.execute().get(); } while (operation.shouldRetry()); return xaReturnCode; <START> } catch (Exception e) { <END> return XAException.XA_RBROLLBACK; } }</code><technical_language>log exception (or is logged before?)</technical_language>

Target:
int prepareContext(Xid xid, boolean onePhaseCommit) { PrepareTransactionOperation operation; Collection<Modification> modifications; try { modifications = toModification(); if (trace) { log.tracef("Preparing transaction xid=%s, remote-cache=%s, modification-size=%d", xid, cacheName, modifications.size()); } if (modifications.isEmpty()) { return XAResource.XA_RDONLY; } } catch (Exception e) { return Integer.MIN_VALUE; } try { int xaReturnCode; do { operation = operationsFactory.newPrepareTransactionOperation(xid, onePhaseCommit, modifications); xaReturnCode = operation.execute().get(); } while (operation.shouldRetry()); return xaReturnCode; } catch (Exception e) { log.exceptionDuringPrepare(xid, e); return XAException.XA_RBROLLBACK; } }
Source:
<code><START> int getHeight() { <END> return this.height; }</code><technical_language>public</technical_language>

Target:
public int getHeight() { return this.height; }
Source:
<code>public static void waitForIndexer(ICProject project) throws InterruptedException { PDOMManager indexManager = CCoreInternals.getPDOMManager(); IWorkspace workspace = ResourcesPlugin.getWorkspace(); try { Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null); project.getProject().refreshLocal(IResource.DEPTH_INFINITE, npm()); <START> workspace.build(IncrementalProjectBuilder.FULL_BUILD, npm()); <END> indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm()); workspace.build(IncrementalProjectBuilder.FULL_BUILD, npm()); } catch (CoreException e) { fail(e.getMessage()); } assertTrue(indexManager.isProjectRegistered(project)); assertTrue(indexManager.joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm())); }</code><technical_language>Irrational changes this appropriate</technical_language>

Target:
public static void waitForIndexer(ICProject project) throws InterruptedException { Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null); assertTrue(CCoreInternals.getPDOMManager().joinIndexer(INDEXER_TIMEOUT_SEC * 1000, npm())); }
Source:
<code>public void testInValidHostnamesFail() { final Job.Builder b = Job.newBuilder().setName("foo").setVersion("1").setImage("bar"); <START> final String toolonghostname = Strings.repeat("hostname", 8); <END> assertEquals(newHashSet("Invalid hostname (" + toolonghostname + "), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname(toolonghostname).build())); assertEquals(newHashSet("Invalid hostname (%/ RJU&%(=N/U), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("%/ RJU&%(=N/U").build())); assertEquals(newHashSet("Invalid hostname (-), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("-").build())); assertEquals(newHashSet("Invalid hostname (foo17.bar-baz_quux), only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("foo17.bar-baz_quux").build())); }</code><technical_language>checkstyle plugin check test code, lines a maximum of 100 chars</technical_language>

Target:
public void testInValidHostnamesFail() { final Job.Builder b = Job.newBuilder().setName("foo").setVersion("1").setImage("bar"); final String toolonghostname = Strings.repeat("hostname", 8); assertEquals(newHashSet("Invalid hostname (" + toolonghostname + "), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname(toolonghostname).build())); assertEquals(newHashSet("Invalid hostname (%/ RJU&%(=N/U), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("%/ RJU&%(=N/U").build())); assertEquals(newHashSet("Invalid hostname (-), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("-").build())); assertEquals(newHashSet("Invalid hostname (foo17.bar-baz_quux), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("foo17.bar-baz_quux").build())); assertEquals(newHashSet("Invalid hostname (D34DB33F), " + "only [a-z0-9][a-z0-9-] are allowed, size between 1 and 63"), validator.validate(b.setHostname("D34DB33F").build())); }
Source:
<code>public Set<SOURCE> getInactiveSources() { Set<SOURCE> inactiveSources = Sets.newHashSet(); <START> inactiveSources.addAll(soundSources.keySet().stream().filter(source -> !isActive(source)).collect(Collectors.toList())); <END> return inactiveSources; }</code><technical_language>I guess set collector here</technical_language>

Target:
public Set<SOURCE> getInactiveSources() { return soundSources.keySet().stream().filter(source -> !isActive(source)).collect(Collectors.toCollection(HashSet::new)); }
Source:
<code>protected Set<Guid> getDisksGuidSet (List<DiskImage> disks) { return disks != null ? disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()) : <START> new HashSet<>(); <END> }</code><technical_language>Collections.emptySet()</technical_language>

Target:
protected Set<Guid> getDisksGuidSet (List<DiskImage> disks) { return disks != null ? disks.stream().map(DiskImage::getImageId).collect(Collectors.toSet()) : Collections.emptySet(); }
Source:
<code>public void run() { System.out.println("Running DownloadMediaUseCase"); IFileDownloader.Callback callback = new IFileDownloader.Callback() { @Override public void onError(FileDownloadException ex) { mCallback.onError(ex); } @Override public void onSuccess(List<Media> syncMedias) { int numOfSyncedFiles = saveDownloadedMedia(syncMedias); List<Media> allMedias = mMediaRepository.getAll(); removeNotDownloadedMedia(syncMedias, allMedias); mCallback.onSuccess(numOfSyncedFiles); } }; <START> List<Media> medias = mFileDownloader.init( <END> PreferencesState.getInstance().getDriveRootFolderUid(), mProgramRepository.getUserProgram().getId(), callback); if (medias != null && !medias.isEmpty()) { if (mConnectivityManager.isDeviceOnline()) { mFileDownloader.download(medias, callback); } else { System.out.println(this.getClass().getSimpleName() + ": No wifi connection available. Media will not be synced"); } } }</code><technical_language>I returns previously medias is necessary init method either. download simply medias drive folder pass DriveRootFolderUid ProgramUId in download method of FileDownloader</technical_language>

Target:
public void run() { System.out.println("Running DownloadMediaUseCase"); final List<Media> currentMedias = mMediaRepository.getAll(); if (mConnectivityManager.isDeviceOnline()) { mFileDownloader.download(currentMedias, PreferencesState.getInstance().getDriveRootFolderUid(), mProgramRepository.getUserProgram().getCode(), new IFileDownloader.Callback() { @Override public void onError(FileDownloadException ex) { mCallback.onError(ex); } @Override public void onSuccess(List<Media> syncMedias) { int numOfSyncedFiles = saveDownloadedMedia(syncMedias); removeNotDownloadedMedia(syncMedias, currentMedias); mCallback.onSuccess(numOfSyncedFiles); } }); } else { System.out.println(this.getClass().getSimpleName() + ": No wifi connection available. Media will not be synced"); } }
Source:
<code>@Override public int getTotalNodes() { <START> IntMetricImpl totalNodes = sysreg.intMetric("TotalNodes", null); <END> totalNodes.add(1); return totalNodes.value(); }</code><technical_language>this change? Please, revert it</technical_language>

Target:
@Override public int getTotalNodes() { return 1; }
Source:
<code>public void abandon(AbandonInput in) throws RestApiException { try { abandon.get().apply(change, in); } catch (OrmException e) { throw new RestApiException("Cannot abandon change", e); } catch (IOException e) { throw new RestApiException("Cannot abandon <START> review", <END> e); } }</code><technical_language>change</technical_language>

Target:
public void abandon(AbandonInput in) throws RestApiException { try { abandon.get().apply(change, in); } catch (OrmException e) { throw new RestApiException("Cannot abandon change", e); } catch (IOException e) { throw new RestApiException("Cannot abandon change", e); } }
Source:
<code>static String camelize(String s, boolean upper) { if (StringUtils.contains(s, '_')) { StringBuilder builder = new StringBuilder(); for (String part : StringUtils.split(s, '_')) { <START> builder.append(StringUtils.capitalize(StringUtils.lowerCase(part))); <END> } s = builder.toString(); } else if (StringUtils.isAllUpperCase(s)) { s = StringUtils.lowerCase(s); } else { StringBuilder builder = new StringBuilder(); for (String part : StringUtils.splitByCharacterTypeCamelCase(s)) { builder.append(StringUtils.capitalize(StringUtils.lowerCase(part))); } s = builder.toString(); } if (upper) { return StringUtils.capitalize(s); } else { return StringUtils.uncapitalize(s); } }</code><technical_language>'StringUtils.lowerCase ()' performance if loop</technical_language>

Target:
static String camelize(String s, boolean upper) { if (StringUtils.contains(s, '_')) { StringBuilder builder = new StringBuilder(); for (String part : StringUtils.split(StringUtils.lowerCase(s), '_')) { builder.append(StringUtils.capitalize(part)); } s = builder.toString(); if (upper) { return StringUtils.capitalize(s); } else { return StringUtils.uncapitalize(s); } } StringBuilder builder = new StringBuilder(); String[] parts = StringUtils.splitByCharacterTypeCamelCase(s); if (StringUtils.isAllUpperCase(parts[0]) && upper) { builder.append(parts[0]); } else if (upper) { builder.append(StringUtils.capitalize(StringUtils.lowerCase(parts[0]))); } else { builder.append(StringUtils.lowerCase(parts[0])); } for (String part : ArrayUtils.subarray(parts, 1, parts.length)) { if (StringUtils.isAllUpperCase(part)) { builder.append(part); } else { builder.append(StringUtils.capitalize(StringUtils.lowerCase(part))); } } return builder.toString(); }
Source:
<code>protected void executeCommand() { storage_pool_iso_map domainPoolMap = TransactionSupport.executeInNewTransaction( new TransactionMethod<storage_pool_iso_map>() { @Override public storage_pool_iso_map runInTransaction() { storage_pool_iso_map domainPoolMap = new storage_pool_iso_map(getRecoveryStoragePoolParametersData() .getNewMasterDomainId(), getRecoveryStoragePoolParametersData().getStoragePoolId(), StorageDomainStatus.Active); DbFacade.getInstance().getStoragePoolIsoMapDao().save(domainPoolMap); return domainPoolMap; } }); getStoragePool().setstatus(StoragePoolStatus.Problematic); try { if (StorageHelperDirector.getInstance().getItem(getStorageDomain().getstorage_type()) .ConnectStorageToDomainByVdsId(getNewMaster(false), getVds().getId())) { super.executeCommand(); } else { getReturnValue().setFault(new VdcFault(new VdcBLLException(VdcBllErrors.StorageServerConnectionError, "Failed to connect storage"), VdcBllErrors.StorageServerConnectionError)); } } finally { <START> if (!reconstructOpsSucceeded) { <END> getCompensationContext().snapshotNewEntity(domainPoolMap); getCompensationContext().stateChanged(); } } }</code><technical_language>start compensation if before</technical_language>

Target:
protected void executeCommand() { storage_pool_iso_map domainPoolMap = TransactionSupport.executeInNewTransaction( new TransactionMethod<storage_pool_iso_map>() { @Override public storage_pool_iso_map runInTransaction() { storage_pool_iso_map domainPoolMap = new storage_pool_iso_map(getRecoveryStoragePoolParametersData() .getNewMasterDomainId(), getRecoveryStoragePoolParametersData().getStoragePoolId(), StorageDomainStatus.Active); DbFacade.getInstance().getStoragePoolIsoMapDao().save(domainPoolMap); return domainPoolMap; } }); getStoragePool().setstatus(StoragePoolStatus.Problematic); try { if (StorageHelperDirector.getInstance().getItem(getStorageDomain().getstorage_type()) .ConnectStorageToDomainByVdsId(getNewMaster(false), getVds().getId())) { super.executeCommand(); } else { getReturnValue().setFault(new VdcFault(new VdcBLLException(VdcBllErrors.StorageServerConnectionError, "Failed to connect storage"), VdcBllErrors.StorageServerConnectionError)); } } finally { if (!reconstructOpsSucceeded) { DbFacade.getInstance().getStoragePoolIsoMapDao().remove(new StoragePoolIsoMapId(getRecoveryStoragePoolParametersData() .getNewMasterDomainId(), getRecoveryStoragePoolParametersData().getStoragePoolId())); } } }
Source:
<code>private void configureLanguageSelection(Preferences preferences) { languageComboBox.setItems(FXCollections.observableArrayList(LanguageInfo.getAllDisplayNames())); <START> String language = preferences.getLanguage().getLanguage(); <END> languageComboBox.getSelectionModel().select(LanguageInfo.getIndexByLanguageCode(language)); languageComboBox.setDisable(false); languageComboBox.setOnAction(event -> onLanguageSelected(preferences)); }</code><technical_language>getLanguage().getLanguage() bugs :P rename of it? (probably first)</technical_language>

Target:
private void configureLanguageSelection(Preferences preferences) { languageComboBox.setButtonCell(new StringListCell<>(languageInfo -> i18n.get(languageInfo.getDisplayNameKey()))); languageComboBox.setCellFactory(param -> new StringListCell<>(languageInfo -> i18n.get(languageInfo.getDisplayNameKey()))); languageComboBox.setItems(FXCollections.observableArrayList(LanguageInfo.values())); LanguageInfo languageInfo = preferences.getLocalization().getLanguage(); languageComboBox.getSelectionModel().select(languageInfo.ordinal()); }
Source:
<code>public void adsTrackingOptOutOasis() { networkTrafficInterceptor.startIntercepting(); Boolean noKikimoraRequestFound = false; Boolean noKruxRequestFound = false; String url = appendTrackingOptOutParameters(urlBuilder.getUrlForPage(new Page(TEST_WIKI, TEST_PAGE))); AdsBaseObject adsBaseObject = new AdsBaseObject(driver, url); try { adsBaseObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, KIKIMORA_PATTERN); <START> } catch (TimeoutException exception) { <END> noKikimoraRequestFound = true; } try { adsBaseObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, KRUX_PATTERN); } catch (TimeoutException exception) { noKruxRequestFound = true; } assertTrue(noKikimoraRequestFound); assertTrue(noKruxRequestFound); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') log rethrow this exception. [![rule](<LINK_1>](http://sonar-s4/coding_rules#rule_key=squid%3AS1166)</technical_language>

Target:
public void adsTrackingOptOutOasis() { networkTrafficInterceptor.startIntercepting(); Boolean noKikimoraRequestFound = false; Boolean noKruxRequestFound = false; String url = appendTrackingOptOutParameters(urlBuilder.getUrlForPage(new Page(TEST_WIKI, TEST_PAGE))); AdsBaseObject adsBaseObject = new AdsBaseObject(driver, url); try { adsBaseObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, KIKIMORA_PATTERN); } catch (TimeoutException exception) { noKikimoraRequestFound = true; } try { adsBaseObject.wait.forSuccessfulResponseByUrlPattern(networkTrafficInterceptor, KRUX_PATTERN); } catch (TimeoutException exception) { noKruxRequestFound = true; } Assertion.assertTrue( noKikimoraRequestFound, "Kikimora tracking is not disabled, request to Data Warehouse was found" ); Assertion.assertTrue( noKruxRequestFound, "Krux tracking is not disabled, request to Krux services was found" ); }
Source:
<code>long gtk_draw (long widget, long cairo) { boolean overlayScrolling = !OS.GTK_OVERLAY_SCROLLING_DISABLED && GTK.GTK_VERSION >= OS.VERSION(3, 16, 0); <START> if (OS.G_OBJECT_TYPE(widget) == OS.swt_fixed_get_type() && overlayScrolling) { <END> if ((style & SWT.V_SCROLL) != 0) { GtkAllocation verticalBarAlloc = new GtkAllocation (); GTK.gtk_widget_get_allocation(getVerticalBar().handle, verticalBarAlloc); GdkRectangle r2 = new GdkRectangle (); GDK.gdk_cairo_get_clip_rectangle (cairo, r2); if (r2.width == verticalBarAlloc.width && r2.height == verticalBarAlloc.height) { return 0; } } if ((style & SWT.H_SCROLL) != 0) { GtkAllocation horizontalBarAlloc = new GtkAllocation (); GTK.gtk_widget_get_allocation(getVerticalBar().handle, horizontalBarAlloc); GdkRectangle r2 = new GdkRectangle (); GDK.gdk_cairo_get_clip_rectangle (cairo, r2); if (r2.width == horizontalBarAlloc.width && r2.height == horizontalBarAlloc.height) { return 0; } } } return super.gtk_draw(widget, cairo); }</code><technical_language>if exchange left right faster for overlay case (us) :)</technical_language>

Target:
long gtk_draw (long widget, long cairo) { boolean overlayScrolling = !OS.GTK_OVERLAY_SCROLLING_DISABLED && GTK.GTK_VERSION >= OS.VERSION(3, 16, 0); if (overlayScrolling && OS.G_OBJECT_TYPE(widget) == OS.swt_fixed_get_type()) { if ((style & SWT.V_SCROLL) != 0 && verticalBar != null) { GtkAllocation verticalBarAlloc = new GtkAllocation(); GTK.gtk_widget_get_allocation(verticalBar.handle, verticalBarAlloc); GdkRectangle rect = new GdkRectangle(); GDK.gdk_cairo_get_clip_rectangle(cairo, rect); if (rect.width == verticalBarAlloc.width && rect.height == verticalBarAlloc.height) { return 0; } } if ((style & SWT.H_SCROLL) != 0 && horizontalBar != null) { GtkAllocation horizontalBarAlloc = new GtkAllocation(); GTK.gtk_widget_get_allocation(horizontalBar.handle, horizontalBarAlloc); GdkRectangle rect = new GdkRectangle(); GDK.gdk_cairo_get_clip_rectangle(cairo, rect); if (rect.width == horizontalBarAlloc.width && rect.height == horizontalBarAlloc.height) { return 0; } } } return super.gtk_draw(widget, cairo); }
Source:
<code>public void run(ProgressMonitor pm) { activeFilter.initialise(pm,source); IntegerUnion nextViewSelection = new IntegerUnion(); int rowCount = table.getRowCount(); pm.startTask(getTaskName(), 100); for(int viewId=0;viewId<rowCount;viewId++) { if(activeFilter.isSelected(table.getRowSorter().convertRowIndexToModel(viewId), source)) { nextViewSelection.add(viewId); pm.progressTo(viewId / rowCount * 100); if(pm.isCancelled()) { return; } } } pm.endTask(); Iterator<Integer> intervals = nextViewSelection.getValueRanges().iterator(); try { table.getSelectionModel().setValueIsAdjusting(true); table.clearSelection(); while(intervals.hasNext()) { int begin = intervals.next(); int end = intervals.next(); table.addRowSelectionInterval(begin, end); if(pm.isCancelled()) { return; } <START> } <END> }finally { table.getSelectionModel().setValueIsAdjusting(false); } }</code><technical_language>I do'nt understand need a loop. Is faster set intervals in a JTable</technical_language>

Target:
public void run(ProgressMonitor pm) { try { runFilter(pm); } finally { filterRunning.set(false); } }
Source:
<code>public ConnectorPageSource createPageSource(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorSplit split, List<ColumnHandle> columns) { requireNonNull(split, "partitionChunk is null"); PinotSplit pinotSplit = checkType(split, PinotSplit.class, "split"); <START> checkArgument(pinotSplit.getConnectorId().equals(connectorId), "split is not for this connector"); <END> List<PinotColumnHandle> handles = new ArrayList<>(); if (columns.isEmpty()) { handles.add(new PinotColumnHandle(this.connectorId, pinotSplit.getTimeColumn().getName(), pinotSplit.getTimeColumn().getType(), 0)); } else { for (ColumnHandle handle : columns) { handles.add(checkType(handle, PinotColumnHandle.class, "handle")); } } return new PinotPageSource(this.pinotConfig, this.pinotQueryClient, pinotSplit, handles); }</code><technical_language>necessary. Remove</technical_language>

Target:
public ConnectorPageSource createPageSource(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorSplit split, List<ColumnHandle> columns) { requireNonNull(split, "partitionChunk is null"); PinotSplit pinotSplit = checkType(split, PinotSplit.class, "split"); ImmutableList.Builder<PinotColumnHandle> handlesBuilder = ImmutableList.builder(); if (columns.isEmpty()) { handlesBuilder.add(new PinotColumnHandle(pinotSplit.getTimeColumn().getName(), pinotSplit.getTimeColumn().getType(), 0)); } else { columns.forEach(handle -> handlesBuilder.add(checkType(handle, PinotColumnHandle.class, "handle"))); } return new PinotPageSource(pinotConfig, pinotQueryClient, pinotSplit, handlesBuilder.build()); }
Source:
<code>public AsyncJobStatusDTO refreshPoolsForProduct( @PathParam("owner_key") String ownerKey, @PathParam("product_id") String productId, @QueryParam("lazy_regen") @DefaultValue("true") boolean lazyRegen) throws JobException { if (config.getBoolean(ConfigProperties.STANDALONE)) { log.warn("Ignoring refresh pools request due to standalone config."); return null; } final Owner owner = this.getOwnerByKey(ownerKey); final Product product = this.fetchProduct(owner, productId); <START> return this.translator.translate( <END> jobManager.queueJob( RefreshPoolsForProductJob.createJobConfig(product, lazyRegen) ), AsyncJobStatusDTO.class); }</code><technical_language>cleanest declare step independently. style requirements silly multiline indentation, reason cram line here</technical_language>

Target:
public AsyncJobStatusDTO refreshPoolsForProduct( @PathParam("owner_key") String ownerKey, @PathParam("product_id") String productId, @QueryParam("lazy_regen") @DefaultValue("true") boolean lazyRegen) throws JobException { if (config.getBoolean(ConfigProperties.STANDALONE)) { log.warn("Ignoring refresh pools request due to standalone config."); return null; } Owner owner = this.getOwnerByKey(ownerKey); Product product = this.fetchProduct(owner, productId); JobConfig config = RefreshPoolsForProductJob .createJobConfig() .setProduct(product) .setLazy(lazyRegen); AsyncJobStatus status = jobManager.queueJob(config); return this.translator.translate(status, AsyncJobStatusDTO.class); }
Source:
<code>public RealmObjectSchema addField(String fieldName, Class<?> fieldType, FieldAttribute... attributes) { FieldMetaData metadata = SUPPORTED_SIMPLE_FIELDS.get(fieldType); if (metadata == null) { if (SUPPORTED_LINKED_FIELDS.containsKey(fieldType)) { throw new IllegalArgumentException("Use addLinkField() instead to add fields that link to other RealmObjects: " + fieldName); } else { throw new IllegalArgumentException(String.format("Realm doesn't support this field type: %s(%s)", fieldName, fieldType)); } } checkNewFieldName(fieldName); boolean nullable = metadata.defaultNullable; if (containsAttribute(attributes, FieldAttribute.REQUIRED) || containsAttribute(attributes, FieldAttribute.PRIMARY_KEY)) { nullable = false; } if (containsAttribute(attributes, FieldAttribute.PRIMARY_KEY) && <START> metadata.realmType.equals(RealmFieldType.STRING)) { <END> nullable = true; } long columnIndex = table.addColumn(metadata.realmType, fieldName, nullable); try { addModifiers(fieldName, attributes); } catch (Exception e) { table.removeColumn(columnIndex); throw e; } return this; }</code><technical_language>1 line</technical_language>

Target:
public RealmObjectSchema addField(String fieldName, Class<?> fieldType, FieldAttribute... attributes) { FieldMetaData metadata = SUPPORTED_SIMPLE_FIELDS.get(fieldType); if (metadata == null) { if (SUPPORTED_LINKED_FIELDS.containsKey(fieldType)) { throw new IllegalArgumentException("Use addLinkField() instead to add fields that link to other RealmObjects: " + fieldName); } else { throw new IllegalArgumentException(String.format("Realm doesn't support this field type: %s(%s)", fieldName, fieldType)); } } checkNewFieldName(fieldName); boolean nullable = metadata.defaultNullable; if (containsAttribute(attributes, FieldAttribute.REQUIRED)) { nullable = false; } long columnIndex = table.addColumn(metadata.realmType, fieldName, nullable); try { addModifiers(fieldName, attributes); } catch (Exception e) { table.removeColumn(columnIndex); throw e; } return this; }
Source:
<code>protected NetworkState doTaskBackground(Void... params) { NetworkState out = NetworkState.CONNECTED; if (!isOnline(this.c)) { out = NetworkState.DISCONNECTED; <START> } else if (!pingSuccess(googleURL)) { <END> out = NetworkState.CAPTIVE_PORTAL; } else if (!pingCC(commcareURL)) { out = NetworkState.COMMCARE_BLOCKED; } return out; }</code><technical_language>a 200 response a url a captive portal network is unavailable. Similarly 200 response user is connected response supplied captive portal. wanna try <LINK_0></technical_language>

Target:
protected NetworkState doTaskBackground(Void... params) { if (!isOnline(this.c) || !pingSuccess(googleURL)) { return NetworkState.DISCONNECTED; } return pingCC(); }
Source:
<code>public synchronized void setEntryIsLive() { <START> if (readyForPlayback) { <END> logger.debug("Attention - READY_FOR_PLAYBACK already raised"); return; } if (!entryRegistered) { logger.error("setReadyForPlayback called but stream is unregistered"); return ; } TimerTask setMediaServerTask = new TimerTask() { @Override public void run() { logger.info("Initial timer task running [" + liveEntry.id + "] - PLAYABLE"); setEntryMediaServer(liveEntry, index, KalturaLiveEntryStatus.PLAYABLE); readyForPlayback = true; } }; timer = new Timer("register-" + liveEntry.id, true); timer.schedule(setMediaServerTask, 0); logger.debug("Scheduled initial timer [" + liveEntry.id + "]"); }</code><technical_language>isReadyForPlayback() function</technical_language>

Target:
public synchronized void setEntryIsLive() { if (isReadyForPlayback()) { logger.info("setEntryIsLive was called - IsLive is already on"); return; } TimerTask setMediaServerTask = new TimerTask() { @Override public void run() { if(!isEntryRegistered()) { logger.info("Entry's not registered, can't call setEntryMediaServer"); return; } logger.info("Initial timer task running [" + liveEntry.id + "] - PLAYABLE"); setEntryMediaServer(liveEntry, index, KalturaLiveEntryStatus.PLAYABLE); readyForPlayback = true; } }; timer = new Timer("register-" + liveEntry.id, true); timer.schedule(setMediaServerTask, 0); logger.debug("Scheduled initial timer [" + liveEntry.id + "]"); }
Source:
<code>public boolean intersectsWith(RectF rectangle) { <START> Canvas canvas = new Canvas(); <END> canvas.setBitmap(getBitmapOfCurrentLayer()); Rect rectangleBoundsCanvas = canvas.getClipBounds(); return rectangleBoundsCanvas.left < rectangle.right && rectangle.left < rectangleBoundsCanvas.right && rectangleBoundsCanvas.top < rectangle.bottom && rectangle.top < rectangleBoundsCanvas.bottom; }</code><technical_language>This is unecessary. need width height of workspace getWidth() getHeight() respectively. In this case need a rectangle (and huge amount of memory)</technical_language>

Target:
public boolean intersectsWith(RectF rectangle) { return 0 < rectangle.right && rectangle.left < getWidth() && 0 < rectangle.bottom && rectangle.top < getHeight(); }