auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static List<String> getCountryCodes (HttpServletRequest request) throws DocumentException { List<String> countryCodes = new ArrayList<>(); File dataFile = new File(request.getSession().getServletContext().getRealPath("files/country-code-iso-3166-all.xml")); SAXReader reader = new SAXReader(); Document dataDoc = reader.read(dataFile); List<Node> nodes = dataDoc.selectNodes(" for (Node node : nodes) { countryCodes.add(node.getStringValue().trim()); } return countryCodes; }

Target:
public static Map<String, String> getCountryCodes (HttpServletRequest request) throws DocumentException { Map<String, String> countryCodes = new TreeMap<>(); File dataFile = new File(request.getSession().getServletContext().getRealPath("files/country-code-iso-3166-all.xml")); SAXReader reader = new SAXReader(); Document dataDoc = reader.read(dataFile); List<Node> nodes = dataDoc.selectNodes(" for (Node node : nodes) { String name = node.selectSingleNode("@name").getStringValue().trim(); String alpha2 = node.selectSingleNode("@alpha-2").getStringValue().trim(); countryCodes.put(name, alpha2); } return countryCodes; }
Source:
protected Template doPopulate(Template model, VmTemplate entity) { model.setConsoleDeviceEnabled(!getConsoleDevicesForEntity(new Guid(model.getId())).isEmpty()); return model; }

Target:
protected Template doPopulate(Template model, VmTemplate entity) { if (!model.isSetConsole()) { model.setConsole(new Console()); } model.getConsole().setEnabled(!getConsoleDevicesForEntity(entity.getId()).isEmpty()); return model; }
Source:
private void setCamcorderProfile(CamcorderProfile profile, boolean recordAudio, int fps) { int compatible_fps = isCompatibleWithDevice(fps * 1000) ? fps : profile.videoFrameRate; mMediaRecorder.setOutputFormat(profile.fileFormat); mMediaRecorder.setVideoFrameRate(compatible_fps); mMediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight); mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate); mMediaRecorder.setVideoEncoder(profile.videoCodec); if (recordAudio) { mMediaRecorder.setAudioEncodingBitRate(profile.audioBitRate); mMediaRecorder.setAudioChannels(profile.audioChannels); mMediaRecorder.setAudioSamplingRate(profile.audioSampleRate); mMediaRecorder.setAudioEncoder(profile.audioCodec); } }

Target:
private void setCamcorderProfile(CamcorderProfile profile, boolean recordAudio, int fps) { int compatible_fps = isCompatibleWithDevice(fps) ? fps : profile.videoFrameRate; mMediaRecorder.setOutputFormat(profile.fileFormat); mMediaRecorder.setVideoFrameRate(compatible_fps); mMediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight); mMediaRecorder.setVideoEncodingBitRate(profile.videoBitRate); mMediaRecorder.setVideoEncoder(profile.videoCodec); if (recordAudio) { mMediaRecorder.setAudioEncodingBitRate(profile.audioBitRate); mMediaRecorder.setAudioChannels(profile.audioChannels); mMediaRecorder.setAudioSamplingRate(profile.audioSampleRate); mMediaRecorder.setAudioEncoder(profile.audioCodec); } }
Source:
private String determineType(ModuleDeploymentRequest request, int lastIndex) { String type = getNamedChannelModuleType(request, lastIndex); if (type != null) { return type; } String name = request.getModule(); int index = request.getIndex(); List<ModuleDefinition> defs = moduleRegistry.findDefinitions(name); if (defs.size() == 0) { throw new RuntimeException("Module definition is missing for " + name); } if (defs.size() == 1) { type = defs.get(0).getType(); } if (lastIndex == 0) { for (ModuleDefinition def : defs) { if (def.getType().equals(ModuleType.JOB.getTypeName()) || def.getType().equals(ModuleType.TRIGGER.getTypeName())) { type = def.getType(); } } } else if (index == 0) { type = "source"; } else if (index == lastIndex) { type = "sink"; } if (type == null) { throw new RuntimeException("Module definition is missing for " + name); } return verifyModuleOfTypeExists(name, type); }

Target:
private ModuleType determineType(ModuleDeploymentRequest request, int lastIndex) { ModuleType moduleType = getNamedChannelModuleType(request, lastIndex); if (moduleType != null) { return moduleType; } String type = null; String name = request.getModule(); int index = request.getIndex(); List<ModuleDefinition> defs = moduleRegistry.findDefinitions(name); if (defs.size() == 0) { throw new RuntimeException("Module definition is missing for " + name); } if (defs.size() == 1) { type = defs.get(0).getType(); } if (lastIndex == 0) { for (ModuleDefinition def : defs) { if (def.getType().equals(ModuleType.JOB.getTypeName()) || def.getType().equals(ModuleType.TRIGGER.getTypeName())) { type = def.getType(); } } } else if (index == 0) { type = ModuleType.SOURCE.getTypeName(); } else if (index == lastIndex) { type = ModuleType.SINK.getTypeName(); } if (type == null) { throw new NoSuchModuleException(name); } return verifyModuleOfTypeExists(name, type); }
Source:
public DefaultEditorSession(final ManagedSession session, final CanvasCommandManager<AbstractCanvasHandler> canvasCommandManager, final @Session SessionCommandManager<AbstractCanvasHandler> sessionCommandManager, final @Request SessionCommandManager<AbstractCanvasHandler> requestCommandManager, final ClientCommandRegistry<org.kie.workbench.common.stunner.core.command.Command<AbstractCanvasHandler, CanvasViolation>> clientCommandRegistry) { this.session = session; this.commandRegistry = clientCommandRegistry.setSession(session); this.sessionCommandManager = sessionCommandManager; this.requestCommandManager = requestCommandManager; this.canvasCommandManager = canvasCommandManager; }

Target:
public DefaultEditorSession(final ManagedSession session, final CanvasCommandManager<AbstractCanvasHandler> canvasCommandManager, final @Session SessionCommandManager<AbstractCanvasHandler> sessionCommandManager, final @Request SessionCommandManager<AbstractCanvasHandler> requestCommandManager, final ClientCommandRegistry<org.kie.workbench.common.stunner.core.command.Command<AbstractCanvasHandler, CanvasViolation>> clientCommandRegistry) { this.session = session; this.commandRegistry = clientCommandRegistry; this.sessionCommandManager = sessionCommandManager; this.requestCommandManager = requestCommandManager; this.canvasCommandManager = canvasCommandManager; }
Source:
public int hashCode() { int result = (key ? 1 : 0); result = 31 * result + (path != null ? path.hashCode() : 0); return result; }

Target:
public int hashCode() { int result = key ? 1 : 0; result = 31 * result + (path != null ? path.hashCode() : 0); return result; }
Source:
public static List<String> nodetoolGetSSTables(String containerName, String keyspace, TableReference tableRef, byte[] rowKey) throws IOException, InterruptedException { String query = String.format("nodetool getsstables %s %s__%s %s", keyspace, tableRef.getNamespace().getName(), tableRef.getTablename(), BaseEncoding.base16().lowerCase().encode(rowKey)); String output = EteSetup.execCliCommand(containerName, query); String[] outputSplitIntoLines = output.split("\n"); return Arrays.stream(outputSplitIntoLines) .skip(1) .collect(Collectors.toList()); }

Target:
public static List<String> nodetoolGetSSTables(String containerName, String keyspace, TableReference tableRef, byte[] rowKey) throws IOException, InterruptedException { String query = String.format("nodetool getsstables %s %s %s", keyspace, CassandraKeyValueServiceImpl.internalTableName(tableRef), BaseEncoding.base16().lowerCase().encode(rowKey)); String output = EteSetup.execCliCommand(containerName, query); String[] outputSplitIntoLines = output.split("\n"); return Arrays.stream(outputSplitIntoLines) .skip(1) .collect(Collectors.toList()); }
Source:
public void userTuneElementProviderTest(XmlPullParserKind parserKind) throws XmlPullParserException, IOException, SmackParsingException { XmlPullParser parser = SmackTestUtil.getParserFor(xml, parserKind); UserTuneElement parsed = UserTuneProvider.INSTANCE.parse(parser); assertEquals(xml, parsed.toXML().toString()); }

Target:
public void userTuneElementProviderTest(XmlPullParserKind parserKind) throws XmlPullParserException, IOException, SmackParsingException { XmlPullParser parser = SmackTestUtil.getParserFor(xml, parserKind); UserTuneElement parsed = UserTuneProvider.INSTANCE.parse(parser); assertXmlSimilar(xml, parsed.toXML().toString()); }
Source:
public void switchDefaultRepo(){ logger.info("Triggered switch default repo"); String[] openRepos = logic.getOpenRepositories().toArray(new String[0]); String currentRepo = logic.getDefaultRepo(); for(int i = 0; i < openRepos.length; i++){ if(openRepos[i].equals(currentRepo)){ if(i == openRepos.length-1){ primaryRepoChanged(openRepos[0]); } else { primaryRepoChanged(openRepos[i+1]); } break; } } }

Target:
public void switchDefaultRepo(){ String[] openRepos = repoSelector.getContents().toArray(new String[0]); String currentRepo = logic.getDefaultRepo(); for (int i = 0; i < openRepos.length; i++) { if (openRepos[i].equals(currentRepo)) { if (i == openRepos.length - 1) { primaryRepoChanged(openRepos[0]); repoSelector.setText(openRepos[0]); } else { primaryRepoChanged(openRepos[i + 1]); repoSelector.setText(openRepos[i + 1]); } } } }
Source:
private void addRedirectListener() { response.addRedirectListener(new MutableResponse.RedirectListener() { @Override public void beforeRedirect() { if (!validator.hasErrors() && entityManager.getTransaction().isActive()) { entityManager.getTransaction().commit(); } } }); }

Target:
private void addRedirectListener() { response.addRedirectListener(new MutableResponse.RedirectListener() { @Override public void beforeRedirect() { commit(entityManager.getTransaction()); } }); }
Source:
public Operation waitForOperation(Operation operation, long timeout, TimeUnit timeUnit) throws TimeoutException, IOException { GetOperationRequest request = GetOperationRequest.newBuilder().setName(operation.getName()).build(); ExponentialBackOff backOff = new ExponentialBackOff.Builder() .setInitialIntervalMillis(100) .setMultiplier(1.3) .setMaxIntervalMillis(Ints.checkedCast(TimeUnit.SECONDS.toMillis(60))) .setMaxElapsedTimeMillis(Ints.checkedCast(timeUnit.toMillis(timeout))) .build(); Operation currentOperationState = operation; while (true) { if (currentOperationState.getDone()) { switch (currentOperationState.getResultCase()) { case RESPONSE: return currentOperationState; case ERROR: throw StatusProto.toStatusRuntimeException(currentOperationState.getError()); case RESULT_NOT_SET: throw new IllegalStateException( "System returned invalid response for Operation check: " + currentOperationState); } } final long backOffMillis; try { backOffMillis = backOff.nextBackOffMillis(); } catch (IOException e) { throw new RuntimeException(e); } if (backOffMillis == BackOff.STOP) { throw new TimeoutException("Operation did not complete in time"); } else { try { Thread.sleep(backOffMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Interrupted while waiting for operation to finish"); } } currentOperationState = getOperation(request); } }

Target:
public Operation waitForOperation(Operation operation, long timeout, TimeUnit timeUnit) throws TimeoutException, IOException { GetOperationRequest request = GetOperationRequest.newBuilder().setName(operation.getName()).build(); ExponentialBackOff backOff = new ExponentialBackOff.Builder() .setInitialIntervalMillis(100) .setMultiplier(1.3) .setMaxIntervalMillis(Ints.checkedCast(TimeUnit.SECONDS.toMillis(60))) .setMaxElapsedTimeMillis(Ints.checkedCast(timeUnit.toMillis(timeout))) .build(); Operation currentOperationState = operation; while (true) { if (currentOperationState.getDone()) { switch (currentOperationState.getResultCase()) { case RESPONSE: return currentOperationState; case ERROR: throw StatusProto.toStatusRuntimeException(currentOperationState.getError()); default: throw new IllegalStateException( "System returned invalid response for Operation check: " + currentOperationState); } } final long backOffMillis; try { backOffMillis = backOff.nextBackOffMillis(); } catch (IOException e) { throw new RuntimeException(e); } if (backOffMillis == BackOff.STOP) { throw new TimeoutException("Operation did not complete in time"); } else { try { Thread.sleep(backOffMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("Interrupted while waiting for operation to finish"); } } currentOperationState = getOperation(request); } }
Source:
public CounterStateProvider(ITmfTrace trace, String id) { super(trace, id); ImmutableSet.Builder<CounterAspect> counterAspects = new Builder<>(); Iterable<@NonNull ITmfEventAspect<?>> aspects = trace.getEventAspects(); for (ITmfEventAspect<?> aspect : aspects) { if (aspect instanceof CounterAspect) { counterAspects.add((CounterAspect) aspect); } } fCounterAspects = counterAspects.build(); }

Target:
public CounterStateProvider(ITmfTrace trace, String id) { super(trace, id); Iterable<ITmfEventAspect<?>> counterAspects = Iterables.filter(trace.getEventAspects(), aspect -> aspect instanceof CounterAspect); fCounterAspects = ImmutableSet.copyOf(counterAspects); }
Source:
public void testTumorOnlyWithDbsnp() throws Exception { Utils.resetRandomGenerator(); final File outputVcf = createTempFile("output", ".vcf"); final String[] args = { "-I", NA12878_20_21_WGS_bam, "-tumor", "NA12878", "-R", b37_reference_20_21, "-dbsnp", dbsnp_138_b37_20_21_vcf, "-L", "20:10000000-10010000", "-O", outputVcf.getAbsolutePath() }; runCommandLine(args); final long numVariants = StreamSupport.stream(new FeatureDataSource<VariantContext>(outputVcf).spliterator(), false).count(); }

Target:
public void testTumorOnlyWithDbsnp() throws Exception { Utils.resetRandomGenerator(); final File outputVcf = createTempFile("output", ".vcf"); final String[] args = { "-I", NA12878_20_21_WGS_bam, "-tumor", "NA12878", "-R", b37_reference_20_21, "-dbsnp", dbsnp_138_b37_20_21_vcf, "-L", "20:10000000-10010000", "-O", outputVcf.getAbsolutePath() }; runCommandLine(args); }
Source:
public void getFieldReportRequest(int id) { HashMap<String, JSONObject> params = new HashMap<String, JSONObject>(); UserFieldReportRequest fieldReportRequest = new UserFieldReportRequest(getActivity(), params, new Response.Listener<ArrayList<FieldReport>>() { @Override public void onResponse(ArrayList<FieldReport> fieldReports) { Log.e("Field Response", "Sucess"); setFieldReports(fieldReports); mFieldReportAdapter.notifyDataSetChanged(); } }, id); mNetworkManager.getRequestQueue().add(fieldReportRequest); }

Target:
public void getFieldReportRequest(int id) { UserFieldReportRequest fieldReportRequest = new UserFieldReportRequest(mParentActivity, new HashMap<String, JSONObject>(), new Response.Listener<ArrayList<FieldReport>>() { @Override public void onResponse(ArrayList<FieldReport> fieldReports) { setFieldReports(fieldReports); mFieldReportAdapter.notifyDataSetChanged(); }}, id); mNetworkManager.getRequestQueue().add(fieldReportRequest); }
Source:
public ValidationResult validateConcurAccountInfo(ConcurAccountInfo concurAccountInfo) { ValidationResult validationResult = checkAccountingString( concurAccountInfo.getChart(), concurAccountInfo.getAccountNumber(), concurAccountInfo.getSubAccountNumber(), concurAccountInfo.getObjectCode(), concurAccountInfo.getSubObjectCode(), concurAccountInfo.getProjectCode()); return validationResult; }

Target:
public ValidationResult validateConcurAccountInfo(ConcurAccountInfo concurAccountInfo) { return checkAccountingString( concurAccountInfo.getChart(), concurAccountInfo.getAccountNumber(), concurAccountInfo.getSubAccountNumber(), concurAccountInfo.getObjectCode(), concurAccountInfo.getSubObjectCode(), concurAccountInfo.getProjectCode()); }
Source:
private int palatalize(char[] s, int len) { if (StemmerUtil.endsWith(s, len, "ci") || StemmerUtil.endsWith(s, len, "ce") || StemmerUtil.endsWith(s, len, "či") || StemmerUtil.endsWith(s, len, "če")) { s[len - 2] = 'k'; return len - 1; } if (StemmerUtil.endsWith(s, len, "zi") || StemmerUtil.endsWith(s, len, "ze") || StemmerUtil.endsWith(s, len, "ži") || StemmerUtil.endsWith(s, len, "že")) { s[len - 2] = 'h'; return len - 1; } if (StemmerUtil.endsWith(s, len, "čte") || StemmerUtil.endsWith(s, len, "čti") || StemmerUtil.endsWith(s, len, "čtí")) { s[len - 3] = 'c'; s[len - 2] = 'k'; return len - 1; } if (StemmerUtil.endsWith(s, len, "šte") || StemmerUtil.endsWith(s, len, "šti") || StemmerUtil.endsWith(s, len, "ští")) { s[len - 3] = 's'; s[len - 2] = 'k'; return len - 1; } return len - 1; }

Target:
private int palatalize(char[] s, int len) { assert len > 3; if (endsWith(s, len, "ci") || endsWith(s, len, "ce") || endsWith(s, len, "či") || endsWith(s, len, "če")) { s[len - 2] = 'k'; } else if (endsWith(s, len, "zi") || endsWith(s, len, "ze") || endsWith(s, len, "ži") || endsWith(s, len, "že")) { s[len - 2] = 'h'; } else if (endsWith(s, len, "čte") || endsWith(s, len, "čti") || endsWith(s, len, "čtí")) { s[len - 3] = 'c'; s[len - 2] = 'k'; } else if (endsWith(s, len, "šte") || endsWith(s, len, "šti") || endsWith(s, len, "ští")) { s[len - 3] = 's'; s[len - 2] = 'k'; } return len - 1; }
Source:
public List<LogEntry> queryLogs(AuditQueryBuilder builder) { List<AuditFilterBuilder> filters = builder.filters(); List<AuditOrderBuilder> orders = builder.orders(); long offset = builder.offset(); long limit = builder.limit(); List<Bson> filterList = new ArrayList<>(filters.size()); for (AuditFilterBuilder filter : filters) { switch (filter.getOperator()) { case AuditFilterBuilder.OPERATOR_LT: filterList.add(Filters.lt(filter.getName(), filter.getValue())); break; case AuditFilterBuilder.OPERATOR_LTE: filterList.add(Filters.lte(filter.getName(), filter.getValue())); break; case AuditFilterBuilder.OPERATOR_GTE: filterList.add(Filters.gte(filter.getName(), filter.getValue())); break; case AuditFilterBuilder.OPERATOR_GT: filterList.add(Filters.gt(filter.getName(), filter.getValue())); break; case AuditFilterBuilder.OPERATOR_IN: filterList.add(Filters.in(filter.getName(), (List<?>) filter.getValue())); break; case AuditFilterBuilder.OPERATOR_EQ: default: filterList.add(Filters.eq(filter.getName(), filter.getValue())); break; } } Bson mgFilter = Filters.and(filterList); List<Bson> orderList = new ArrayList<>(orders.size()); for (AuditOrderBuilder order : orders) { if (order.isDescending()) { orderList.add(Sorts.descending(order.getName())); } else { orderList.add(Sorts.ascending(order.getName())); } } Bson mgOrder = Sorts.orderBy(orderList); logRequest(mgFilter, mgOrder); FindIterable<Document> iterable = collection.find(mgFilter) .sort(mgOrder) .skip(Long.valueOf(offset).intValue()) .limit(Long.valueOf(limit).intValue()); return buildLogEntries(iterable); }

Target:
public List<LogEntry> queryLogs(AuditQueryBuilder builder) { Predicate andPredicate = builder.predicate(); OrderByList orders = builder.orders(); long offset = builder.offset(); long limit = builder.limit(); List<Predicate> predicates = (List<Predicate>) ((List<?>) ((MultiExpression) andPredicate).values); Bson mgFilter = createFilter(predicates); List<Bson> orderList = new ArrayList<>(orders.size()); for (OrderByExpr order : orders) { String name = order.reference.name; if (order.isDescending) { orderList.add(Sorts.descending(name)); } else { orderList.add(Sorts.ascending(name)); } } Bson mgOrder = Sorts.orderBy(orderList); logRequest(mgFilter, mgOrder); FindIterable<Document> iterable = collection.find(mgFilter) .sort(mgOrder) .skip((int) offset) .limit((int) limit); return buildLogEntries(iterable); }
Source:
public void selectDevfile(Devfile devfile) { waitDevfiles(asList(devfile)); try { seleniumWebDriverHelper.waitAndClick(By.xpath(format(DEVFILE_ROW_XPATH, devfile.getId()))); waitDevfileSelected(devfile); } catch (WebDriverException ex) { seleniumWebDriverHelper.waitAndClick(By.xpath(format(DEVFILE_ROW_XPATH, devfile.getId()))); } }

Target:
public void selectDevfile(Devfile devfile) { waitDevfiles(asList(devfile)); try { seleniumWebDriverHelper.waitAndClick(By.xpath(format(DEVFILE_ROW_XPATH, devfile.getId()))); waitDevfileSelected(devfile); } catch (TimeoutException ex) { seleniumWebDriverHelper.waitAndClick(By.xpath(format(DEVFILE_ROW_XPATH, devfile.getId()))); } }
Source:
public RevCommit call() throws CorruptObjectException, UnmergedPathException, IOException, IllegalArgumentException { processOptions(); Ref head = repo.getRef(Constants.HEAD); if (head == null) throw new IllegalStateException(CANNOT_COMMIT_WITHOUT_A_HEAD); ObjectId parentID = repo.resolve(Constants.HEAD + "^{commit}"); DirCache index = DirCache.lock(repo); try { ObjectWriter repoWriter = new ObjectWriter(repo); ObjectId indexTreeId = index.writeTree(repoWriter); Commit commit = new Commit(repo); Date currentDate = new Date(); PersonIdent currentCommitter = committer == null ? new PersonIdent( repo) : new PersonIdent(committer, currentDate); commit.setCommitter(currentCommitter); commit.setAuthor(author == null ? currentCommitter : new PersonIdent(author, currentDate)); commit.setMessage(message); if (parentID != null) commit.setParentIds(new ObjectId[] { parentID }); commit.setTreeId(indexTreeId); ObjectId commitId = repoWriter.writeCommit(commit); commit.setCommitId(commitId); RevCommit revCommit = new RevWalk(repo).parseCommit(commitId); RefUpdate ru = repo.updateRef(Constants.HEAD); ru.setNewObjectId(commitId); ru.setRefLogMessage("commit : " + revCommit.getShortMessage(), false); ru.setExpectedOldObjectId(parentID); switch (ru.update()) { case NEW: case FAST_FORWARD: return revCommit; default: throw new IllegalStateException("Updating the ref " + Constants.HEAD + " to " + commitId.toString() + " failed"); } } finally { index.unlock(); } }

Target:
public RevCommit call() throws NoHeadException, NoMessageException, UnmergedPathException, JGitInternalException { processOptions(); Ref head; ObjectId parentID; try { head = repo.getRef(Constants.HEAD); if (head == null) throw new NoHeadException( "Commit on repo without HEAD currently not supported"); parentID = repo.resolve(Constants.HEAD + "^{commit}"); DirCache index = DirCache.lock(repo); try { ObjectWriter repoWriter = new ObjectWriter(repo); ObjectId indexTreeId = index.writeTree(repoWriter); Commit commit = new Commit(repo); commit.setCommitter(committer); commit.setAuthor(author); commit.setMessage(message); if (parentID != null) commit.setParentIds(new ObjectId[] { parentID }); commit.setTreeId(indexTreeId); ObjectId commitId = repoWriter.writeCommit(commit); RevCommit revCommit = new RevWalk(repo).parseCommit(commitId); RefUpdate ru = repo.updateRef(Constants.HEAD); ru.setNewObjectId(commitId); ru.setRefLogMessage("commit : " + revCommit.getShortMessage(), false); ru.setExpectedOldObjectId(parentID); switch (ru.update()) { case NEW: case FAST_FORWARD: return revCommit; default: throw new IllegalStateException("Updating the ref " + Constants.HEAD + " to " + commitId.toString() + " failed"); } } finally { index.unlock(); } } catch (UnmergedPathException e) { throw e; } catch (IOException e) { throw new JGitInternalException( "Exception caught during execution of commit command", e); } }
Source:
public boolean isDiskExists(Guid id) { return DbFacade.getInstance().getBaseDiskDao().exists(id); }

Target:
protected boolean isDiskExists(Guid id) { return DbFacade.getInstance().getBaseDiskDao().exists(id); }
Source:
public void enterParameter(SwiftParser.ParameterContext ctx) { SwiftBaseListener listener = null; for (ParseTree child : ctx.children) { if (child.getText().equals(VAR)) { listener = new VariableDecListener(this.printer); } } if (listener == null) { listener = new ConstantDecListener(this.printer); } ParseTreeWalker walker = new ParseTreeWalker(); if (ctx.externalParameterName() != null) { listenerHelper.walkListener(walker, ctx.externalParameterName(), listener); } listenerHelper.walkListener(walker, ctx.localParameterName(), listener); }

Target:
public void enterParameter(SwiftParser.ParameterContext ctx) { SwiftBaseListener listener = null; for (ParseTree child : ctx.children) { if (child.getText().equals(VAR)) { listener = new VariableDecListener(this.printer); break; } } if (listener == null) { listener = new ConstantDecListener(this.printer); } ParseTreeWalker walker = new ParseTreeWalker(); if (ctx.externalParameterName() != null) { listenerHelper.walkListener(walker, ctx.externalParameterName(), listener); } listenerHelper.walkListener(walker, ctx.localParameterName(), listener); }
Source:
public void testExecuteQuery() { Guid vmID = Guid.NewGuid(); VM expectedResult = new VM(); expectedResult.setId(vmID); GetVmByVmIdParameters paramsMock = getQueryParameters(); when(paramsMock.getId()).thenReturn(vmID); VmDAO vmDAOMock = mock(VmDAO.class); when(vmDAOMock.getById(vmID, getUser().getUserId(), paramsMock.isFiltered())).thenReturn(expectedResult); DiskImage disk = new DiskImage(); disk.setvm_guid(vmID); disk.setactive(true); DiskImageDAO diskImageDAO = mock(DiskImageDAO.class); when(diskImageDAO.getAllForVm(vmID)).thenReturn(Collections.singletonList(disk)); DbFacade dbFacadeMock = getDbFacadeMockInstance(); when(dbFacadeMock.getVmDAO()).thenReturn(vmDAOMock); when(dbFacadeMock.getDiskImageDAO()).thenReturn(diskImageDAO); getQuery().executeQueryCommand(); VM result = (VM) getQuery().getQueryReturnValue().getReturnValue(); assertEquals("Wrong VM pool returned", expectedResult, result); assertEquals("Wrong number of disks on the VM", 1, result.getDiskList().size()); assertEquals("Wrong disk on the VM", disk, result.getDiskList().get(0)); }

Target:
public void testExecuteQuery() { Guid vmID = Guid.NewGuid(); VM expectedResult = new VM(); expectedResult.setId(vmID); GetVmByVmIdParameters paramsMock = getQueryParameters(); when(paramsMock.getId()).thenReturn(vmID); VmDAO vmDAOMock = mock(VmDAO.class); when(vmDAOMock.getById(vmID, getUser().getUserId(), paramsMock.isFiltered())).thenReturn(expectedResult); DiskImage disk = new DiskImage(); disk.setvm_guid(vmID); disk.setactive(true); DiskImageDAO diskImageDAO = mock(DiskImageDAO.class); when(diskImageDAO.getAllForVm(vmID)).thenReturn(Collections.singletonList(disk)); DbFacade dbFacadeMock = getDbFacadeMockInstance(); when(dbFacadeMock.getVmDAO()).thenReturn(vmDAOMock); when(dbFacadeMock.getDiskImageDAO()).thenReturn(diskImageDAO); getQuery().executeQueryCommand(); VM result = (VM) getQuery().getQueryReturnValue().getReturnValue(); assertEquals("Wrong VM returned", expectedResult, result); assertEquals("Wrong number of disks on the VM", 1, result.getDiskList().size()); assertEquals("Wrong disk on the VM", disk, result.getDiskList().get(0)); }
Source:
private void hintJobExecutorIfNeeded(JobEntity jobEntity, Date duedate) { if (duedate.getTime() < ClockUtil.getCurrentTime().getTime()) { hintJobExecutor(jobEntity); } }

Target:
private void hintJobExecutorIfNeeded(JobEntity jobEntity, Date duedate) { JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor(); int waitTimeInMillis = jobExecutor.getWaitTimeInMillis(); if (duedate.getTime() < (ClockUtil.getCurrentTime().getTime() + waitTimeInMillis)) { hintJobExecutor(jobEntity); } }
Source:
public void close(short code, String reason) { webSocket.close(code, reason); }

Target:
public void close(short code, String reason) { webSocket.close(JSNumber.valueOf(code), JSString.valueOf(reason)); }
Source:
protected boolean validateQuota() { getParameters().setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getParameters().getVmStaticData() .getQuotaId(), getStoragePool())); for (DiskImage dit : getImagesToCheckDestinationStorageDomains()) { dit.setQuotaId(QuotaHelper.getInstance() .getQuotaIdToConsume(getParameters().getVmStaticData().getQuotaId(), getStoragePool())); } if (!isInternalExecution()) { return QuotaManager.validateMultiStorageQuota(getStoragePool().getQuotaEnforcementType(), QuotaHelper.getInstance().getQuotaConsumeMap(getParameters().getDiskInfoDestinationList(), getParameters().getQuotaId()), getCommandId(), getReturnValue().getCanDoActionMessages()); } return true; }

Target:
protected boolean validateQuota() { setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getQuotaId(), getStoragePool())); for (DiskImage dit : getImagesToCheckDestinationStorageDomains()) { dit.setQuotaId(QuotaHelper.getInstance().getQuotaIdToConsume(getQuotaId(), getStoragePool())); } if (!isInternalExecution()) { return QuotaManager.validateMultiStorageQuota(getStoragePool().getQuotaEnforcementType(), getQuotaConsumeMap(diskInfoDestinationMap.values()), getCommandId(), getReturnValue().getCanDoActionMessages()); } return true; }
Source:
public HttpResponse doRemoveJobFromView(@QueryParameter String name) throws IOException, ServletException { checkPermission(View.CONFIGURE); if(name==null) throw new Failure("Query parameter 'name' is required"); synchronized (this) { TopLevelItem item = resolveName(name); if (item == null) { throw new Failure("Cannot discover the item by name: '"+name+"'"); } if (remove(item)) owner.save(); } return HttpResponses.ok(); }

Target:
public HttpResponse doRemoveJobFromView(@QueryParameter String name) throws IOException, ServletException { checkPermission(View.CONFIGURE); if(name==null) throw new Failure("Query parameter 'name' is required"); synchronized (this) { TopLevelItem item = resolveName(name); if (item==null) { throw new Failure("Query parameter 'name' does not correspond to a known and readable item: " + name); } if (remove(item)) { owner.save(); } } return HttpResponses.ok(); }
Source:
public void initKeyStore(String _keyStoreFilename, String _keyStorePasswd, String _keyPassword) throws CryptoException { keyStoreFilename = _keyStoreFilename; keyStorePasswd = _keyStorePasswd; keyPassword = _keyPassword; try { keyStore = KeyStore.getInstance("JKS"); } catch (KeyStoreException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } FileInputStream inputStream = null; try { inputStream = new FileInputStream(keyStoreFilename); keyStore.load(inputStream, getKeyStorePassword()); validateKeyStore(keyStore); } catch (NoSuchAlgorithmException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } catch (CertificateException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } catch (FileNotFoundException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } catch (IOException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException e) { } } initKeyManagerFactory(); }

Target:
public void initKeyStore(String _keyStoreFilename, String _keyStorePasswd, String _keyPassword) throws CryptoException { keyStoreFilename = _keyStoreFilename; keyStorePasswd = _keyStorePasswd; keyPassword = _keyPassword; try { keyStore = KeyStore.getInstance("JKS"); } catch (KeyStoreException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } FileInputStream inputStream = null; try { inputStream = new FileInputStream(keyStoreFilename); keyStore.load(inputStream, getKeyStorePassword()); validateKeyStore(keyStore); } catch (CertificateExpiredException e) { logger.error("Invalid KeyStore Instance", e); throw new CryptoException("Invalid KeyStore Instance", e); } catch (CertificateNotYetValidException e) { logger.error("Invalid KeyStore Instance", e); throw new CryptoException("Invalid KeyStore Instance", e); } catch (KeyStoreException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } catch (NoSuchAlgorithmException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } catch (CertificateException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } catch (FileNotFoundException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } catch (IOException e) { logger.error("Cannot create KeyStore Instance", e); throw new CryptoException("Cannot create KeyStore Instance", e); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException e) { } } initKeyManagerFactory(); }
Source:
private void updateBatchSize(SweepOutcome outcome) { if (outcome == SweepOutcome.SUCCESS) { batchSizeMultiplier = Math.min(1.0, batchSizeMultiplier * 1.01); return; } if (outcome == SweepOutcome.RETRYING_WITH_SMALLER_BATCH) { SweepBatchConfig lastBatchConfig = specificTableSweeper.getAdjustedBatchConfig(); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); log.warn("The background sweep job failed unexpectedly with candidate batch size {}," + " delete batch size {}," + " and cell+timestamp pairs to examine." + " Attempting to continue with new batchSizeMultiplier {}", SafeArg.of("candidateBatchSize", lastBatchConfig.candidateBatchSize()), SafeArg.of("deleteBatchSize", lastBatchConfig.deleteBatchSize()), SafeArg.of("maxCellTsPairsToExamine", lastBatchConfig.maxCellTsPairsToExamine()), SafeArg.of("batchSizeMultiplier", batchSizeMultiplier)); return; } }

Target:
private void updateBatchSize(SweepOutcome outcome) { if (outcome == SweepOutcome.SUCCESS) { sweepBatchConfigSource.increaseMultiplier(); } if (outcome == SweepOutcome.ERROR) { sweepBatchConfigSource.decreaseMultiplier(); } }
Source:
private void add(Watchers matching, NotifyConfig nc, Project.NameKey project) throws OrmException, QueryParseException { for (GroupReference ref : nc.getGroups()) { CurrentUser user = new SingleGroupUser(args.capabilityControlFactory, ref.getUUID()); if (filterMatch(user, nc.getFilter())) { deliverToMembers(matching.list(nc.getHeader()), ref.getUUID()); } } if (!nc.getAddresses().isEmpty()) { if (filterMatch(args.anonymousUser, nc.getFilter())) { matching.list(nc.getHeader()).emails.addAll(nc.getAddresses()); } } }

Target:
private void add(Watchers matching, NotifyConfig nc, Project.NameKey project) throws OrmException, QueryParseException { for (GroupReference ref : nc.getGroups()) { CurrentUser user = new SingleGroupUser(args.capabilityControlFactory, ref.getUUID()); if (filterMatch(user, nc.getFilter())) { deliverToMembers(matching.list(nc.getHeader()), ref.getUUID()); } } if (!nc.getAddresses().isEmpty()) { if (filterMatch(null, nc.getFilter())) { matching.list(nc.getHeader()).emails.addAll(nc.getAddresses()); } } }
Source:
public List<ModifierProtocol> modifierProtocols() { return Collections.unmodifiableList( modifierProtocols ); }

Target:
public List<ModifierProtocol> modifierProtocols() { return modifierProtocols; }
Source:
private void registerPossibleObjectInnerTypes(String topLevelName, List<String> path, DataType<?> dataType) { if (DataTypes.isCollectionType(dataType)) { dataType = ((CollectionType) dataType).innerType(); } if (dataType.id() != ObjectType.ID) { return; } Map<String, DataType> innerTypes = ((ObjectType) dataType).innerTypes(); int pos = 0; for (Map.Entry<String, DataType> entry : innerTypes.entrySet()) { List<String> subPath = new ArrayList<>(path); subPath.add(entry.getKey()); ColumnIdent ci = new ColumnIdent(topLevelName, subPath); DataType innerType = entry.getValue(); Reference ref = new Reference( new ReferenceIdent(relationName, ci), rowGranularity, innerType, ColumnPolicy.STRICT, Reference.IndexType.NOT_ANALYZED, true, pos, null ); pos++; if (!infos.containsKey(ref.column())) { infos.put(ref.column(), ref); } registerPossibleObjectInnerTypes(ci.name(), ci.path(), innerType); } }

Target:
private void registerPossibleObjectInnerTypes(String topLevelName, List<String> path, DataType<?> dataType) { if (DataTypes.isCollectionType(dataType)) { dataType = ((CollectionType) dataType).innerType(); } if (dataType.id() != ObjectType.ID) { return; } Map<String, DataType> innerTypes = ((ObjectType) dataType).innerTypes(); int pos = 0; for (Map.Entry<String, DataType> entry : innerTypes.entrySet()) { List<String> subPath = new ArrayList<>(path); subPath.add(entry.getKey()); ColumnIdent ci = new ColumnIdent(topLevelName, subPath); DataType innerType = entry.getValue(); Reference ref = new Reference( new ReferenceIdent(relationName, ci), rowGranularity, innerType, ColumnPolicy.STRICT, Reference.IndexType.NOT_ANALYZED, true, pos, null ); pos++; infos.putIfAbsent(ref.column(), ref); registerPossibleObjectInnerTypes(ci.name(), ci.path(), innerType); } }
Source:
List<String> headers() { if (node.hasProperty(HEADERS) && !DYNAMIC_HEADERS.matcher(node.getPropertyValue(HEADERS)).find()) { return Arrays.asList(node.getPropertyValue(HEADERS).split("\\s+")).stream().filter(header -> !header.isEmpty()).collect(Collectors.toList()); } else { return Collections.emptyList(); } }

Target:
List<String> headers() { if (node.hasProperty(HEADERS) && !DYNAMIC_HEADERS.matcher(node.getPropertyValue(HEADERS)).find()) { return Arrays.stream(node.getPropertyValue(HEADERS).split("\\s+")).filter(header -> !header.isEmpty()).collect(Collectors.toList()); } else { return Collections.emptyList(); } }
Source:
public static List<RowMap>getRowsWithReplicator(final MysqlIsolatedServer mysql, MaxwellFilter filter, MaxwellTestSupportCallback callback) throws Exception { final ArrayList<RowMap> list = new ArrayList<>(); clearSchemaStore(mysql); MaxwellConfig config = new MaxwellConfig(); config.maxwellMysql.user = "maxwell"; config.maxwellMysql.password = "maxwell"; config.maxwellMysql.host = "localhost"; config.maxwellMysql.port = mysql.getPort(); config.replicationMysql = config.maxwellMysql; if ( filter != null ) { if ( filter.isDatabaseWhitelist() ) filter.includeDatabase("test"); if ( filter.isTableWhitelist() ) filter.includeTable("boundary"); } config.filter = filter; config.bootstrapperType = "sync"; callback.beforeReplicatorStart(mysql); config.initPosition = BinlogPosition.capture(mysql.getConnection()); BufferedMaxwell maxwell = new BufferedMaxwell(config); new Thread(maxwell).start(); mysql.execute("CREATE TABLE if not exists test.boundary ( i int )"); mysql.execute("insert into test.boundary set i = 1"); maxwell.getRow(5, TimeUnit.SECONDS); callback.afterReplicatorStart(mysql); BinlogPosition finalPosition = BinlogPosition.capture(mysql.getConnection()); mysql.execute("insert into test.boundary set i = 1"); for ( int nullChecksLeft = 100 ; nullChecksLeft > 0 ; nullChecksLeft-- ) { RowMap row = maxwell.getRow(10, TimeUnit.MILLISECONDS); if ( row == null ) continue; if ( row.getPosition().newerThan(finalPosition) ) nullChecksLeft = 2; if ( !row.getTable().equals("boundary")) list.add(row); } callback.beforeTerminate(mysql); maxwell.terminate(); return list; }

Target:
public static List<RowMap>getRowsWithReplicator(final MysqlIsolatedServer mysql, MaxwellFilter filter, MaxwellTestSupportCallback callback) throws Exception { final ArrayList<RowMap> list = new ArrayList<>(); clearSchemaStore(mysql); MaxwellConfig config = new MaxwellConfig(); config.maxwellMysql.user = "maxwell"; config.maxwellMysql.password = "maxwell"; config.maxwellMysql.host = "localhost"; config.maxwellMysql.port = mysql.getPort(); config.replicationMysql = config.maxwellMysql; if ( filter != null ) { if ( filter.isDatabaseWhitelist() ) filter.includeDatabase("test"); if ( filter.isTableWhitelist() ) filter.includeTable("boundary"); } config.filter = filter; config.bootstrapperType = "sync"; callback.beforeReplicatorStart(mysql); config.initPosition = BinlogPosition.capture(mysql.getConnection()); BufferedMaxwell maxwell = new BufferedMaxwell(config); new Thread(maxwell).start(); mysql.execute("CREATE TABLE if not exists test.boundary ( i int )"); mysql.execute("insert into test.boundary set i = 1"); maxwell.poll(5000); callback.afterReplicatorStart(mysql); BinlogPosition finalPosition = BinlogPosition.capture(mysql.getConnection()); mysql.execute("insert into test.boundary set i = 1"); for ( int nullChecksLeft = 100 ; nullChecksLeft > 0 ; nullChecksLeft-- ) { RowMap row = maxwell.poll(10); if ( row == null ) continue; if ( row.getPosition().newerThan(finalPosition) ) nullChecksLeft = 2; if ( !row.getTable().equals("boundary")) list.add(row); } callback.beforeTerminate(mysql); maxwell.terminate(); return list; }
Source:
private void initialize() { this.setLayout(new CardLayout()); this.setName("Callbacks"); this.setIcon(new ImageIcon(CallbackPanel.class.getResource("/resource/icon/16/callbacks.png"))); this.add(getMainPanel(), getMainPanel().getName()); }

Target:
private void initialize() { this.setLayout(new CardLayout()); this.setName(Constant.messages.getString("callback.panel.name")); this.setIcon(new ImageIcon(CallbackPanel.class.getResource("/resource/icon/16/callbacks.png"))); this.add(getMainPanel(), getMainPanel().getName()); }
Source:
private void usingIsEmpty2() { Optional<Object> op = Optional.emtpy(); if (op.isEmpty()) { } else { op.get(); } }

Target:
private void usingIsEmpty2() { Optional<Object> op = Optional.empty(); if (op.isEmpty()) { } else { op.get(); } }
Source:
public MediaType getMediaType(ObjectNode contentNode, String location, ParseResult result){ if (contentNode == null) { return null; } MediaType mediaType = new MediaType(); ObjectNode schemaObject = getObject("schema",contentNode,false,location,result); if(schemaObject!=null){ mediaType.setSchema(getSchema(schemaObject,location,result)); } String value = getString("example", contentNode, false, location, result); mediaType.setExample(value); ObjectNode examplesObject = getObject("examples",contentNode,false,location,result); if(examplesObject!=null) { mediaType.setExamples(getExamples(examplesObject, location, result)); } ObjectNode encodingObject = getObject("encoding",contentNode,false,location,result); if(encodingObject!=null) { mediaType.setEncoding(getEncoding(encodingObject, location, result)); } mediaType.setExtensions(new LinkedHashMap<>()); Set<String> keys = getKeys(contentNode); for (String key : keys) { if (key.startsWith("x-")) { mediaType.getExtensions().put(key, Json.mapper().convertValue(contentNode.get(key), Object.class)); } } return mediaType; }

Target:
public MediaType getMediaType(ObjectNode contentNode, String location, ParseResult result){ if (contentNode == null) { return null; } MediaType mediaType = new MediaType(); ObjectNode schemaObject = getObject("schema",contentNode,false,location,result); if(schemaObject!=null){ mediaType.setSchema(getSchema(schemaObject,location,result)); } String value = getString("example", contentNode, false, location, result); if(StringUtils.isNotBlank(value)) { mediaType.setExample(value); } ObjectNode examplesObject = getObject("examples",contentNode,false,location,result); if(examplesObject!=null) { mediaType.setExamples(getExamples(examplesObject, location, result)); } ObjectNode encodingObject = getObject("encoding",contentNode,false,location,result); if(encodingObject!=null) { mediaType.setEncoding(getEncoding(encodingObject, location, result)); } Map <String,Object> extensions = getExtensions(contentNode,location,result); if(extensions != null && extensions.size() > 0) { mediaType.setExtensions(extensions); } return mediaType; }
Source:
public Optional<IndexNullAsExpectactions<String>> getIndexNullAsExpectations() { return Optional.empty(); }

Target:
public Optional<IndexNullAsExpectactions<String>> getIndexNullAsExpectations() { return Optional.of( new IndexNullAsExpectactions<>( "", "Aaron" ) ); }
Source:
public Integer getMaxVmNameLength() { Integer maxVmNameLengthNonWindows = (Integer) getConfigValuePreConverted(ConfigurationValues.MaxVmNameLength); if (maxVmNameLengthNonWindows == null) { return 64; } return maxVmNameLengthNonWindows; }

Target:
public Integer getMaxVmNameLength() { Integer maxVmNameLength = (Integer) getConfigValuePreConverted(ConfigurationValues.MaxVmNameLength); if (maxVmNameLength == null) { return 64; } return maxVmNameLength; }
Source:
public void WikiActivityTests_005_newEditionWoVisualChangeNotRecordedOnActivityModule() { String articleTitle = "newEditionWoVisualChangeNotRecordedOnActivityModule"; new ArticleContent().push("content", articleTitle); ArticlePageObject article = new ArticlePageObject().open(articleTitle); String articleName = article.getArticleName(); String articleContent = article.getContent(); VisualEditModePageObject visualEditMode = article.navigateToArticleEditPage(); visualEditMode.addContent(articleContent); visualEditMode.submitArticle(); article.verifyContent(articleContent); new SpecialWikiActivityPageObject(driver) .open() .verifyNoRecentEditionIsPresent(articleName, credentials.userName); }

Target:
public void WikiActivityTests_005_newEditionWoVisualChangeNotRecordedOnActivityModule() { new ArticleContent().push("content"); ArticlePageObject article = new ArticlePageObject().open(); String articleName = article.getArticleName(); String articleContent = article.getContent(); VisualEditModePageObject visualEditMode = article.navigateToArticleEditPage(); visualEditMode.addContent(articleContent); visualEditMode.submitArticle(); Assertion.assertFalse( new SpecialWikiActivityPageObject(driver) .open().doesLastNRecentEditionsContain(2, articleName, User.USER.getUserName()) ); }
Source:
private static void closeHttpClientGracefully(CloseableHttpClient client) { if(client != null) { try { client.close(); } catch (IOException exception) { } } }

Target:
private static void closeHttpClientGracefully(CloseableHttpClient client) { if (client == null) return; try { client.close(); } catch (IOException exception) { } }
Source:
protected NodeFigure createNodePlate() { RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(72, 250) { @Override public IFigure findMouseEventTargetAt(int x, int y) { IFigure f = findMouseEventTargetInDescendantsAt(x, y); if (f != null) { return f; } if (!containsPoint(x, y)) { return null; } if (isMouseEventTarget()) { return this; } return null; } @Override public IFigure findFigureAt(int x, int y, TreeSearch search) { if (search.prune(this)) { return null; } IFigure child = findDescendantAtExcluding(x, y, search); if (child != null) { return child; } if (!containsPoint(x, y)) { return null; } if (search.accept(this)) { return this; } return null; } @Override public boolean containsPoint(int x, int y) { if (primaryShape != null) { return primaryShape.containsPoint(x, y); } return super.containsPoint(x, y); } @Override protected boolean isDefaultAnchorArea(PrecisionPoint p) { return false; } }; return result; }

Target:
protected NodeFigure createNodePlate() { RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(100, 250) { @Override public IFigure findMouseEventTargetAt(int x, int y) { IFigure f = findMouseEventTargetInDescendantsAt(x, y); if (f != null) { return f; } if (!containsPoint(x, y)) { return null; } if (isMouseEventTarget()) { return this; } return null; } @Override public IFigure findFigureAt(int x, int y, TreeSearch search) { if (search.prune(this)) { return null; } IFigure child = findDescendantAtExcluding(x, y, search); if (child != null) { return child; } if (!containsPoint(x, y)) { return null; } if (search.accept(this)) { return this; } return null; } @Override public boolean containsPoint(int x, int y) { if (primaryShape != null) { return primaryShape.containsPoint(x, y); } return super.containsPoint(x, y); } @Override protected boolean isDefaultAnchorArea(PrecisionPoint p) { return false; } }; return result; }
Source:
public InMemoryObservationStore(NetworkConfig config) { int healthStatusInterval = config.getInt(NetworkConfig.Keys.HEALTH_STATUS_INTERVAL, 0); if (healthStatusInterval > 0 && HEALTH_LOGGER.isDebugEnabled()) { ScheduledExecutorService scheduler = Executors .newSingleThreadScheduledExecutor(new DaemonThreadFactory("ObservationStore")); scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { if (enableStatus) { HEALTH_LOGGER.debug("{} observes", map.size()); Iterator<Token> iterator = map.keySet().iterator(); int max = 5; while (iterator.hasNext()) { HEALTH_LOGGER.debug(" observe {}", iterator.next()); --max; if (max == 0) { break; } } } } }, healthStatusInterval, healthStatusInterval, TimeUnit.SECONDS); } }

Target:
public InMemoryObservationStore(NetworkConfig config) { this.config = config; }