auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected boolean handleEquivalences(Diff diff, boolean rightToLeft, Monitor monitor) { boolean continueMerge = true; for (Diff equivalent : diff.getEquivalence().getDifferences()) { if (diff instanceof ReferenceChange && equivalent instanceof ReferenceChange) { final ReferenceChange diffRC = (ReferenceChange)diff; final ReferenceChange equivalentRC = (ReferenceChange)equivalent; if ((diffRC.getReference().getEOpposite() == equivalentRC.getReference() || diffRC .getReference() == equivalentRC.getReference()) && equivalent.getState() == DifferenceState.UNRESOLVED) { final boolean mergeEquivalence = isOneToManyAndAdd(equivalentRC, rightToLeft) || isOneToOneAndSet(equivalentRC, rightToLeft); if (mergeEquivalence) { mergeDiff(equivalent, rightToLeft, monitor); continueMerge = false; } } } if (rightToLeft) { if (diff.getSource() == DifferenceSource.LEFT) { continueMerge = continueMerge && !any(equivalent.getImplies(), in(diff.getRequiredBy())); } else { continueMerge = continueMerge && !any(equivalent.getImpliedBy(), in(diff.getRequires())); } } else { if (diff.getSource() == DifferenceSource.LEFT) { continueMerge = continueMerge && !any(equivalent.getImpliedBy(), in(diff.getRequires())); } else { continueMerge = continueMerge && !any(equivalent.getImplies(), in(diff.getRequiredBy())); } } equivalent.setState(DifferenceState.MERGED); } return continueMerge; }

Target:
protected boolean handleEquivalences(Diff diff, boolean rightToLeft, Monitor monitor) { boolean continueMerge = true; for (Diff equivalent : diff.getEquivalence().getDifferences()) { if (diff instanceof ReferenceChange && equivalent instanceof ReferenceChange) { final ReferenceChange diffRC = (ReferenceChange)diff; final ReferenceChange equivalentRC = (ReferenceChange)equivalent; final boolean isOppositeReference = diffRC.getReference().getEOpposite() == equivalentRC .getReference(); final boolean isSameReference = diffRC.getReference() == equivalentRC.getReference(); if ((isOppositeReference || isSameReference) && equivalent.getState() == DifferenceState.UNRESOLVED) { final boolean mergeEquivalence = isOneToManyAndAdd(equivalentRC, rightToLeft) || isOneToOneAndSet(equivalentRC, rightToLeft); if (mergeEquivalence) { mergeDiff(equivalent, rightToLeft, monitor); continueMerge = false; } } } if (rightToLeft) { if (diff.getSource() == DifferenceSource.LEFT) { continueMerge = continueMerge && !any(equivalent.getImplies(), in(diff.getRequiredBy())); } else { continueMerge = continueMerge && !any(equivalent.getImpliedBy(), in(diff.getRequires())); } } else { if (diff.getSource() == DifferenceSource.LEFT) { continueMerge = continueMerge && !any(equivalent.getImpliedBy(), in(diff.getRequires())); } else { continueMerge = continueMerge && !any(equivalent.getImplies(), in(diff.getRequiredBy())); } } equivalent.setState(DifferenceState.MERGED); } return continueMerge; }
Source:
public static void assertEquals(Iterator<?> actual, Iterator<?> expected, String message) { if (actual == null && expected == null) { return; } if(actual == null || expected == null) { String msg = message != null ? message : "Iterators not equal: expected: " + expected + " and actual: " + actual; fail(msg); } if(actual == expected) { return; } int i = -1; while(actual.hasNext() && expected.hasNext()) { i++; Object e = expected.next(); Object a = actual.next(); String explanation = "Iterators differ at element [" + i + "]: " + e + " != " + a; String errorMessage = message == null ? explanation : message + ": " + explanation; assertEqualsImpl(a, e, errorMessage); } if(actual.hasNext()) { String explanation = "Actual iterator returned more elements than the expected iterator."; String errorMessage = message == null ? explanation : message + ": " + explanation; fail(errorMessage); } else if(expected.hasNext()) { String explanation = "Expected iterator returned more elements than the actual iterator."; String errorMessage = message == null ? explanation : message + ": " + explanation; fail(errorMessage); } }

Target:
public static void assertEquals(Iterator<?> actual, Iterator<?> expected, String message) { if(actual == expected) { return; } if(actual == null || expected == null) { String msg = message != null ? message : "Iterators not equal: expected: " + expected + " and actual: " + actual; fail(msg); } int i = -1; while(actual.hasNext() && expected.hasNext()) { i++; Object e = expected.next(); Object a = actual.next(); String explanation = "Iterators differ at element [" + i + "]: " + e + " != " + a; String errorMessage = message == null ? explanation : message + ": " + explanation; assertEqualsImpl(a, e, errorMessage); } if(actual.hasNext()) { String explanation = "Actual iterator returned more elements than the expected iterator."; String errorMessage = message == null ? explanation : message + ": " + explanation; fail(errorMessage); } else if(expected.hasNext()) { String explanation = "Expected iterator returned more elements than the actual iterator."; String errorMessage = message == null ? explanation : message + ": " + explanation; fail(errorMessage); } }
Source:
public void updateDigitalTwin(String digitalTwinId, List<Object> digitalTwinUpdateOperations) { updateDigitalTwinWithResponse(digitalTwinId, digitalTwinUpdateOperations, new RequestOptions(), Context.NONE).getValue(); }

Target:
public void updateDigitalTwin(String digitalTwinId, List<Object> digitalTwinUpdateOperations) { updateDigitalTwinWithResponse(digitalTwinId, digitalTwinUpdateOperations, new UpdateDigitalTwinRequestOptions(), Context.NONE); }
Source:
private EmptyByteBuf(ByteBufAllocator alloc, ByteOrder order) { ObjectUtil.checkNotNull(alloc, "alloc"); this.alloc = alloc; this.order = order; str = StringUtil.simpleClassName(this) + (order == ByteOrder.BIG_ENDIAN? "BE" : "LE"); }

Target:
private EmptyByteBuf(ByteBufAllocator alloc, ByteOrder order) { this.alloc = ObjectUtil.checkNotNull(alloc, "alloc"); this.order = order; str = StringUtil.simpleClassName(this) + (order == ByteOrder.BIG_ENDIAN? "BE" : "LE"); }
Source:
private ToolStripButton getSchedulerLinkButton() { ToolStripButton schedulerButton = new ToolStripButton("Scheduler"); schedulerButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.open("/rm", "", ""); } }); return schedulerButton; }

Target:
private ToolStripButton getSchedulerLinkButton() { ToolStripButton schedulerButton = new ToolStripButton("Scheduler"); schedulerButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Window.open("/Scheduler", "", ""); } }); return schedulerButton; }
Source:
public void showWebPage(String url, boolean openExternal, boolean clearHistory, HashMap<String, Object> params) { LOG.d(TAG, "showWebPage(%s, %b, %b, HashMap", url, openExternal, clearHistory); if (clearHistory) { this.clearHistory(); } if (!openExternal) { if (url.startsWith("file://") || pluginManager.shouldAllowNavigation(url)) { loadUrlIntoView(url, true); return; } LOG.w(TAG, "showWebPage: Cannot load URL into webview since it is not in white list. Loading into browser instead. (URL=" + url + ")"); } try { Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse(url); if ("file".equals(uri.getScheme())) { intent.setDataAndType(uri, resourceApi.getMimeType(uri)); } else { intent.setData(uri); } cordova.getActivity().startActivity(intent); } catch (android.content.ActivityNotFoundException e) { LOG.e(TAG, "Error loading url " + url, e); } }

Target:
public void showWebPage(String url, boolean openExternal, boolean clearHistory, HashMap<String, Object> params) { LOG.d(TAG, "showWebPage(%s, %b, %b, HashMap", url, openExternal, clearHistory); if (clearHistory) { this.clearHistory(); } if (!openExternal) { if (helper.shouldAllowNavigation(url)) { loadUrlIntoView(url, true); return; } LOG.w(TAG, "showWebPage: Cannot load URL into webview since it is not in white list. Loading into browser instead. (URL=" + url + ")"); } try { Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.parse(url); if ("file".equals(uri.getScheme())) { intent.setDataAndType(uri, resourceApi.getMimeType(uri)); } else { intent.setData(uri); } cordova.getActivity().startActivity(intent); } catch (android.content.ActivityNotFoundException e) { LOG.e(TAG, "Error loading url " + url, e); } }
Source:
public SerialPortParameters(int baudrate, int dataBits, int stopBits, int parity, int flowControl) { setParams(baudrate, dataBits, stopBits, parity, flowControl); }

Target:
public SerialPortParameters(int baudrate, int dataBits, int stopBits, int parity, int flowControl) { if (baudrate < 0) throw new IllegalArgumentException("Baudrate cannot be less than 0."); if (dataBits < 0) throw new IllegalArgumentException("Number of data bits cannot be less than 0."); if (stopBits < 0) throw new IllegalArgumentException("Number of stop bits cannot be less than 0."); if (parity < 0) throw new IllegalArgumentException("Illegal parity value."); if (flowControl < 0) throw new IllegalArgumentException("Illegal flow control value."); this.baudrate = baudrate; this.dataBits = dataBits; this.stopBits = stopBits; this.parity = parity; this.flowControl = flowControl; }
Source:
public AbstractJob(String thingUID) { checkArgument(thingUID != null, "Thing UID cannot be null"); this.thingUID = thingUID; }

Target:
public AbstractJob(String thingUID) { checkArgument(thingUID != null, "The thingUID must not be null"); this.thingUID = thingUID; }
Source:
public void updatePatientsList() { new PatientDAO().getAllPatients().observeOn(AndroidSchedulers.mainThread()).subscribe(patientList -> { final int NO_STRING_ID = R.string.last_vitals_none_label; boolean isFiltering = StringUtils.notNull(mQuery); if (isFiltering) { patientList = FilterUtil.getPatientsFilteredByQuery(patientList, mQuery); if (patientList.isEmpty()) { mFormEntryPatientListView.updateListVisibility(false, R.string.search_patient_no_result_for_query, mQuery); } else { mFormEntryPatientListView.updateListVisibility(true, NO_STRING_ID, null); } } else { if (patientList.isEmpty()) { mFormEntryPatientListView.updateListVisibility(false, R.string.search_patient_no_results, null); } else { mFormEntryPatientListView.updateListVisibility(true, NO_STRING_ID, null); } } mFormEntryPatientListView.updateAdapter(patientList); }); }

Target:
public void updatePatientsList() { addSubscription(new PatientDAO().getAllPatients() .observeOn(AndroidSchedulers.mainThread()) .subscribe(patientList -> { final int NO_STRING_ID = R.string.last_vitals_none_label; boolean isFiltering = StringUtils.notNull(mQuery); if (isFiltering) { patientList = FilterUtil.getPatientsFilteredByQuery(patientList, mQuery); if (patientList.isEmpty()) { mFormEntryPatientListView.updateListVisibility(false, R.string.search_patient_no_result_for_query, mQuery); } else { mFormEntryPatientListView.updateListVisibility(true, NO_STRING_ID, null); } } else { if (patientList.isEmpty()) { mFormEntryPatientListView.updateListVisibility(false, R.string.search_patient_no_results, null); } else { mFormEntryPatientListView.updateListVisibility(true, NO_STRING_ID, null); } } mFormEntryPatientListView.updateAdapter(patientList); })); }
Source:
private synchronized BuildAction getBuildAction(IWorkbenchWindow window) { if (buildAction == null) { buildAction = new BuildAction(window, IncrementalProjectBuilder.INCREMENTAL_BUILD); } return buildAction; }

Target:
private BuildAction getBuildAction(IWorkbenchWindow window) { BuildAction buildAction = (BuildAction) buildActions.get(window); if (buildAction != null) { return buildAction; } buildAction = new BuildAction(window, IncrementalProjectBuilder.INCREMENTAL_BUILD); buildActions.put(window, buildAction); window.addPageListener(new IPageListener() { public void pageOpened(IWorkbenchPage page) { } public void pageClosed(IWorkbenchPage page) { IWorkbenchWindow closedWindow = page.getWorkbenchWindow(); buildActions.remove(closedWindow); closedWindow.removePageListener(this); } public void pageActivated(IWorkbenchPage page) { } }); return buildAction; }
Source:
public void setInstalledCharEnd(int charEnd) throws CoreException { int existingValue = ensureMarker().getAttribute(IMarker.CHAR_END, -1); if (charEnd != existingValue) { setAttribute(IMarker.CHAR_END, charEnd); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } }

Target:
public void setInstalledCharEnd(int charEnd) throws CoreException { int existingValue = ensureMarker().getAttribute(IMarker.CHAR_END, -1); if (charEnd != existingValue) { setAttribute(IMarker.CHAR_END, charEnd); setAttribute(RESET_INSTALLED_LOCATION, Boolean.TRUE); setAttribute( IMarker.MESSAGE, getMarkerMessage() ); } }
Source:
private static List<ElementLine> readLines(InputStream input) throws IOException { final List<String> rawLines = IOUtils.readLines(input, StandardCharsets.UTF_8).stream() .map(String::trim) .filter(StringUtils::isNotEmpty) .filter(line -> !line.startsWith("#")) .collect(Collectors.toList()); final List<ElementLine> lines = new ArrayList<>(); for (String rawLine : rawLines) { final String[] rawLineSplit = rawLine.split("="); ElementLine line = readLine(rawLineSplit); if (line != null) { lines.add(line); } } return lines; }

Target:
private static List<ElementLine> readLines(InputStream input) throws IOException { final Properties properties = new Properties(); properties.load(new InputStreamReader(input, StandardCharsets.UTF_8)); return properties.entrySet().stream() .map(entry -> Pair.of(trim(entry.getKey().toString()), trim(entry.getValue().toString()))) .filter(pair -> isNotEmpty(pair.getKey())) .map(pair -> new ElementLine(pair.getKey(), readLine(pair.getValue()))) .collect(Collectors.toList()); }
Source:
private static double similarity(BufferedImage var, BufferedImage cont) throws Exception { double[] varArr = new double[var.getWidth()*var.getHeight()*3]; double[] contArr = new double[cont.getWidth()*cont.getHeight()*3]; if (varArr.length!=contArr.length) throw new Exception("The pictures are different sizes!"); for(int i = 0; i < var.getHeight(); i++) { for(int j = 0; j < var.getWidth(); j++) { varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed(); contArr[i*cont.getWidth() + j + 0] = new Color(cont.getRGB(j, i)).getRed(); varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen(); contArr[i*cont.getWidth() + j + 1] = new Color(cont.getRGB(j, i)).getGreen(); varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue(); contArr[i*cont.getWidth() + j + 2] = new Color(cont.getRGB(j, i)).getBlue(); } } double mins=0; double maxs=0; for(int i=0;i!=varArr.length;i++){ if (varArr[i]>contArr[i]){ mins+=contArr[i]; maxs+=varArr[i]; } else { mins+=varArr[i]; maxs+=contArr[i]; } } return mins/maxs; }

Target:
private static double similarity(BufferedImage var, BufferedImage cont) { double[] varArr = new double[var.getWidth()*var.getHeight()*3]; double[] contArr = new double[cont.getWidth()*cont.getHeight()*3]; if (varArr.length!=contArr.length) throw new IllegalStateException("The pictures are different sizes!"); for(int i = 0; i < var.getHeight(); i++) { for(int j = 0; j < var.getWidth(); j++) { varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed(); contArr[i*cont.getWidth() + j + 0] = new Color(cont.getRGB(j, i)).getRed(); varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen(); contArr[i*cont.getWidth() + j + 1] = new Color(cont.getRGB(j, i)).getGreen(); varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue(); contArr[i*cont.getWidth() + j + 2] = new Color(cont.getRGB(j, i)).getBlue(); } } double mins=0; double maxs=0; for(int i=0;i!=varArr.length;i++){ if (varArr[i]>contArr[i]){ mins+=contArr[i]; maxs+=varArr[i]; } else { mins+=varArr[i]; maxs+=contArr[i]; } } return mins/maxs; }
Source:
public void replaceOngoingState(List<ITmfStateInterval> newStateIntervals) { final int size = newStateIntervals.size(); fReadWriteLock.writeLock().lock(); try { fOngoingStateInfo = new ArrayList<>(size); fOngoingStateStartTimes = new ArrayList<>(size); fStateValueTypes = new ArrayList<>(size); for (ITmfStateInterval interval : newStateIntervals) { if (interval != null) { fOngoingStateInfo.add(interval.getStateValue()); fOngoingStateStartTimes.add(interval.getStartTime()); fStateValueTypes.add(interval.getStateValue().getType()); } else { addEmptyEntry(); } } } finally { fReadWriteLock.writeLock().unlock(); } }

Target:
public void replaceOngoingState(List<ITmfStateInterval> newStateIntervals) { final int size = newStateIntervals.size(); fRWLock.writeLock().lock(); try { fOngoingStateInfo = new ArrayList<>(size); fOngoingStateStartTimes = new ArrayList<>(size); fStateValueTypes = new ArrayList<>(size); for (ITmfStateInterval interval : newStateIntervals) { if (interval != null) { fOngoingStateInfo.add(interval.getStateValue()); fOngoingStateStartTimes.add(interval.getStartTime()); fStateValueTypes.add(interval.getStateValue().getType()); } else { addEmptyEntry(); } } } finally { fRWLock.writeLock().unlock(); } }
Source:
public Page getOutput() { checkState(mergeSortProcessor != null, "mergeSources must be non-null when getting output"); if (closed) { return null; } while (!pageBuilder.isFull()) { PageWithPosition pageWithPosition = mergeSortProcessor.poll(); if (pageWithPosition == null) { break; } Page page = pageWithPosition.getPage(); int position = pageWithPosition.getPosition(); pageBuilder.declarePosition(); for (int i = 0; i < outputChannels.size(); i++) { Type type = outputTypes.get(i); Block block = page.getBlock(outputChannels.get(i)); type.appendTo(block, position, pageBuilder.getBlockBuilder(i)); } pageWithPosition.incrementPosition(); } if (pageBuilder.isEmpty()) { return null; } if (pageBuilder.isFull() || mergeSortProcessor.isFinished()) { Page page = pageBuilder.build(); operatorContext.recordGeneratedInput(page.getSizeInBytes(), page.getPositionCount()); pageBuilder.reset(); return page; } return null; }

Target:
public Page getOutput() { checkState(mergeSortProcessor != null, "mergeSources must be non-null when getting output"); if (closed) { return null; } while (!pageBuilder.isFull()) { PageWithPosition pageWithPosition = mergeSortProcessor.poll(); if (pageWithPosition == null) { break; } pageWithPosition.appendTo(pageBuilder, outputChannels, outputTypes); pageBuilderLocalMemoryContext.setBytes(pageBuilder.getRetainedSizeInBytes()); } if (pageBuilder.isEmpty()) { return null; } if (pageBuilder.isFull() || mergeSortProcessor.isFinished()) { Page page = pageBuilder.build(); operatorContext.recordGeneratedInput(page.getSizeInBytes(), page.getPositionCount()); pageBuilder.reset(); return page; } return null; }
Source:
public void testGetFolderContentWithInvalidIdentifier() { final String NOT_EXISTING_ID = "01234567-1234-1234-1234-123456789012"; try { browserAPI.getFolderContent( APILocator.systemUser(), NOT_EXISTING_ID, 0, -1, "", null, null, true, false, false, false, "", false, false, 1 ); } catch ( Exception e ){ Assert.assertTrue( e instanceof NotFoundInDbException ); } }

Target:
public void testGetFolderContentWithInvalidIdentifier() throws DotDataException, DotSecurityException { final String NOT_EXISTING_ID = "01234567-1234-1234-1234-123456789012"; browserAPI.getFolderContent( APILocator.systemUser(), NOT_EXISTING_ID, 0, -1, "", null, null, true, false, false, false, "", false, false, 1 ); }
Source:
protected ConstraintViolationSetAssert(Set<? extends ConstraintViolation<?>> actualViolations) { super( new ArrayList(actualViolations) ); this.actualViolations = actualViolations; }

Target:
protected ConstraintViolationSetAssert(Set<? extends ConstraintViolation<?>> actualViolations) { super( actualViolations ); this.actualViolations = actualViolations; }
Source:
public Resource getResource(URI uri, boolean loadOnDemand) { checkNotDisposed(); final Resource cached = getURIResourceMap().get(uri); if (cached != null) { return cached; } final Resource resource; final IStorage storage = storageToURI.get(uri); if (loadOnDemand && storage != null) { resource = load(storage, uri, new NullProgressMonitor()); } else if (allowResourceLoad) { resource = super.getResource(uri, true); } else { ILoadOnDemandPolicy.Registry registry = EMFCompareRCPPlugin.getDefault() .getLoadOnDemandPolicyRegistry(); if (registry.hasAnyAuthorizingPolicy(uri)) { resource = super.getResource(uri, true); } else { resource = super.getResource(uri, false); } } return resource; }

Target:
public Resource getResource(URI uri, boolean loadOnDemand) { checkNotDisposed(); final Resource cached = getURIResourceMap().get(uri); if (cached != null) { return cached; } final Resource resource; final IStorage storage = storageToURI.get(uri); if (loadOnDemand && storage != null) { resource = load(storage, uri, new NullProgressMonitor()); } else if (allowResourceLoad) { resource = super.getResource(uri, loadOnDemand); } else { ILoadOnDemandPolicy.Registry registry = EMFCompareRCPPlugin.getDefault() .getLoadOnDemandPolicyRegistry(); if (registry.hasAnyAuthorizingPolicy(uri)) { resource = super.getResource(uri, true); } else { resource = super.getResource(uri, false); } } return resource; }
Source:
public void removeAllAttributes(PerunSession sess, Facility facility, boolean removeAlsoUserFacilityAttributes) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException { removeAllAttributes(sess, facility); if (removeAlsoUserFacilityAttributes) { List<Attribute> userFacilityAttributes = getUserFacilityAttributesForAnyUser(sess, facility); getAttributesManagerImpl().removeAllUserFacilityAttributesForAnyUser(sess, facility); log.info("{} removed all attributes from any user facility {}.",sess.getLogId(), facility.getId()); getPerunBl().getAuditer().log(sess, "All user-facility attributes removed for for any user.", facility); for (Attribute attribute : userFacilityAttributes) attribute.setValue(null); List<User> facilityUsers = perunBl.getFacilitiesManagerBl().getAllowedUsers(sess, facility); for (User user : facilityUsers) { try { checkAttributesValue(sess, facility, user, userFacilityAttributes); this.checkAttributesDependencies(sess, facility, user, userFacilityAttributes); } catch (WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } for (Attribute attribute : userFacilityAttributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, facility, user, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } } } }

Target:
public void removeAllAttributes(PerunSession sess, Facility facility, boolean removeAlsoUserFacilityAttributes) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException { removeAllAttributes(sess, facility); if (removeAlsoUserFacilityAttributes) { List<Attribute> userFacilityAttributes = getUserFacilityAttributesForAnyUser(sess, facility); getAttributesManagerImpl().removeAllUserFacilityAttributesForAnyUser(sess, facility); log.info("{} removed all attributes from any user on facility {}.",sess.getLogId(), facility.getId()); getPerunBl().getAuditer().log(sess, "All user-facility attributes removed for for any user.", facility); for (Attribute attribute : userFacilityAttributes) attribute.setValue(null); List<User> facilityUsers = perunBl.getFacilitiesManagerBl().getAllowedUsers(sess, facility); for (User user : facilityUsers) { try { checkAttributesValue(sess, facility, user, userFacilityAttributes); this.checkAttributesDependencies(sess, facility, user, userFacilityAttributes); } catch (WrongAttributeAssignmentException ex) { throw new ConsistencyErrorException(ex); } for (Attribute attribute : userFacilityAttributes) { try { getAttributesManagerImpl().changedAttributeHook(sess, facility, user, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } } } } }
Source:
public void readFullPage() throws Exception { int fileSize = PAGE_SIZE; byte[] testData = generateData(fileSize); ByteArrayCacheManager manager = new ByteArrayCacheManager(); LocalCacheFileInStream stream = setupWithSingleFile(testData, manager); byte[] cacheMiss = new byte[fileSize]; Assert.assertEquals(fileSize, stream.read(cacheMiss)); Assert.assertArrayEquals(testData, cacheMiss); Assert.assertEquals(0, manager.mPagesServed); Assert.assertEquals(1, manager.mPagesCached); stream.seek(0); byte[] cacheHit = new byte[fileSize]; Assert.assertEquals(fileSize, stream.read(cacheHit)); Assert.assertArrayEquals(testData, cacheHit); Assert.assertEquals(1, manager.mPagesServed); }

Target:
public void readFullPage() throws Exception { int fileSize = PAGE_SIZE; byte[] testData = BufferUtils.getIncreasingByteArray(fileSize); ByteArrayCacheManager manager = new ByteArrayCacheManager(); LocalCacheFileInStream stream = setupWithSingleFile(testData, manager); byte[] cacheMiss = new byte[fileSize]; Assert.assertEquals(fileSize, stream.read(cacheMiss)); Assert.assertArrayEquals(testData, cacheMiss); Assert.assertEquals(0, manager.mPagesServed); Assert.assertEquals(1, manager.mPagesCached); stream.seek(0); byte[] cacheHit = new byte[fileSize]; Assert.assertEquals(fileSize, stream.read(cacheHit)); Assert.assertArrayEquals(testData, cacheHit); Assert.assertEquals(1, manager.mPagesServed); }
Source:
private void convertRegistryIdsToRegistries() { if (StringUtils.isEmpty(registryIds) && (registries == null || registries.isEmpty())) { Set<String> configedRegistries = new HashSet<>(); configedRegistries.addAll(getSubProperties(Environment.getInstance().getExternalConfigurationMap(), Constants.REGISTRIES_SUFFIX)); configedRegistries.addAll(getSubProperties(Environment.getInstance().getAppExternalConfigurationMap(), Constants.REGISTRIES_SUFFIX)); registryIds = String.join(",", configedRegistries); } if (StringUtils.isEmpty(registryIds)) { if (registries == null || registries.isEmpty()) { registries = new ArrayList<>(); registries.add(new RegistryConfig(RegistryConfig.NO_AVAILABLE)); } } else { String[] arr = Constants.COMMA_SPLIT_PATTERN.split(registryIds); if (registries == null || registries.isEmpty()) { registries = new ArrayList<>(); } Arrays.stream(arr).forEach(id -> { if (registries.stream().noneMatch(reg -> reg.getId().equals(id))) { RegistryConfig registryConfig = new RegistryConfig(RegistryConfig.NO_AVAILABLE); registryConfig.setId(id); registries.add(registryConfig); } }); if (registries.size() > arr.length) { throw new IllegalStateException("Too much registries found, the registries assigned to this service " + "are :" + registryIds + ", but got " + registries.size() + " registries!"); } } }

Target:
private void convertRegistryIdsToRegistries() { if (StringUtils.isEmpty(registryIds) && (registries == null || registries.isEmpty())) { Set<String> configedRegistries = new HashSet<>(); configedRegistries.addAll(getSubProperties(Environment.getInstance().getExternalConfigurationMap(), Constants.REGISTRIES_SUFFIX)); configedRegistries.addAll(getSubProperties(Environment.getInstance().getAppExternalConfigurationMap(), Constants.REGISTRIES_SUFFIX)); registryIds = String.join(",", configedRegistries); } if (StringUtils.isEmpty(registryIds)) { if (registries == null || registries.isEmpty()) { registries = new ArrayList<>(); registries.add(new RegistryConfig()); } } else { String[] arr = Constants.COMMA_SPLIT_PATTERN.split(registryIds); if (registries == null || registries.isEmpty()) { registries = new ArrayList<>(); } Arrays.stream(arr).forEach(id -> { if (registries.stream().noneMatch(reg -> reg.getId().equals(id))) { RegistryConfig registryConfig = new RegistryConfig(); registryConfig.setId(id); registries.add(registryConfig); } }); if (registries.size() > arr.length) { throw new IllegalStateException("Too much registries found, the registries assigned to this service " + "are :" + registryIds + ", but got " + registries.size() + " registries!"); } } }
Source:
public void testAlleleFractionPlotting() throws IOException { final File SNP_COUNTS_FILE = new File("src/test/resources/org/broadinstitute/hellbender/utils/plotter/snps.tsv"); final File SEGMENTS_FILE = new File("src/test/resources/org/broadinstitute/hellbender/utils/plotter/allelic.seg"); String sampleName = "HCC1143"; File tDir = IOUtils.tempDir("Test", "Plotting"); System.out.println(tDir); AlleleFractionSegmentedPlotter.writeSegmentedAlleleFractionPlot(sampleName, SNP_COUNTS_FILE.getAbsolutePath(), SEGMENTS_FILE.getAbsolutePath(), tDir.getAbsolutePath()+"/", false); Assert.assertTrue(new File(tDir + "/" + sampleName + "_FullGenome.png").exists()); Assert.assertTrue(new File(tDir + "/" + sampleName + "_FullGenome.png").length() > 0); }

Target:
public void testAlleleFractionPlotting() throws IOException { final File SNP_COUNTS_FILE = new File("src/test/resources/org/broadinstitute/hellbender/utils/plotter/snps.tsv"); final File SEGMENTS_FILE = new File("src/test/resources/org/broadinstitute/hellbender/utils/plotter/allelic.seg"); String sampleName = "HCC1143"; File tDir = IOUtils.tempDir("Test", "Plotting"); AlleleFractionSegmentedPlotter.writeSegmentedAlleleFractionPlot(sampleName, SNP_COUNTS_FILE.getAbsolutePath(), SEGMENTS_FILE.getAbsolutePath(), tDir.getAbsolutePath()+"/", false); Assert.assertTrue(new File(tDir + "/" + sampleName + "_FullGenome.png").exists()); Assert.assertTrue(new File(tDir + "/" + sampleName + "_FullGenome.png").length() > 0); }
Source:
private void marshallDiagramWithNewMarshaller() { try { new_diagram = unmarshall(newMarshaller, getBpmnTaskFilePath()); new_roundTripDiagram = unmarshall(newMarshaller, getStream(newMarshaller.marshall(new_diagram))); } catch (Exception e) { e.printStackTrace(); } }

Target:
private void marshallDiagramWithNewMarshaller() throws Exception { setNewDiagram(unmarshall(newMarshaller, getBpmnTaskFilePath())); setNewRoundTripDiagram(unmarshall(newMarshaller, getStream(newMarshaller.marshall(getNewDiagram())))); }
Source:
private ServiceInfo getAssertionConsumerServiceInfoByUrl(AuthnRequest request) { String assertionConsumerServiceURL = request.getAssertionConsumerServiceURL(); List<ServiceInfo> infos = assertionConsumerServices .values() .stream() .filter(service -> assertionConsumerServiceURL.equals(service.getUrl())) .collect(Collectors.toList()); ServiceInfo si = null; if (!infos.isEmpty()) { si = infos .stream() .filter(service -> service.getBinding().getUri().equals(SamlProtocol.POST_BINDING)) .findFirst() .orElse(null); } if (si != null) { return si; } else { return new ServiceInfo( assertionConsumerServiceURL, Binding.from(request.getProtocolBinding()), null); } }

Target:
private ServiceInfo getAssertionConsumerServiceInfoByUrl(AuthnRequest request) { return getACS(s -> request.getAssertionConsumerServiceURL().equals(s.getUrl())); }
Source:
protected void executeCommand() { StoragePoolIsoMap map = getStoragePoolIsoMap(); changeStorageDomainStatusInTransaction(map,StorageDomainStatus.Locked); boolean hasConnectStorageSucceeded = connectToStorage(); VDSReturnValue returnValueUpdatedStorageDomain = null; if(!hasConnectStorageSucceeded) { setSucceeded(false); VdcFault f = new VdcFault(); f.setError(VdcBllErrors.StorageServerConnectionError); getReturnValue().setFault(f); changeStorageDomainStatusInTransaction(map,StorageDomainStatus.Maintenance); return; } returnValueUpdatedStorageDomain = updateStatsForDomain(); if (returnValueUpdatedStorageDomain.getSucceeded()) { final StorageDomain updatedStorageDomain = (StorageDomain) returnValueUpdatedStorageDomain.getReturnValue(); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getStorageConnDao().update(getParameters().getStorageServerConnection()); getStorageDomainDynamicDao().update(updatedStorageDomain.getStorageDynamicData()); return null; } }); setSucceeded(true); } changeStorageDomainStatusInTransaction(map,StorageDomainStatus.Maintenance); }

Target:
protected void executeCommand() { StoragePoolIsoMap map = getStoragePoolIsoMap(); changeStorageDomainStatusInTransaction(map, StorageDomainStatus.Locked); boolean hasConnectStorageSucceeded = connectToStorage(); VDSReturnValue returnValueUpdatedStorageDomain = null; if(!hasConnectStorageSucceeded) { setSucceeded(false); VdcFault f = new VdcFault(); f.setError(VdcBllErrors.StorageServerConnectionError); getReturnValue().setFault(f); return; } returnValueUpdatedStorageDomain = updateStatsForDomain(); if (returnValueUpdatedStorageDomain.getSucceeded()) { final StorageDomain updatedStorageDomain = (StorageDomain) returnValueUpdatedStorageDomain.getReturnValue(); executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { getStorageConnDao().update(getParameters().getStorageServerConnection()); getStorageDomainDynamicDao().update(updatedStorageDomain.getStorageDynamicData()); return null; } }); setSucceeded(true); } updateStatus(map, StorageDomainStatus.Maintenance); }
Source:
private void deleteNotifications(List<String> ids) { if (ids.isEmpty()) { return; } List<Filter> idsToDelete = new ArrayList<>(); ids.forEach(id -> idsToDelete.add(filterBuilder.attribute("id").is().equalTo().text(id))); try { persistentStore.delete( PersistenceType.NOTIFICATION_TYPE.toString(), ECQL.toCQL(filterBuilder.anyOf(idsToDelete))); } catch (PersistenceException e) { LOGGER.info( "PersistenceException while trying to delete persisted notifications with ids ", ids, e); } }

Target:
private void deleteNotifications(List<String> ids) { if (ids.isEmpty()) { LOGGER.debug("Received empty list of notification ids to delete"); return; } List<Filter> idsToDelete = ids.stream() .map(id -> filterBuilder.attribute("id").is().equalTo().text(id)) .collect(Collectors.toList()); try { persistentStore.delete( PersistenceType.NOTIFICATION_TYPE.toString(), ECQL.toCQL(filterBuilder.anyOf(idsToDelete))); } catch (PersistenceException e) { LOGGER.debug( "PersistenceException while trying to delete persisted notifications with ids ", ids, e); } }
Source:
void processEntry(CanonicalTreeParser m, DirCacheBuildIterator i, WorkingTreeIterator f) throws IOException { if (m != null) { checkValidPath(m); if (i == null) { if (f != null && !FileMode.TREE.equals(f.getEntryFileMode()) && !f.isEntryIgnored()) { if (failOnConflict) { conflicts.add(walk.getPathString()); } else { update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } } else update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (f == null || !m.idEqual(i)) { update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (i.getDirCacheEntry() != null) { if (f.isModified(i.getDirCacheEntry(), true, this.walk.getObjectReader()) || i.getDirCacheEntry().getStage() != 0) update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); else { DirCacheEntry entry = i.getDirCacheEntry(); if (entry.getLastModifiedInstant() == null) { entry.setLastModified(f.getEntryLastModifiedInstant()); } keep(entry); } } else keep(i.getDirCacheEntry()); } else { if (f != null) { if (walk.isDirectoryFileConflict()) { conflicts.add(walk.getPathString()); } else { if (i != null) { remove(i.getEntryPathString()); conflicts.remove(i.getEntryPathString()); } else { } } } else { } } }

Target:
void processEntry(CanonicalTreeParser m, DirCacheBuildIterator i, WorkingTreeIterator f) throws IOException { if (m != null) { checkValidPath(m); if (i == null) { if (f != null && !FileMode.TREE.equals(f.getEntryFileMode()) && !f.isEntryIgnored()) { if (failOnConflict) { conflicts.add(walk.getPathString()); } else { update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } } else update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (f == null || !m.idEqual(i)) { update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); } else if (i.getDirCacheEntry() != null) { if (f.isModified(i.getDirCacheEntry(), true, this.walk.getObjectReader()) || i.getDirCacheEntry().getStage() != 0) update(m.getEntryPathString(), m.getEntryObjectId(), m.getEntryFileMode()); else { DirCacheEntry entry = i.getDirCacheEntry(); Instant mtime = entry.getLastModifiedInstant(); if (mtime == null || mtime.equals(Instant.EPOCH)) { entry.setLastModified(f.getEntryLastModifiedInstant()); } keep(entry); } } else keep(i.getDirCacheEntry()); } else { if (f != null) { if (walk.isDirectoryFileConflict()) { conflicts.add(walk.getPathString()); } else { if (i != null) { remove(i.getEntryPathString()); conflicts.remove(i.getEntryPathString()); } else { } } } else { } } }
Source:
public void managePermissionCanChangeUsageStatistics() throws Exception { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() .grant(Jenkins.MANAGE, Jenkins.READ).everywhere().toEveryone()); boolean previousValue = j.jenkins.isUsageStatisticsCollected(); HtmlForm form = j.createWebClient().goTo("configure").getFormByName("config"); form.getInputByName("_.usageStatisticsCollected").setChecked(!previousValue); j.submit(form); assertThat("Can set UsageStadistics", j.jenkins.isUsageStatisticsCollected(), not(previousValue)); }

Target:
public void managePermissionCanChangeUsageStatistics() throws Exception { j.jenkins.setSecurityRealm(j.createDummySecurityRealm()); j.jenkins.setAuthorizationStrategy(new MockAuthorizationStrategy() .grant(Jenkins.MANAGE, Jenkins.READ).everywhere().toEveryone()); boolean previousValue = j.jenkins.isUsageStatisticsCollected(); HtmlForm form = j.createWebClient().goTo("configure").getFormByName("config"); form.getInputByName("_.usageStatisticsCollected").setChecked(!previousValue); j.submit(form); assertThat("Can set UsageStatistics", j.jenkins.isUsageStatisticsCollected(), not(previousValue)); }
Source:
protected AbstractTextZoomHandler(int fontSizeOffset) { fFontDiff= fontSizeOffset; }

Target:
protected AbstractTextZoomHandler(int fontSizeOffset) { fFontSizeOffset= fontSizeOffset; }
Source:
public static Permissionable findParentPermissionable(String parent) throws DotDataException { Permissionable permissionableParent = null; try { User systemUser = APILocator.getUserAPI().getSystemUser(); Identifier iden = APILocator.getIdentifierAPI().find(parent); if(UtilMethods.isSet(iden) && UtilMethods.isSet(iden.getAssetType())){ if(iden.getAssetType().equals("folder")){ permissionableParent = APILocator.getFolderAPI().find(parent,systemUser,false); }else{ Contentlet contentlet = APILocator.getContentletAPI() .search("+identifier:" + parent + " +working:true", 1, 0, null, systemUser, false) .get(0); if (contentlet.isHost()) { permissionableParent = contentlet; } else { permissionableParent = contentlet.getParentPermissionable(); } } } else { throw new DotDataException("Parent Identifier: " + parent + " does NOT exist."); } } catch (DotSecurityException e) { Logger.error(Rule.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } return permissionableParent; }

Target:
public static Permissionable findParentPermissionable(String parent) throws DotDataException { Permissionable permissionableParent = null; try { User systemUser = APILocator.getUserAPI().getSystemUser(); Identifier iden = APILocator.getIdentifierAPI().find(parent); if(UtilMethods.isSet(iden) && UtilMethods.isSet(iden.getAssetType())){ if(iden.getAssetType().equals("folder")){ permissionableParent = APILocator.getFolderAPI().find(parent,systemUser,false); }else{ Contentlet contentlet = APILocator.getContentletAPI() .search("+identifier:" + parent + " +working:true", 1, 0, null, systemUser, false) .get(0); if (contentlet.isHost()) { permissionableParent = contentlet; } else { permissionableParent = contentlet.getParentPermissionable(); } } } else { throw new DotDataException("Parent Identifier: " + parent + " does NOT exist."); } } catch (DotSecurityException | IndexOutOfBoundsException e) { Logger.error(Rule.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } return permissionableParent; }
Source:
public boolean filter(RowData row) { if (notNullCheck) { for (int index : notNullFieldIndices) { if (row.isNullAt(index)) { if (notNullEnforcer == NotNullEnforcer.ERROR) { String optionKey = ExecutionConfigOptions.TABLE_EXEC_SINK_NOT_NULL_ENFORCER.key(); throw new TableException( String.format("Column '%s' is NOT NULL, however, a null value is being written into it. " + "You can set job configuration '" + optionKey + "'='drop' " + "to suppress this exception and drop such records silently.", allFieldNames[index])); } else { return false; } } } } return true; }

Target:
public boolean filter(RowData row) { if (!notNullCheck) { return true; } for (int index : notNullFieldIndices) { if (row.isNullAt(index)) { if (notNullEnforcer == NotNullEnforcer.ERROR) { String optionKey = ExecutionConfigOptions.TABLE_EXEC_SINK_NOT_NULL_ENFORCER.key(); throw new TableException( String.format("Column '%s' is NOT NULL, however, a null value is being written into it. " + "You can set job configuration '" + optionKey + "'='drop' " + "to suppress this exception and drop such records silently.", allFieldNames[index])); } else { return false; } } } return true; }
Source:
public long getConflictSetAndCommit(ConflictSetInfo conflictSet) { if (TransactionalContext.isInNestedTransaction()) { getParentContext().addTransaction(this); commitAddress = AbstractTransactionalContext.FOLDED_ADDRESS; log.trace("Commit[{}] Folded into {}", this, getParentContext()); return commitAddress; } if (getWriteSetInfo().getWriteSet().getEntryMap().isEmpty()) { log.trace("Commit[{}] Read-only commit (no write)", this); return NOWRITE_ADDRESS; } Set<UUID> affectedStreamsIds = new HashSet<>(getWriteSetInfo() .getWriteSet().getEntryMap().keySet()); Set<UUID> streamTags = new HashSet<>(); affectedStreamsIds.forEach( s -> { if (streamToProxyMap.containsKey(s)) { streamTags.addAll(streamToProxyMap.get(s).getStreamTags()); } }); affectedStreamsIds.addAll(streamTags); if (this.transaction.isLoggingEnabled()) { affectedStreamsIds.add(TRANSACTION_STREAM_ID); } UUID[] affectedStreams = affectedStreamsIds.toArray(new UUID[affectedStreamsIds.size()]); long address = -1L; final TxResolutionInfo txInfo = new TxResolutionInfo(getTransactionID(), getSnapshotTimestamp(), conflictSet.getHashedConflictSet(), getWriteSetInfo().getHashedConflictSet()); try { address = this.transaction.runtime.getStreamsView() .append( collectWriteSetEntries(), txInfo, affectedStreams ); } catch (AppendException oe) { throw new TransactionAbortedException(txInfo, AbortCause.OVERWRITE, oe, this); } log.trace("Commit[{}] Acquire address {}", this, address); super.commitTransaction(); commitAddress = address; log.trace("Commit[{}] Written to {}", this, address); return address; }

Target:
public long getConflictSetAndCommit(ConflictSetInfo conflictSet) { if (TransactionalContext.isInNestedTransaction()) { getParentContext().addTransaction(this); commitAddress = AbstractTransactionalContext.FOLDED_ADDRESS; log.trace("Commit[{}] Folded into {}", this, getParentContext()); return commitAddress; } if (getWriteSetInfo().getWriteSet().getEntryMap().isEmpty()) { log.trace("Commit[{}] Read-only commit (no write)", this); return NOWRITE_ADDRESS; } Set<UUID> affectedStreamsIds = new HashSet<>(getWriteSetInfo() .getWriteSet().getEntryMap().keySet()); modifiedProxies.forEach( p -> { affectedStreamsIds.addAll(p.getStreamTags()); }); UUID[] affectedStreams = affectedStreamsIds.toArray(new UUID[affectedStreamsIds.size()]); long address = -1L; final TxResolutionInfo txInfo = new TxResolutionInfo(getTrFansactionID(), getSnapshotTimestamp(), conflictSet.getHashedConflictSet(), getWriteSetInfo().getHashedConflictSet()); try { address = this.transaction.runtime.getStreamsView() .append( collectWriteSetEntries(), txInfo, affectedStreams ); } catch (AppendException oe) { throw new TransactionAbortedException(txInfo, AbortCause.OVERWRITE, oe, this); } log.trace("Commit[{}] Acquire address {}", this, address); super.commitTransaction(); commitAddress = address; log.trace("Commit[{}] Written to {}", this, address); return address; }
Source:
public DeleteAMapComponentObject deleteMap() { waitForElementByElement(actionDropDown); Actions actions = new Actions(driver); actions .click(actionDropDown) .click(deleteMapButton) .build() .perform(); return new DeleteAMapComponentObject(driver); }

Target:
public DeleteAMapComponentObject deleteMap() { waitForElementByElement(actionDropDown); actionDropDown.click(); deleteMapButton.click(); return new DeleteAMapComponentObject(driver); }
Source:
public @Nullable CauseOfBlockage canRun(Queue.Item item) { return null; }

Target:
public @CheckForNull CauseOfBlockage canRun(Queue.Item item) { return null; }
Source:
private API getApi() { ApplicationMode appMode = getCurrent().get(ApplicationMode.class); API api = new API(); api.setTime(DateMapper.map(new Date(), null)); for (DetailedLink detailedLink : getLinks()) { api.getLinks().add(LinkHelper.createLink(detailedLink.getHref(), detailedLink.getRel())); if (detailedLink.isSetLinkCapabilities() && detailedLink.getLinkCapabilities().isSetSearchable() && detailedLink.getLinkCapabilities().isSearchable()) { api.getLinks().add(LinkHelper.createLink(detailedLink.getHref(), detailedLink.getRel(), detailedLink.getRequest().getUrl().getParametersSets())); } api.setSpecialObjects(new SpecialObjects()); if (appMode != ApplicationMode.GlusterOnly) { api.getSpecialObjects().getLinks().add(createBlankTemplateLink()); } api.getSpecialObjects().getLinks().add(createRootTagLink()); } return api; }

Target:
private API getApi() { API api = new API(); api.setTime(DateMapper.map(new Date(), null)); for (DetailedLink detailedLink : getLinks()) { api.getLinks().add(LinkHelper.createLink(detailedLink.getHref(), detailedLink.getRel())); if (detailedLink.isSetLinkCapabilities() && detailedLink.getLinkCapabilities().isSetSearchable() && detailedLink.getLinkCapabilities().isSearchable()) { api.getLinks().add(LinkHelper.createLink(detailedLink.getHref(), detailedLink.getRel(), detailedLink.getRequest().getUrl().getParametersSets())); } api.setSpecialObjects(new SpecialObjects()); api.getSpecialObjects().getLinks().add(createBlankTemplateLink()); api.getSpecialObjects().getLinks().add(createRootTagLink()); } return api; }
Source:
public String[] getUsernames() { Set<String> ret = new HashSet<String>(); ret.addAll(credentials.keySet()); ret.addAll(promptedCredentials); return (String[]) ret.toArray(new String[ret.size()]); }

Target:
public String[] getUsernames() { SortedSet<String> ret = new TreeSet<String>(); ret.addAll(credentials.keySet()); ret.addAll(promptedCredentials); return (String[]) ret.toArray(new String[ret.size()]); }
Source:
private double calculateStepSize() { double maxFeedRate = jogService.getFeedRate(); return (maxFeedRate / 60) * (JOG_COMMAND_INTERVAL / 1000.0) * 1.2; }

Target:
private double calculateStepSize() { double maxFeedRate = jogService.getFeedRate(); return (maxFeedRate / 60.0) * (JOG_COMMAND_INTERVAL / 1000.0) * 1.2; }
Source:
public Operation response(int key, Response response) { this.addResponse(String.valueOf(key),response); this.addResponseObject(String.valueOf(key),response); return this; }

Target:
public Operation response(int key, Response response) { this.addResponseObject(String.valueOf(key),response); return this; }
Source:
private void pushAllCachingStores() { CachingFreenetStore<?>[] cachingStoresSnapshot = null; while(true) { synchronized (cachingStores) { cachingStoresSnapshot = this.cachingStores.toArray(new CachingFreenetStore[cachingStores.size()]); } for(CachingFreenetStore<?> cfs : cachingStoresSnapshot) { int k=0; while(k < numberOfKeysToWrite) { long sizeBlock = cfs.pushLeastRecentlyBlock(); if(sizeBlock == -1) break; synchronized(this) { size -= sizeBlock; assert(size >= 0); if(size < 0) { Logger.error(this, "Cache broken: Size = "+size); size = 0; } if(size == 0) return; } k++; } } } }

Target:
private void pushAllCachingStores() { while(true) { CachingFreenetStore<?>[] cachingStoresSnapshot = null; synchronized (cachingStores) { cachingStoresSnapshot = this.cachingStores.toArray(new CachingFreenetStore[cachingStores.size()]); } for(CachingFreenetStore<?> cfs : cachingStoresSnapshot) { int k=0; while(k < numberOfKeysToWrite) { long sizeBlock = cfs.pushLeastRecentlyBlock(); if(sizeBlock == -1) break; synchronized(this) { size -= sizeBlock; assert(size >= 0); if(size < 0) { Logger.error(this, "Cache broken: Size = "+size); size = 0; } if(size == 0) return; } k++; } } } }