auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean readFrame(ByteBuffer src, boolean trusted) { int remaining = src.remaining(); if (remaining < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { return false; } if (readOffset == -1) { int frameLength = Bits.readIntL(src, src.position()); if (!trusted) { if (frameLength > maxFrameLength) { throw new IllegalArgumentException( format("The client message frame size (%d) exceededs the maximum allowed frame length (%d)", frameLength, maxFrameLength)); } if (frames.size() + 1 > maxFrameCount) { throw new IllegalArgumentException( format("The client message frames count exceededs the maximum allowed count (%d)", maxFrameCount)); } } if (frameLength < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { throw new IllegalArgumentException(format( "The client message frame reported illegal length (%d bytes)." + " Minimal length is the size of frame header (%d bytes).", frameLength, SIZE_OF_FRAME_LENGTH_AND_FLAGS)); } src.position(src.position() + Bits.INT_SIZE_IN_BYTES); int flags = Bits.readShortL(src, src.position()) & INT_MASK; src.position(src.position() + Bits.SHORT_SIZE_IN_BYTES); int size = frameLength - SIZE_OF_FRAME_LENGTH_AND_FLAGS; byte[] bytes = new byte[size]; frames.add(new ClientMessage.Frame(bytes, flags)); readOffset = 0; if (size == 0) { return true; } } ClientMessage.Frame frame = frames.get(readIndex); return accumulate(src, frame.content, frame.content.length - readOffset); }

Target:
private boolean readFrame(ByteBuffer src, boolean trusted) { int remaining = src.remaining(); if (remaining < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { return false; } if (readOffset == -1) { int frameLength = Bits.readIntL(src, src.position()); if (frameLength < SIZE_OF_FRAME_LENGTH_AND_FLAGS) { throw new IllegalArgumentException(format( "The client message frame reported illegal length (%d bytes)." + " Minimal length is the size of frame header (%d bytes).", frameLength, SIZE_OF_FRAME_LENGTH_AND_FLAGS)); } if (!trusted) { if (Integer.MAX_VALUE - frameLength < sumUntrustedMessageLength || sumUntrustedMessageLength + frameLength > maxMessageLength) { throw new MaxMessageSizeExceeded( format("The client message size (%d + %d) exceededs the maximum allowed length (%d)", sumUntrustedMessageLength, frameLength, maxMessageLength)); } sumUntrustedMessageLength += frameLength; } src.position(src.position() + Bits.INT_SIZE_IN_BYTES); int flags = Bits.readShortL(src, src.position()) & INT_MASK; src.position(src.position() + Bits.SHORT_SIZE_IN_BYTES); int size = frameLength - SIZE_OF_FRAME_LENGTH_AND_FLAGS; byte[] bytes = new byte[size]; frames.add(new ClientMessage.Frame(bytes, flags)); readOffset = 0; if (size == 0) { return true; } } ClientMessage.Frame frame = frames.get(readIndex); return accumulate(src, frame.content, frame.content.length - readOffset); }
Source:
public PlanNode replaceChildren(List<PlanNode> newChildren) { checkArgument(newChildren.size() == 2, "expected newChildren to contain 2 nodes"); PlanNode newLeft = newChildren.get(0); PlanNode newRight = newChildren.get(1); return new SpatialJoinNode(getId(), type, newLeft, newRight, outputSymbols, filter); }

Target:
public PlanNode replaceChildren(List<PlanNode> newChildren) { checkArgument(newChildren.size() == 2, "expected newChildren to contain 2 nodes"); return new SpatialJoinNode(getId(), type, newChildren.get(0), newChildren.get(1), outputSymbols, filter); }
Source:
private CTabFolder createTabFolder(Composite parent) { final CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); ColorRegistry reg = JFaceResources.getColorRegistry(); Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); folder.setSelectionBackground(new Color[] {c1, c2}, new int[] {100}, true); folder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); folder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); folder.setBorderVisible(true); folder.addCTabFolder2Listener(new CTabFolder2Adapter() { @Override public void close(CTabFolderEvent event) { event.doit = true; CTabItem item = (CTabItem) event.item; disposeTab(item); try { saveMemento(folder); } catch (CoreException e) { MemoryBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID, "Could not get memory tabs memento", e)); } } }); folder.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { for(CTabItem tab : folder.getItems()) { disposeTab(tab); } folder.removeDisposeListener(this); fMemento = null; } }); return folder; }

Target:
private CTabFolder createTabFolder(Composite parent) { final CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT); ColorRegistry reg = JFaceResources.getColorRegistry(); Color c1 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_START"), c2 = reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END"); folder.setSelectionBackground(new Color[] {c1, c2}, new int[] {100}, true); folder.setSelectionForeground(reg.get("org.eclipse.ui.workbench.ACTIVE_TAB_TEXT_COLOR")); folder.setSimple(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS)); folder.setBorderVisible(true); folder.addCTabFolder2Listener(new CTabFolder2Adapter() { @Override public void close(CTabFolderEvent event) { event.doit = true; CTabItem item = (CTabItem) event.item; disposeTab(item); try { saveMemento(folder); } catch (CoreException e) { MemoryBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID, "Could not save memory tabs memento", e)); } } }); folder.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { for(CTabItem tab : folder.getItems()) { disposeTab(tab); } folder.removeDisposeListener(this); } }); return folder; }
Source:
public void testPeek() throws Exception { SingleItemPeekableItemReader<String> reader = new SingleItemPeekableItemReaderBuilder<String>() .setDelegate( new SingleItemPeekableItemReaderTests.CountingListItemReader<String>(Arrays.asList("a", "b"))) .build(); reader.setDelegate( new SingleItemPeekableItemReaderTests.CountingListItemReader<String>(Arrays.asList("a", "b"))); assertEquals("a", reader.peek()); assertEquals("a", reader.read()); assertEquals("b", reader.read()); assertEquals(null, reader.peek()); assertEquals(null, reader.read()); }

Target:
public void testPeek() throws Exception { SingleItemPeekableItemReader<String> reader = new SingleItemPeekableItemReaderBuilder<String>() .delegate( new ListItemReader<String>(Arrays.asList("a", "b"))) .build(); assertEquals("a", reader.peek()); assertEquals("a", reader.read()); assertEquals("b", reader.read()); assertEquals(null, reader.peek()); assertEquals(null, reader.read()); }
Source:
public void onPluginDirectorySearched(OnPluginDirectorySearched event) throws InterruptedException { if (isFinishing()) return; showProgress(false); PluginListFragment fragment = getListFragment(); if (fragment == null || fragment.getListType() != PluginListType.SEARCH || !StringUtils.equals(mSearchQuery, event.searchTerm)) { return; } if (event.isError()) { AppLog.e(AppLog.T.PLUGINS, "An error occurred while searching the plugin directory"); ToastUtils.showToast(this, R.string.plugin_search_error); } else { mSearchResults.clear(); mSearchResults.addAll(event.plugins); fragment.showEmptyView(mSearchResults.isEmpty() && !TextUtils.isEmpty(mSearchQuery)); refreshListFragment(); } }

Target:
public void onPluginDirectorySearched(OnPluginDirectorySearched event) throws InterruptedException { if (isFinishing()) return; showProgress(false); PluginListFragment fragment = getListFragment(); if (fragment == null || fragment.getListType() != PluginListType.SEARCH || !StringUtils.equals(mSearchQuery, event.searchTerm)) { return; } if (event.isError()) { AppLog.e(AppLog.T.PLUGINS, "An error occurred while searching the plugin directory"); ToastUtils.showToast(this, R.string.plugin_search_error); } else { mSearchResults.clear(); mSearchResults.addAll(event.plugins); fragment.showEmptyView(mSearchResults.isEmpty() && !TextUtils.isEmpty(mSearchQuery)); reloadListFragment(); } }
Source:
public SchedulerDriver createMesosSchedulerDriver( MesosConfiguration mesosConfig, Scheduler scheduler, boolean implicitAcknowledgements) { MesosSchedulerDriver schedulerDriver; if (mesosConfig.credential().isDefined()) { schedulerDriver = new MesosSchedulerDriver(scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements, mesosConfig.credential().get().build()); } else { schedulerDriver = new MesosSchedulerDriver(scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements); } return schedulerDriver; }

Target:
public SchedulerDriver createMesosSchedulerDriver( MesosConfiguration mesosConfig, Scheduler scheduler, boolean implicitAcknowledgements) { if (mesosConfig.credential().isDefined()) { return new MesosSchedulerDriver( scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements, mesosConfig.credential().get().build()); } else { return new MesosSchedulerDriver( scheduler, mesosConfig.frameworkInfo().build(), mesosConfig.masterUrl(), implicitAcknowledgements); } }
Source:
public static DiffEntry getChangeDiffEntry(Repository repository, String newPath, RevCommit newCommit, RevCommit oldCommit, ObjectReader objectReader) throws IOException { TreeWalk walk = new TreeWalk(objectReader); walk.setRecursive(true); walk.addTree(oldCommit.getTree()); walk.addTree(newCommit.getTree()); List<DiffEntry> entries = DiffEntry.scan(walk); for (DiffEntry diff : entries) if (diff.getChangeType() == ChangeType.MODIFY && newPath.equals(diff.getNewPath())) return diff; if (entries.size() < 2) return null; RenameDetector detector = new RenameDetector(repository); detector.addAll(entries); List<DiffEntry> renames = detector.compute(walk.getObjectReader(), NullProgressMonitor.INSTANCE); for (DiffEntry diff : renames) if (diff.getChangeType() == ChangeType.RENAME && newPath.equals(diff.getNewPath())) return diff; return null; }

Target:
public static DiffEntry getChangeDiffEntry(Repository repository, String newPath, RevCommit newCommit, RevCommit oldCommit, ObjectReader objectReader) throws IOException { TreeWalk walk = new TreeWalk(objectReader); walk.setRecursive(true); walk.addTree(oldCommit.getTree()); walk.addTree(newCommit.getTree()); List<DiffEntry> entries = DiffEntry.scan(walk); for (DiffEntry diff : entries) { if (diff.getChangeType() == ChangeType.MODIFY && newPath.equals(diff.getNewPath())) return diff; } if (entries.size() < 2) return null; RenameDetector detector = new RenameDetector(repository); detector.addAll(entries); List<DiffEntry> renames = detector.compute(walk.getObjectReader(), NullProgressMonitor.INSTANCE); for (DiffEntry diff : renames) { if (diff.getChangeType() == ChangeType.RENAME && newPath.equals(diff.getNewPath())) return diff; } return null; }
Source:
private String[] resolveQueues(String... queues) { String[] result = new String[queues.length]; for (int i = 0; i < queues.length; i++) { Object resolvedValue = resolveExpression(queues[i]); if (resolvedValue instanceof Queue) { result[i] = ((Queue) resolvedValue).getName(); } else { result[i] = (String) resolvedValue; } } return result; }

Target:
private String[] resolveQueues(String... queues) { String[] result = new String[queues.length]; for (int i = 0; i < queues.length; i++) { Object resolvedValue = resolveExpression(queues[i]); if (resolvedValue instanceof Queue) { result[i] = ((Queue) resolvedValue).getName(); } else if (resolvedValue instanceof String) { result[i] = (String) resolvedValue; } else { throw new IllegalArgumentException(String.format( "@RabbitListener can't resolve '%s' as either a String or a Queue", resolvedValue)); } } return result; }
Source:
static String maskCredentialsInUrl(String originalUrl) throws IOException { Pattern pattern = Pattern.compile(CREDENTIALS_IN_URL_REGEXP); Matcher matcher = pattern.matcher(originalUrl); if (!matcher.find()) { return originalUrl; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" if (split.length < 2) { throw new IOException("Failed to parse .git config"); } return StringUtils.replace(originalUrl, credentialsPart, split[0] + " }

Target:
static String maskCredentialsInUrl(String originalUrl) throws IOException { Matcher matcher = CredentialsInUrlRegexpPattern.matcher(originalUrl); if (!matcher.find()) { return originalUrl; } String credentialsPart = matcher.group(); String[] split = credentialsPart.split(" if (split.length < 2) { throw new IOException("Failed to parse .git config"); } return StringUtils.replace(originalUrl, credentialsPart, split[0] + " }
Source:
public boolean accept(final Neo4jPersistentProperty property) { return property.isSerializablePropertyField(genericConversionService); }

Target:
public boolean accept(final Neo4jPersistentProperty property) { return property.getType() == Object.class && !property.isTransient(); }
Source:
public boolean deleteIdentifier() { boolean result = false; if (selectedIdentifier != null) { if (CollectionUtils.isNotEmpty(getIdentifiers()) && getIdentifiers().size() > 1) { result = wsService.deleteIdentifier(selectedIdentifier); if (result) { withPatient.getIdentifierList().remove(selectedIdentifier); } selectedIdentifier = null; } else { addPatientErrorMessages("Patient-identifier cannot be empty: fail to delete the last record"); } } else { addPatientErrorMessages(msgForSelectDelete(IDENTIFIER)); } return result; }

Target:
public boolean deleteIdentifier() { boolean result = false; if (selectedIdentifier != null) { if (CollectionUtils.isNotEmpty(getIdentifiers()) && getIdentifiers().size() > 1) { result = wsService.deleteIdentifier(selectedIdentifier); if (result) { refreshPatient(); } selectedIdentifier = null; } else { addPatientErrorMessages("Last identifier cannot be deleted."); } } else { addPatientErrorMessages(msgForSelectDelete(IDENTIFIER)); } return result; }
Source:
public static LfsPointer parseLfsPointer(InputStream in) throws IOException { boolean versionLine = false; LongObjectId id = null; long si = -1; try (BufferedReader br = new BufferedReader( new InputStreamReader(in))) { for (String s = br.readLine(); s != null; s = br.readLine()) { if (s.startsWith("#") || s.length() == 0) { continue; } else if (s.startsWith("version") && s.length() > 8 && s.substring(8).trim().equals(VERSION)) { versionLine = true; } else if (s.startsWith("oid sha256:")) { id = LongObjectId.fromString(s.substring(11).trim()); } else if (s.startsWith("size") && s.length() > 5) { si = Long.parseLong(s.substring(5).trim()); } else { return null; } } if (versionLine && id != null && si > -1) { return new LfsPointer(id, si); } } return null; }

Target:
public static LfsPointer parseLfsPointer(InputStream in) throws IOException { boolean versionLine = false; LongObjectId id = null; long sz = -1; try (BufferedReader br = new BufferedReader( new InputStreamReader(in))) { for (String s = br.readLine(); s != null; s = br.readLine()) { if (s.startsWith("#") || s.length() == 0) { continue; } else if (s.startsWith("version") && s.length() > 8 && s.substring(8).trim().equals(VERSION)) { versionLine = true; } else if (s.startsWith("oid sha256:")) { id = LongObjectId.fromString(s.substring(11).trim()); } else if (s.startsWith("size") && s.length() > 5) { sz = Long.parseLong(s.substring(5).trim()); } else { return null; } } if (versionLine && id != null && sz > -1) { return new LfsPointer(id, sz); } } return null; }
Source:
private static JavaArchive createJar(final String archiveName, final String securityDomainName) { final JavaArchive jar = ShrinkWrap .create(JavaArchive.class, archiveName) .addClasses(HelloBean.class, Hello.class, CustomXACMLAuthorizationModule.class, Util.class) .addAsResource(new StringAsset("jduke=theduke\nJohnDoe=jdoe"), "users.properties") .addAsResource(new StringAsset("jduke=TestRole,TestRole2\nJohnDoe=TestRole"), "roles.properties") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jbossxacml-config.xml", "jbossxacml-config.xml") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES + "/ejb-xacml-policy.xml", "xacml-policy.xml") .addAsManifestResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jboss-ejb3.xml", "jboss-ejb3.xml") .addAsResource(createPermissionsXmlAsset( new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader"), new ElytronPermission("getSecurityDomain"), new ReflectPermission("suppressAccessChecks") ), "META-INF/permissions.xml"); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); jar.addClasses(AbstractSecurityDomainsServerSetupTask.class); return jar; }

Target:
private static JavaArchive createJar(final String archiveName, final String securityDomainName) { final JavaArchive jar = ShrinkWrap .create(JavaArchive.class, archiveName) .addClasses(HelloBean.class, Hello.class, CustomXACMLAuthorizationModule.class, Util.class) .addAsResource(new StringAsset("jduke=theduke\nJohnDoe=jdoe"), "users.properties") .addAsResource(new StringAsset("jduke=TestRole,TestRole2\nJohnDoe=TestRole"), "roles.properties") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jbossxacml-config.xml", "jbossxacml-config.xml") .addAsResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_POLICIES + "/ejb-xacml-policy.xml", "xacml-policy.xml") .addAsManifestResource(EjbXACMLAuthorizationModuleTestCase.class.getPackage(), XACMLTestUtils.TESTOBJECTS_CONFIG + "/jboss-ejb3.xml", "jboss-ejb3.xml") .addAsResource(createPermissionsXmlAsset( new ElytronPermission("getSecurityDomain") ), "META-INF/permissions.xml"); XACMLTestUtils.addJBossDeploymentStructureToArchive(jar); jar.addClasses(AbstractSecurityDomainsServerSetupTask.class); return jar; }
Source:
public boolean equals(Object xmlAccountingLineObject) { if (xmlAccountingLineObject instanceof AccountingXmlDocumentAccountingLine) { AccountingXmlDocumentAccountingLine xmlAccountingLine = (AccountingXmlDocumentAccountingLine) xmlAccountingLineObject; return StringUtils.equals(this.chartCode, xmlAccountingLine.getChartCode()) && StringUtils.equals(this.accountNumber, xmlAccountingLine.getAccountNumber()) && StringUtils.equals(this.subAccountNumber, xmlAccountingLine.getSubAccountNumber()) && StringUtils.equals(this.objectCode, xmlAccountingLine.getObjectCode()) && StringUtils.equals(this.subObjectCode, xmlAccountingLine.getSubObjectCode()) && StringUtils.equals(this.projectCode, xmlAccountingLine.getProjectCode()) && StringUtils.equals(this.orgRefId, xmlAccountingLine.getOrgRefId()) && StringUtils.equals(this.lineDescription, xmlAccountingLine.getLineDescription()) && CuKualiDecimalUtils.equals(this.amount, xmlAccountingLine.getAmount()); } return false; }

Target:
public boolean equals(Object xmlAccountingLineObject) { if (xmlAccountingLineObject instanceof AccountingXmlDocumentAccountingLine) { AccountingXmlDocumentAccountingLine xmlAccountingLine = (AccountingXmlDocumentAccountingLine) xmlAccountingLineObject; return StringUtils.equals(this.chartCode, xmlAccountingLine.getChartCode()) && StringUtils.equals(this.accountNumber, xmlAccountingLine.getAccountNumber()) && StringUtils.equals(this.subAccountNumber, xmlAccountingLine.getSubAccountNumber()) && StringUtils.equals(this.objectCode, xmlAccountingLine.getObjectCode()) && StringUtils.equals(this.subObjectCode, xmlAccountingLine.getSubObjectCode()) && StringUtils.equals(this.projectCode, xmlAccountingLine.getProjectCode()) && StringUtils.equals(this.orgRefId, xmlAccountingLine.getOrgRefId()) && StringUtils.equals(this.lineDescription, xmlAccountingLine.getLineDescription()) && ObjectUtils.equals(this.amount, xmlAccountingLine.getAmount()); } return false; }
Source:
private File selectImportFile() { JFileChooser chooser = new JFileChooser(Constant.getContextsDir()); File file = null; int rc = chooser.showOpenDialog(View.getSingleton().getMainFrame()); if (rc == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); if (file == null || !file.exists()) { return null; } return file; } return null; }

Target:
private File selectImportFile() { JFileChooser chooser = new JFileChooser(); int rc = chooser.showOpenDialog(this.owner); if (rc == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (file == null || !file.exists()) { return null; } return file; } return null; }
Source:
private InterpreterResult appendSessionExpire(InterpreterResult result, boolean sessionExpired) { if (sessionExpired) { InterpreterResult result2 = new InterpreterResult(result.code()); result2.add(InterpreterResult.Type.HTML, "<font color=\"red\">Previous session is expired, new session is created. " + "Paragraphes that depend on this paragraph need to be re-executed !" + "</font>"); for (InterpreterResultMessage message : result.message()) { result2.add(message.getType(), message.getData()); } return result2; } else { return result; } }

Target:
private InterpreterResult appendSessionExpire(InterpreterResult result, boolean sessionExpired) { if (sessionExpired) { InterpreterResult result2 = new InterpreterResult(result.code()); result2.add(InterpreterResult.Type.HTML, "<font color=\"red\">Previous livy session is expired, new livy session is created. " + "Paragraphs that depend on this paragraph need to be re-executed!" + "</font>"); for (InterpreterResultMessage message : result.message()) { result2.add(message.getType(), message.getData()); } return result2; } else { return result; } }
Source:
public String getUrl() { return null; }

Target:
public String getUrl() { throw new UnsupportedOperationException(); }
Source:
public boolean matchStage(StageConfigIdentifier stageIdentifier, StageEvent event) { boolean anyPipelineAndStage = this.pipelineName.equals(GoConstants.ANY_PIPELINE) && this.stageName.equals(GoConstants.ANY_STAGE); if(anyPipelineAndStage && this.event.include(event)) { return true; } else { return stageIdentifier.getPipelineName().equals(pipelineName) && (stageIdentifier.getStageName().equals(stageName) || stageName.equals(GoConstants.ANY_STAGE)) && this.event.include(event); } }

Target:
public boolean matchStage(StageConfigIdentifier stageIdentifier, StageEvent event) { boolean anyPipelineAndStage = this.pipelineName.equals(GoConstants.ANY_PIPELINE) && this.stageName.equals(GoConstants.ANY_STAGE); if (anyPipelineAndStage && this.event.include(event)) { return true; } return stageIdentifier.getPipelineName().equals(pipelineName) && (stageIdentifier.getStageName().equals(stageName) || stageName.equals(GoConstants.ANY_STAGE)) && this.event.include(event); }
Source:
public boolean isReading() { return reading == true || (!writing && isSimpleSourceType()); }

Target:
public boolean isReading() { return reading || (!writing && isSimpleSourceType()); }
Source:
public void setTotalDiskSize(Integer value) { value = (value == null) ? new Integer(0) : value; if (!totalDiskSize.equals(value)) { totalDiskSize = value; } }

Target:
public void setTotalDiskSize(Integer value) { value = (value == null) ? Integer.valueOf(0) : value; if (!totalDiskSize.equals(value)) { totalDiskSize = value; } }
Source:
public void post_commands_in_bulk() { final Command first = newCommand(); final Command second = newCommand(); final List<Command> commands = newArrayList(first, second); commandBus.unregister(createProjectHandler); commandBus.register(createProjectHandler); final CommandBus spy = spy(commandBus); spy.post(commands, StreamObservers.<Response>noOpObserver()); final ArgumentCaptor<Command> storingCaptor = forClass(Command.class); verify(spy, times(2)).store(storingCaptor.capture()); final List<Command> storingArgs = storingCaptor.getAllValues(); assertSize(commands.size(), storingArgs); assertContainsAll(storingArgs, first, second); final ArgumentCaptor<CommandEnvelope> postingCaptor = forClass(CommandEnvelope.class); verify(spy, times(2)).doPost(postingCaptor.capture()); final List<CommandEnvelope> postingArgs = postingCaptor.getAllValues(); assertSize(commands.size(), postingArgs); assertEquals(commands.get(0), postingArgs.get(0).getCommand()); assertEquals(commands.get(1), postingArgs.get(1).getCommand()); commandBus.unregister(createProjectHandler); }

Target:
public void post_commands_in_bulk() { final Command first = newCommand(); final Command second = newCommand(); final List<Command> commands = newArrayList(first, second); commandBus.unregister(createProjectHandler); commandBus.register(createProjectHandler); final CommandBus spy = spy(commandBus); spy.post(commands, StreamObservers.<IsSent>memoizingObserver()); @SuppressWarnings("unchecked") final ArgumentCaptor<Iterable<Command>> storingCaptor = forClass(Iterable.class); verify(spy).store(storingCaptor.capture()); final Iterable<Command> storingArgs = storingCaptor.getValue(); assertSize(commands.size(), storingArgs); assertContainsAll(storingArgs, first, second); final ArgumentCaptor<CommandEnvelope> postingCaptor = forClass(CommandEnvelope.class); verify(spy, times(2)).doPost(postingCaptor.capture()); final List<CommandEnvelope> postingArgs = postingCaptor.getAllValues(); assertSize(commands.size(), postingArgs); assertEquals(commands.get(0), postingArgs.get(0).getCommand()); assertEquals(commands.get(1), postingArgs.get(1).getCommand()); commandBus.unregister(createProjectHandler); }
Source:
private <ID extends Serializable> ResponseEntity<ResourceSupport> uploadInternal(HttpServletRequest request, String apiCategory, String model, ID id, MultipartFile uploadfile) { checkModelPluralForm(apiCategory, model); DSpaceRestRepository<RestAddressableModel, ID> repository = utils.getResourceRepository(apiCategory, model); RestAddressableModel modelObject = null; try { modelObject = repository.upload(request, apiCategory, model, id, uploadfile); } catch (SQLException | IOException e) { throw new RuntimeException(e.getMessage(), e); } catch ( AuthorizeException ae) { throw new RESTAuthorizationException(ae); } DSpaceResource result = converter.toResource(modelObject); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, new HttpHeaders(), result); }

Target:
private <ID extends Serializable> ResponseEntity<ResourceSupport> uploadInternal(HttpServletRequest request, String apiCategory, String model, ID id, MultipartFile uploadfile) { checkModelPluralForm(apiCategory, model); DSpaceRestRepository<RestAddressableModel, ID> repository = utils.getResourceRepository(apiCategory, model); RestAddressableModel modelObject = null; try { modelObject = repository.upload(request, apiCategory, model, id, uploadfile); } catch (SQLException | IOException e) { throw new RuntimeException("Error " + e.getMessage() + " uploading file to " + model + " with ID= " + id, e); } catch ( AuthorizeException ae) { throw new RESTAuthorizationException(ae); } DSpaceResource result = converter.toResource(modelObject); return ControllerUtils.toResponseEntity(HttpStatus.CREATED, new HttpHeaders(), result); }
Source:
boolean verify(char[] guess) throws InvalidKeyException { ByteBuffer guessAsBuffer = StandardCharsets.UTF_8.encode(CharBuffer.wrap(guess)); byte[] guessAsBytes = new byte[guessAsBuffer.remaining()]; guessAsBuffer.get(guessAsBytes); byte[] output = bcrypt(this.iterationCount, this.getSalt(), guessAsBytes); return Arrays.equals(this.hash, output); }

Target:
boolean verify(char[] guess) throws InvalidKeyException { byte[] output = bcrypt(this.iterationCount, this.getSalt(), getNormalizedPasswordBytes(guess)); return Arrays.equals(this.hash, output); }
Source:
@Test public void findByByIosClassChainTest() { assertNotEquals(driver .findElementByIosClassChain("XCUIElementTypeWindow XCUIElementTypeButton") .size(), 0); }

Target:
@Test public void findByByIosClassChainTest() { assertNotEquals(driver .findElementByIosClassChain("**/XCUIElementTypeButton") .getText(), null); assertNotEquals(driver .findElementsByIosClassChain("**/XCUIElementTypeButton") .size(), 0); }
Source:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { final boolean debug = this.logger.isDebugEnabled(); String token; try { token = this.bearerTokenResolver.resolve(request); } catch ( OAuth2AuthenticationException invalid ) { this.authenticationEntryPoint.commence(request, response, invalid); return; } catch ( Exception unexpected ) { this.logger.error("An unexpected error occured when trying to parse the request for the bearer token." + " Will let one of the other filters try.", unexpected); filterChain.doFilter(request, response); return; } if (token == null) { filterChain.doFilter(request, response); return; } BearerTokenAuthenticationToken authenticationRequest = new BearerTokenAuthenticationToken(token); authenticationRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); try { Authentication authenticationResult = this.authenticationManager.authenticate(authenticationRequest); SecurityContext context = SecurityContextHolder.createEmptyContext(); context.setAuthentication(authenticationResult); SecurityContextHolder.setContext(context); filterChain.doFilter(request, response); } catch (AuthenticationException failed) { SecurityContextHolder.clearContext(); if (debug) { this.logger.debug("Authentication request for failed: " + failed); } this.authenticationEntryPoint.commence(request, response, failed); } }

Target:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { final boolean debug = this.logger.isDebugEnabled(); String token; try { token = this.bearerTokenResolver.resolve(request); } catch ( OAuth2AuthenticationException invalid ) { this.authenticationEntryPoint.commence(request, response, invalid); return; } if (token == null) { filterChain.doFilter(request, response); return; } BearerTokenAuthenticationToken authenticationRequest = new BearerTokenAuthenticationToken(token); authenticationRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); try { Authentication authenticationResult = this.authenticationManager.authenticate(authenticationRequest); SecurityContext context = SecurityContextHolder.createEmptyContext(); context.setAuthentication(authenticationResult); SecurityContextHolder.setContext(context); filterChain.doFilter(request, response); } catch (AuthenticationException failed) { SecurityContextHolder.clearContext(); if (debug) { this.logger.debug("Authentication request for failed: " + failed); } this.authenticationEntryPoint.commence(request, response, failed); } }
Source:
public void connectionClosed() { synchronized (clientHandles) { if (--refCount == 0) { clientHandles.remove(this.url); } ; } }

Target:
public void connectionClosed() { synchronized (clientHandles) { if (--refCount == 0) { clientHandles.remove(this.url); } } }
Source:
public void testDeleteServerDeleteMutationPlan() throws Exception { String tableName = generateUniqueName(); String indexName = generateUniqueName(); String tagValue = "customer-delete"; String delete = "DELETE FROM " + tableName; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(ConnectionQueryServices.SOURCE_OPERATION_ATTRIB, tagValue); createAndUpsertTable(tableName, indexName, props); verifyDeletePlan(delete, "ServerSelectDeleteMutationPlan", props); executeDelete(delete, props, 2); String startRowKeyForBaseTable = "1"; String startRowKeyForIndexTable = "foo"; checkTagPresentInDeleteMarker(tableName, startRowKeyForBaseTable, true, tagValue); checkTagPresentInDeleteMarker(indexName, startRowKeyForIndexTable, false, null); }

Target:
public void testDeleteServerDeleteMutationPlan() throws Exception { String tableName = generateUniqueName(); String indexName = generateUniqueName(); String tagValue = "customer-delete"; String delete = "DELETE FROM " + tableName; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); props.setProperty(ConnectionQueryServices.SOURCE_OPERATION_ATTRIB, tagValue); createAndUpsertTable(tableName, indexName, props); verifyDeletePlan(delete, DeleteCompiler.ServerSelectDeleteMutationPlan.class, props); executeDelete(delete, props, 2); String startRowKeyForBaseTable = "1"; String startRowKeyForIndexTable = "foo"; checkTagPresentInDeleteMarker(tableName, startRowKeyForBaseTable, true, tagValue); checkTagPresentInDeleteMarker(indexName, startRowKeyForIndexTable, false, null); }
Source:
void endTransaction(Transaction t, boolean hasChanges) { t.closeIt(); int txId = t.transactionId; transactions.set(txId, null); boolean success; do { VersionedBitSet original = openTransactions.get(); assert original.get(txId); VersionedBitSet clone = original.clone(); clone.clear(txId); success = openTransactions.compareAndSet(original, clone); } while(!success); if (hasChanges) { boolean wasStored = t.wasStored; if (wasStored && !preparedTransactions.isClosed()) { preparedTransactions.remove(txId); } if (wasStored || store.getAutoCommitDelay() == 0) { store.tryCommit(); } else { boolean empty = true; BitSet openTrans = openTransactions.get(); for (int i = openTrans.nextSetBit(0); empty && i >= 0; i = openTrans.nextSetBit(i + 1)) { MVMap<Long, Object[]> undoLog = undoLogs[i]; if (undoLog != null) { empty = undoLog.isEmpty(); } } if (empty) { int unsaved = store.getUnsavedMemory(); int max = store.getAutoCommitMemory(); if (unsaved * 4 > max * 3) { store.tryCommit(); } } } } }

Target:
void endTransaction(Transaction t, boolean hasChanges) { t.closeIt(); int txId = t.transactionId; transactions.set(txId, null); boolean success; do { VersionedBitSet original = openTransactions.get(); assert original.get(txId); VersionedBitSet clone = original.clone(); clone.clear(txId); success = openTransactions.compareAndSet(original, clone); } while(!success); if (hasChanges) { boolean wasStored = t.wasStored; if (wasStored && !preparedTransactions.isClosed()) { preparedTransactions.remove(txId); } if (wasStored || store.getAutoCommitDelay() == 0) { store.tryCommit(); } else { if (isUndoEmpty()) { int unsaved = store.getUnsavedMemory(); int max = store.getAutoCommitMemory(); if (unsaved * 4 > max * 3) { store.tryCommit(); } } } } }
Source:
public void handleSoundSettings(Command command, ChannelUID channelUID) throws IOException { if (command instanceof RefreshType) { try { logger.debug("SrsZr5Handler handleSoundSettings RefreshType"); Map<String, String> result = sound_settings_cache.getValue(); if (result != null) { logger.debug("SrsZr5Handler Updateing sound field to {}", result.get("clearAudio"), result.get("soundField")); if (result.get("clearAudio").equalsIgnoreCase("on")) { updateState(channelUID, new StringType("clearAudio")); } else { updateState(channelUID, new StringType(result.get("soundField"))); } } } catch (CompletionException ex) { throw new IOException(ex.getCause()); } } if (command instanceof StringType) { if (((StringType) command).toString().equalsIgnoreCase("clearAudio")) { connection.setSoundSettings("clearAudio", "on"); } else { connection.setSoundSettings("soundField", ((StringType) command).toString()); } } }

Target:
public void handleSoundSettings(Command command, ChannelUID channelUID) throws IOException { if (command instanceof RefreshType) { try { logger.debug("SrsZr5Handler handleSoundSettings RefreshType"); Map<String, String> result = soundSettingsCache.getValue(); if (result != null) { logger.debug("SrsZr5Handler Updating sound field to {}", result.get("clearAudio"), result.get("soundField")); if (result.get("clearAudio").equalsIgnoreCase("on")) { updateState(channelUID, new StringType("clearAudio")); } else { updateState(channelUID, new StringType(result.get("soundField"))); } } } catch (CompletionException ex) { throw new IOException(ex.getCause()); } } if (command instanceof StringType) { if (((StringType) command).toString().equalsIgnoreCase("clearAudio")) { connection.setSoundSettings("clearAudio", "on"); } else { connection.setSoundSettings("soundField", ((StringType) command).toString()); } } }
Source:
public void testNoDifference(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final EList<Conflict> conflicts = comparison.getConflicts(); final Resource originResource = support.getAncestorResource(); final Resource leftResource = support.getLeftResource(); final Resource rightResource = support.getRightResource(); assertNoMigration(originResource); assertNoMigration(leftResource); assertNoMigration(rightResource); assertMigratedStructure(originResource, true, "This is just for testing."); assertMigratedStructure(leftResource, true, "This is just for testing."); assertMigratedStructure(rightResource, true, "This is just for testing."); assertTrue("Unexpected conflicts: " + conflicts, conflicts.isEmpty()); assertTrue("Unexpected differences: " + differences, differences.isEmpty()); }

Target:
public void testNoDifference(final Comparison comparison, final CompareTestSupport support) { final List<Diff> differences = comparison.getDifferences(); final EList<Conflict> conflicts = comparison.getConflicts(); final Resource originResource = support.getAncestorResource(); final Resource leftResource = support.getLeftResource(); final Resource rightResource = support.getRightResource(); assertNoMigration(originResource); assertNoMigration(leftResource); assertNoMigration(rightResource); assertMigratedStructure(originResource, BLOCK_ISENCAPSULATED, VIEWPOINT_PURPOSE); assertMigratedStructure(leftResource, BLOCK_ISENCAPSULATED, VIEWPOINT_PURPOSE); assertMigratedStructure(rightResource, BLOCK_ISENCAPSULATED, VIEWPOINT_PURPOSE); assertTrue("Unexpected conflicts: " + conflicts, conflicts.isEmpty()); assertTrue("Unexpected differences: " + differences, differences.isEmpty()); }
Source:
public Map<String, ComponentMetrics> get(String... desiredBoltNames) { Map<String, ComponentMetrics> result = new HashMap<>(); Set<String> boltNameFilter = new HashSet<>(); if (desiredBoltNames.length > 0) { boltNameFilter.addAll(Arrays.asList(desiredBoltNames)); } String[] boltComponents = topologyProvider.getBoltNames(); for (String boltComponent : boltComponents) { if (!boltNameFilter.isEmpty() && !boltNameFilter.contains(boltComponent)) { continue; } String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(boltComponent); Map<String, InstanceMetrics> instanceMetrics = new HashMap<>(); for (String boltInstanceName : boltInstanceNames) { String metric = BUFFER_SIZE + boltInstanceName + BUFFER_SIZE_SUFFIX; Map<String, ComponentMetrics> stmgrResult = metricsProvider.getComponentMetrics( metric, getDuration(BufferSizeSensor.class.getSimpleName()), HealthMgrConstants.COMPONENT_STMGR); HashMap<String, InstanceMetrics> streamManagerResult = stmgrResult.get(HealthMgrConstants.COMPONENT_STMGR).getMetrics(); double stmgrInstanceResult = streamManagerResult.values().iterator().next().getMetricValueSum(metric); InstanceMetrics boltInstanceMetric = new InstanceMetrics(boltInstanceName, BUFFER_SIZE, stmgrInstanceResult); instanceMetrics.put(boltInstanceName, boltInstanceMetric); } ComponentMetrics componentMetrics = new ComponentMetrics(boltComponent, instanceMetrics); result.put(boltComponent, componentMetrics); } return result; }

Target:
public Map<String, ComponentMetrics> get(String... desiredBoltNames) { Map<String, ComponentMetrics> result = new HashMap<>(); Set<String> boltNameFilter = new HashSet<>(); if (desiredBoltNames.length > 0) { boltNameFilter.addAll(Arrays.asList(desiredBoltNames)); } String[] boltComponents = topologyProvider.getBoltNames(); for (String boltComponent : boltComponents) { if (!boltNameFilter.isEmpty() && !boltNameFilter.contains(boltComponent)) { continue; } String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(boltComponent); Map<String, InstanceMetrics> instanceMetrics = new HashMap<>(); for (String boltInstanceName : boltInstanceNames) { String metric = this.metricName + boltInstanceName + BUFFER_SIZE_SUFFIX; Map<String, ComponentMetrics> stmgrResult = metricsProvider.getComponentMetrics( metric, getDuration(BufferSizeSensor.class.getSimpleName()), HealthMgrConstants.COMPONENT_STMGR); HashMap<String, InstanceMetrics> streamManagerResult = stmgrResult.get(HealthMgrConstants.COMPONENT_STMGR).getMetrics(); double stmgrInstanceResult = streamManagerResult.values().iterator().next().getMetricValueSum(metric); InstanceMetrics boltInstanceMetric = new InstanceMetrics(boltInstanceName, this.metricName, stmgrInstanceResult); instanceMetrics.put(boltInstanceName, boltInstanceMetric); } ComponentMetrics componentMetrics = new ComponentMetrics(boltComponent, instanceMetrics); result.put(boltComponent, componentMetrics); } return result; }
Source:
public ModeledSegment(final SimpleInterval interval, final String call, final long originalProbeCount, final double segmentMeanInLogCR) { this.simpleInterval = Utils.nonNull(interval, "The input interval cannot be null"); this.call = Utils.nonNull(call, String.format("The input call cannot be null. Use empty string, instead (\"%s\")", NO_CALL)); this.segmentMean = ParamUtils.isFinite(segmentMeanInLogCR, "Segment Mean must be a finite."); this.originalProbeCount = ParamUtils.isPositiveOrZero(originalProbeCount, "Number of original probes must be positive or zero."); }

Target:
public ModeledSegment(final SimpleInterval interval, final String call, final long originalProbeCount, final double segmentMeanInLogCR) { this.simpleInterval = Utils.nonNull(interval, "The input interval cannot be null"); this.call = Utils.nonNull(call, String.format("The input call cannot be null. Use empty string, instead (\"%s\")", NO_CALL)); this.segmentMean = ParamUtils.isFinite(segmentMeanInLogCR, "Segment Mean must be finite."); this.originalProbeCount = ParamUtils.isPositiveOrZero(originalProbeCount, "Number of original probes must be positive or zero."); }
Source:
static OverlapDetector<Chain> loadChains(final BufferedLineReader reader, String sourceName) { final OverlapDetector<Chain> ret = new OverlapDetector<Chain>(0, 0); Chain chain; while ((chain = Chain.loadChain(reader, sourceName)) != null) { ret.addLhs(chain, chain.interval); } reader.close(); return ret; }

Target:
static OverlapDetector<Chain> loadChains(final BufferedLineReader reader, String sourceName) { final OverlapDetector<Chain> ret = new OverlapDetector<Chain>(0, 0); Chain chain; while ((chain = Chain.loadChain(reader, sourceName)) != null) { ret.addLhs(chain, chain.interval); } return ret; }
Source:
public int pickBiome(int x, int y, int z, long seed) { tempBase.setSeed((int) seed*3); moistBase.setSeed((int) seed^2); int biome = 99; VanillaBiomeType biomes[] = {VanillaBiomes.DESERT, VanillaBiomes.JUNGLE, VanillaBiomes.MOUNTAIN, VanillaBiomes.MUSHROOM, VanillaBiomes.OCEAN, VanillaBiomes.PLAIN, VanillaBiomes.SWAMP, VanillaBiomes.TAIGA, VanillaBiomes.TUNDRA};; for(VanillaBiomeType b : biomes) { if(b.isValidPlacement(tempBase.GetValue(x, y, z)*100.0, moistBase.GetValue(x, y, z)*100.0)) { biome = b.getBiomeId(); } } return biome; }

Target:
public int pickBiome(int x, int y, int z, long seed) { base.setSeed((int) seed); noise.setSeed((int) seed); return (int) (noise.GetValue(x / 256.0 + 0.05, y + 0.05, z / 256.0 + 0.05) * 64); }
Source:
void serializeForWhere(QueryMetadata metadata) { boolean requireSchemaInWhere = templates.isRequiresSchemaInWhere(); if (requireSchemaInWhere) { dmlWithSchema = true; } append(templates.getWhere()).handle(metadata.getWhere()); if (requireSchemaInWhere) { dmlWithSchema = false; } }

Target:
void serializeForWhere(QueryMetadata metadata) { boolean requireSchemaInWhere = templates.isRequiresSchemaInWhere(); boolean originalDmlWithSchema = dmlWithSchema; if (requireSchemaInWhere) { dmlWithSchema = true; } append(templates.getWhere()).handle(metadata.getWhere()); if (requireSchemaInWhere) { dmlWithSchema = originalDmlWithSchema; } }
Source:
public FabricConfiguration(FabricWorldEdit mod) { super(new File(mod.getWorkingDir() + File.separator + "worldedit.properties")); }

Target:
public FabricConfiguration(FabricWorldEdit mod) { super(new File(mod.getWorkingDir(), "worldedit.properties")); }
Source:
public GridCacheDataStore createGridCacheDataStore( CacheGroupContext grpCtx, int partId, boolean exists, IgniteLogger log ) { return new GridCacheDataStore( grpCtx, partId, true, busyLock, log ); }

Target:
public GridCacheDataStore createGridCacheDataStore( CacheGroupContext grpCtx, int partId, boolean exists, IgniteLogger log ) { return new GridCacheDataStore( grpCtx, partId, exists, busyLock, log ); }
Source:
public DefaultResilienceStrategyConfiguration bind(RecoveryStore<?> store, CacheLoaderWriter<?, ?> loaderWriter) { Object[] arguments = getArguments(); Object[] boundArguments = Arrays.copyOf(arguments, arguments.length + 2); boundArguments[arguments.length] = store; boundArguments[arguments.length + 1] = loaderWriter; return new BoundConfiguration(getClazz(), boundArguments); }

Target:
public DefaultResilienceStrategyConfiguration bind(RecoveryStore<?> store, CacheLoaderWriter<?, ?> loaderWriter) throws IllegalStateException { if (getInstance() == null) { Object[] arguments = getArguments(); Object[] boundArguments = Arrays.copyOf(arguments, arguments.length + 2); boundArguments[arguments.length] = store; boundArguments[arguments.length + 1] = loaderWriter; return new BoundConfiguration(getClazz(), boundArguments); } else { return this; } }
Source:
public void verifyResendPublishedEmailButtonDoesNotExist(String courseId, String evalName) { int rowId = getEvaluationRowId(courseId, evalName); waitForElementPresence(By.id("session" + rowId)); WebElement sessionRow = browser.driver.findElement(By.id("session" + rowId)); String resendLinksClassNamePrefix = "session-resend-published-email-for-test"; verifyElementDoesNotContainsElement(sessionRow, By.className(resendLinksClassNamePrefix)); }

Target:
public void verifyResendPublishedEmailButtonDoesNotExist(String courseId, String evalName) { WebElement sessionRow = waitForElementPresence(By.id("session" + getEvaluationRowId(courseId, evalName))); verifyElementDoesNotContainElement(sessionRow, By.className("session-resend-published-email-for-test")); }
Source:
private void addPersistentWatches(String clientPath, Set<Watcher> result) { synchronized (persistentWatches) { PathIterator pathIterator = new PathIterator(clientPath); while (pathIterator.hasNext()) { addTo(persistentWatches.get(pathIterator.next()), result); } } }

Target:
private void addPersistentWatches(String clientPath, Set<Watcher> result) { synchronized (persistentWatches) { addTo(persistentWatches.get(clientPath), result); } synchronized (persistentRecursiveWatches) { for (String path : PathParentIterator.forAll(clientPath).asIterable()) { addTo(persistentRecursiveWatches.get(path), result); } } }
Source:
public final void disconnect(ConnectionAnchor anchor) { boolean disconnected = false; boolean wasConnected = isConnected(); if (startAnchor.isPresent() && startAnchor.get().equals(anchor)) { startAnchor = Optional.empty(); disconnected = true; } else if (endAnchor.isPresent() && endAnchor.get().equals(anchor)) { endAnchor = Optional.empty(); disconnected = true; } if(disconnected) { removeListeners(anchor); anchor.disconnectConnection(this); if (wasConnected) { ConnectionCreationManager.nextConnectionState(); anchor.getBlock().setConnectionState(ConnectionCreationManager.getConnectionState()); startAnchor.ifPresent(a -> a.getBlock().setConnectionState(ConnectionCreationManager.getConnectionState())); endAnchor.ifPresent(a -> a.getBlock().setConnectionState(ConnectionCreationManager.getConnectionState())); this.setErrorState(false); } } }

Target:
public final void disconnect(ConnectionAnchor anchor) { boolean disconnected = false; boolean wasConnected = isConnected(); if (startAnchor.isPresent() && startAnchor.get().equals(anchor)) { startAnchor = Optional.empty(); disconnected = true; } else if (endAnchor.isPresent() && endAnchor.get().equals(anchor)) { endAnchor = Optional.empty(); disconnected = true; } if (disconnected) { removeListeners(anchor); anchor.disconnectConnection(this); if (wasConnected) { int state = ConnectionCreationManager.nextConnectionState(); anchor.getBlock().setConnectionState(state); startAnchor.ifPresent(a -> a.getBlock().setConnectionState(state)); endAnchor.ifPresent(a -> a.getBlock().setConnectionState(state)); this.setErrorState(false); } } }