auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private SimplePrincipalCollection createPrincipalCollectionFromCertificate( X500Principal principal) { SimplePrincipalCollection principals = new SimplePrincipalCollection(); DefaultSecurityAssertionBuilder assertionBuilder = new DefaultSecurityAssertionBuilder(); AttributeStatement attributeStatement = new AttributeStatementDefault(); HashMap<String, Object> properties = createProperties(principal); for (ClaimsHandler claimsHandler : claimsHandlers) { ClaimsCollection claims = claimsHandler.retrieveClaims( new ClaimsParametersImpl(principal, Collections.singleton(principal), properties)); mergeClaimsToAttributes(attributeStatement, claims); } SecurityAssertion assertion = assertionBuilder .addAttributeStatement(attributeStatement) .addPrincipal(principal) .weight(SecurityAssertion.LOCAL_AUTH_WEIGHT) .issuer("DDF") .notBefore(new Date()) .notOnOrAfter(new Date(new Date().getTime() + 14400000L)) .build(); principals.add(assertion, "PKI"); return principals; }

Target:
private SimplePrincipalCollection createPrincipalCollectionFromCertificate( X500Principal principal) { SimplePrincipalCollection principals = new SimplePrincipalCollection(); DefaultSecurityAssertionBuilder assertionBuilder = new DefaultSecurityAssertionBuilder(); AttributeStatement attributeStatement = new AttributeStatementDefault(); HashMap<String, Object> properties = createProperties(principal); for (ClaimsHandler claimsHandler : claimsHandlers) { ClaimsCollection claims = claimsHandler.retrieveClaims( new ClaimsParametersImpl(principal, Collections.singleton(principal), properties)); mergeClaimsToAttributes(attributeStatement, claims); } final Instant now = Instant.now(); SecurityAssertion assertion = assertionBuilder .addAttributeStatement(attributeStatement) .addPrincipal(principal) .weight(SecurityAssertion.LOCAL_AUTH_WEIGHT) .issuer("DDF") .notBefore(Date.from(now)) .notOnOrAfter(Date.from(now.plus(fourHours))) .build(); principals.add(assertion, "PKI"); return principals; }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FingerprintIdDetails that = (FingerprintIdDetails) o; if (platformUnit != null ? !platformUnit.equals(that.platformUnit) : that.platformUnit != null) return false; if (runBarcode != null ? !runBarcode.equals(that.runBarcode) : that.runBarcode != null) return false; if (runLane != null ? !runLane.equals(that.runLane) : that.runLane != null) return false; if (molecularBarcode != null ? !molecularBarcode.equals(that.molecularBarcode) : that.molecularBarcode != null) return false; if (library != null ? !library.equals(that.library) : that.library != null) return false; return sample != null ? sample.equals(that.sample) : that.sample == null; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FingerprintIdDetails that = (FingerprintIdDetails) o; if (platformUnit != null ? !platformUnit.equals(that.platformUnit) : that.platformUnit != null) return false; if (runBarcode != null ? !runBarcode.equals(that.runBarcode) : that.runBarcode != null) return false; if (runLane != null ? !runLane.equals(that.runLane) : that.runLane != null) return false; if (molecularBarcode != null ? !molecularBarcode.equals(that.molecularBarcode) : that.molecularBarcode != null) return false; if (library != null ? !library.equals(that.library) : that.library != null) return false; if (file != null ? !file.equals(that.file) : that.file != null) return false; return sample != null ? sample.equals(that.sample) : that.sample == null; }
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addOptionsParamSet(getCallbackParam()); extensionHook.addOptionsChangedListener(this); extensionHook.addSessionListener(this); if (View.isInitialised()) { extensionHook.getHookView().addStatusPanel( getCallbackPanel()); extensionHook.getHookView().addOptionPanel( getOptionsCallbackPanel()); ExtensionHelp.enableHelpKey(getOptionsCallbackPanel(), "ui.tabs.callbacks"); } }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addOptionsParamSet(getCallbackParam()); extensionHook.addOptionsChangedListener(this); extensionHook.addSessionListener(this); if (View.isInitialised()) { extensionHook.getHookView().addStatusPanel( getCallbackPanel()); extensionHook.getHookView().addOptionPanel( getOptionsCallbackPanel()); ExtensionHelp.enableHelpKey(getCallbackPanel(), "ui.tabs.callbacks"); } }
Source:
public NeedsPaging<PatientIdentifier> doGetAll(Patient parent, RequestContext context) throws ResponseException { return new NeedsPaging<PatientIdentifier>(parent.getActiveIdentifiers(), context.getIncludeAll()); }

Target:
public NeedsPaging<PatientIdentifier> doGetAll(Patient parent, RequestContext context) throws ResponseException { if (context.getIncludeAll()) { List<PatientIdentifier> newPatientIdentifier = new ArrayList<PatientIdentifier>(parent.getIdentifiers()); return new NeedsPaging<PatientIdentifier>(newPatientIdentifier, context); } else { return new NeedsPaging<PatientIdentifier>(parent.getActiveIdentifiers(), context); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof CommandImpl)) { return false; } final CommandImpl command = (CommandImpl)obj; return Objects.equals(getName(), command.getName()) && Objects.equals(getCommandLine(), command.getCommandLine()) && Objects.equals(getType(), command.getType()) && Objects.equals(getPreviewUrl(), command.getPreviewUrl()); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof CommandImpl)) { return false; } final CommandImpl command = (CommandImpl)obj; return Objects.equals(name, command.name) && Objects.equals(commandLine, command.commandLine) && Objects.equals(type, command.type) && Objects.equals(previewUrl, command.previewUrl); }
Source:
public void testMergeAnomalyProperties() throws Exception { final long now = System.currentTimeMillis(); final long bucketSize = 300_000; final double parentVal = 1.0, childVal = 2.0; Map<String, String> parentProperties = new HashMap<>(); parentProperties.put("p1", "value1"); parentProperties.put("p2", "value2"); parentProperties.put("detectorComponentName", "rule1"); parentProperties.put("anomalyTimelinesView", generateAnomalyTimelineView(now, bucketSize, 10, parentVal).toJsonString()); Map<String, String> childProperties = new HashMap<>(); childProperties.put("p1", "value3"); childProperties.put("c1", "value4"); childProperties.put("detectorComponentName", "rule2"); childProperties.put("anomalyTimelinesView", generateAnomalyTimelineView(now + bucketSize, bucketSize, 10, childVal).toJsonString()); ThirdEyeUtils.mergeAnomalyProperties(parentProperties, childProperties); Assert.assertEquals(parentProperties.get("p1"), "value1"); Assert.assertEquals(parentProperties.get("p2"), "value2"); Assert.assertEquals(parentProperties.get("c1"), "value4"); Assert.assertEquals(parentProperties.get("detectorComponentName"), "rule1,rule2"); AnomalyTimelinesView merged = AnomalyTimelinesView.fromJsonString(parentProperties.get("anomalyTimelinesView")); Assert.assertEquals(merged.getTimeBuckets().size(), 11); Assert.assertTrue(merged.getCurrentValues().get(0) - parentVal < 0.00001); Assert.assertTrue(merged.getCurrentValues().get(1) - parentVal < 0.00001); Assert.assertTrue(merged.getCurrentValues().get(10) - childVal < 0.00001); }

Target:
public void testMergeAnomalyProperties() { Map<String, String> parentProperties = new HashMap<>(); parentProperties.put("p1", "value1"); parentProperties.put("p2", "value2"); parentProperties.put("detectorComponentName", "rule1"); Map<String, String> childProperties = new HashMap<>(); childProperties.put("p1", "value3"); childProperties.put("c1", "value4"); childProperties.put("detectorComponentName", "rule2"); ThirdEyeUtils.mergeAnomalyProperties(parentProperties, childProperties); Assert.assertEquals(parentProperties.get("p1"), "value1"); Assert.assertEquals(parentProperties.get("p2"), "value2"); Assert.assertEquals(parentProperties.get("c1"), "value4"); Assert.assertEquals(parentProperties.get("detectorComponentName"), "rule1,rule2"); }
Source:
public long getExpirationOffset(Pattern pattern) { long expiration = -1; int index = events.indexOf( pattern ); Interval[] intervals = matrix[index]; for (int i = 0; i < intervals.length; i++) { if (i != index) { expiration = Math.max( expiration, intervals[i].getUpperBound() ); if (expiration == Long.MAX_VALUE) { return expiration; } } } return expiration >= 0 ? expiration+1 : Long.MAX_VALUE; }

Target:
public long getExpirationOffset(Pattern pattern) { int index = events.indexOf( pattern ); Interval[] intervals = matrix[index]; long expiration = IntStream.range( 0, intervals.length ) .filter( i -> i != index ) .mapToLong( i -> intervals[i].getUpperBound() ) .max().orElse( NEVER_EXPIRES ); return expiration >= 0 && expiration != Long.MAX_VALUE ? expiration+1 : NEVER_EXPIRES; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } SymbolicValue other = (SymbolicValue) obj; return this.alwaysNullOrUndefined == other.alwaysNullOrUndefined && Objects.equals(this.truthiness, other.truthiness); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } SymbolicValue other = (SymbolicValue) obj; return this.definitelyNullOrUndefined == other.definitelyNullOrUndefined && Objects.equals(this.truthiness, other.truthiness); }
Source:
private int getTotalNumOfOpenStatusSession(List<FeedbackSessionAttributes> allOpenFeedbackSessionsList) { return (int) allOpenFeedbackSessionsList.stream() .filter(sessionAttributes -> sessionAttributes.isOpened()) .count(); }

Target:
private long getTotalNumOfOpenStatusSession(List<FeedbackSessionAttributes> allOpenFeedbackSessionsList) { return allOpenFeedbackSessionsList.stream() .filter(sessionAttributes -> sessionAttributes.isOpened()) .count(); }
Source:
public void initialize() throws Exception { System.err.println("initialize wait"); Bundle bundle = FrameworkUtil.getBundle(AtsMethodDatabase.class); Assert.assertNotNull("Bundle cannot be null", bundle); int state = bundle.getState(); if (state != Bundle.STARTING || state != Bundle.ACTIVE) { bundle.start(); } System.err.println("Initializing ATS Database"); tempFolder = createTempFolder(); Assert.assertNotNull("TempFolder cannot be null", tempFolder); addResource(tempFolder, bundle, "data/hsql.zip"); addResource(tempFolder, bundle, "data/binary_data.zip"); checkExist(tempFolder, "hsql"); checkExist(tempFolder, "attr"); String dbPath = getDbHomePath(tempFolder, "hsql"); System.setProperty("osee.application.server.data", tempFolder.getAbsolutePath()); ConfigurationAdmin configAdmin = OsgiUtil.getConfigAdmin(); configuration = configAdmin.getConfiguration("org.eclipse.osee.jdbc.internal.osgi.JdbcComponentFactory", null); configuration.update(newConfig(dbPath)); jdbcService = OsgiUtil.getService(JdbcService.class, "(osgi.binding=orcs.jdbc.service)", 5000L); Assert.assertNotNull("Unable to get JdbcService", jdbcService); boolean isAlive = jdbcService.isServerAlive(10000L); Assert.assertEquals("database service is not alive", true, isAlive); }

Target:
public void initialize() throws Exception { Bundle bundle = FrameworkUtil.getBundle(AtsMethodDatabase.class); Assert.assertNotNull("Bundle cannot be null", bundle); int state = bundle.getState(); if (state != Bundle.STARTING || state != Bundle.ACTIVE) { bundle.start(); } System.err.println("Initializing ATS Database"); tempFolder = createTempFolder(); Assert.assertNotNull("TempFolder cannot be null", tempFolder); addResource(tempFolder, bundle, "data/hsql.zip"); addResource(tempFolder, bundle, "data/binary_data.zip"); checkExist(tempFolder, "hsql"); checkExist(tempFolder, "attr"); String dbPath = getDbHomePath(tempFolder, "hsql"); System.setProperty("osee.application.server.data", tempFolder.getAbsolutePath()); ConfigurationAdmin configAdmin = OsgiUtil.getConfigAdmin(); configuration = configAdmin.getConfiguration("org.eclipse.osee.jdbc.internal.osgi.JdbcComponentFactory", null); configuration.update(newConfig(dbPath)); jdbcService = OsgiUtil.getService(JdbcService.class, "(osgi.binding=orcs.jdbc.service)", 5000L); Assert.assertNotNull("Unable to get JdbcService", jdbcService); boolean isAlive = jdbcService.isServerAlive(10000L); Assert.assertEquals("database service is not alive", true, isAlive); }
Source:
protected void addOriginalNameProp(Sheet.Set properties) { if (TextTranslationService.getInstance().hasProvider() && UserPreferences.displayTranslatedFileNames()) { properties.put(new NodeProperty<>( ORIG_NAME_PROP_NAME, ORIG_NAME_PROP_DISPLAY_NAME, "", translatedName != null ? translatedName : "")); if (translatedName == null) { new FileNameTransTask(originalName, this, new NameTranslationListener()).submit(); } } }

Target:
protected void addOriginalNameProp(Sheet.Set properties) { if (TextTranslationService.getInstance().hasProvider() && UserPreferences.displayTranslatedFileNames()) { properties.put(new NodeProperty<>( ORIG_NAME_PROP_NAME, ORIG_NAME_PROP_DISPLAY_NAME, "", translatedName != null ? originalName : "")); if (translatedName == null) { new FileNameTransTask(originalName, this, new NameTranslationListener()).submit(); } } }
Source:
public List<Project> getParentCandidates() throws OrmException, NoSuchProjectException { List<Project.NameKey> r = get(); List<Project> result = new ArrayList<Project>(r.size()); for (Project.NameKey k : r) { result.add(projectControlFactory.controlFor(k).getProject()); } return result; }

Target:
public List<Project> getParentCandidates() throws OrmException, NoSuchProjectException { Set<Project> result = new TreeSet<Project>(); for (Project.NameKey p : projectCache.all()) { try { final ProjectControl control = projectControlFactory.controlFor(p); final Project.NameKey parentK = control.getProject().getParent(); if (parentK != null) { ProjectControl pControl = projectControlFactory.controlFor(parentK); if (pControl.isVisible() || pControl.isOwner()) { result.add(pControl.getProject()); } } } catch (NoSuchProjectException e) { continue; } } result.add(projectControlFactory.controlFor(allProject).getProject()); return new ArrayList<Project>(result); }
Source:
public Map<Long, Set<TObject>> chronologize(long record, String key, AccessToken creds, TransactionToken transaction) throws TException { checkAccess(creds, transaction); Map<Long, Set<TObject>> result = TLinkedHashMap.newTLinkedHashMap(); for (Long timestamp : audit(record, key, creds, transaction).keySet()) { Set<TObject> values = fetch(key, record, timestamp, creds, transaction); if (!values.isEmpty()) { result.put(timestamp, values); } } AtomicOperation operation = null; while (operation == null || !operation.commit()) { operation = updateChronologize(key, record, result, transaction != null ? transactions.get(transaction) : engine); } return result; }

Target:
public Map<Long, Set<TObject>> chronologize(long record, String key, AccessToken creds, TransactionToken transaction) throws TException { checkAccess(creds, transaction); Compoundable store = transaction != null ? transactions.get(transaction): engine; Map<Long, Set<TObject>> result = TLinkedHashMap.newTLinkedHashMap(); for (Long timestamp : store.audit(key, record).keySet()) { Set<TObject> values = store.fetch(key, record, timestamp); if (!values.isEmpty()) { result.put(timestamp, values); } } AtomicOperation operation = null; while (operation == null || !operation.commit()) { operation = updateChronologizeResultSet(key, record, result, store); } return result; }
Source:
ConfElement(StramElement element, ConfElement parent, Set<StramElement> additionalRelatedElements, Class<? extends Context> contextClass) { this.element = element; this.parent = parent; this.allRelatedElements.addAll(additionalRelatedElements); this.allRelatedElements.add(element); this.contextClass = contextClass; if (contextClass != null) { this.contextAttributes = ContextUtils.CONTEXT_CLASS_TO_ATTRIBUTES.get(contextClass); } else { this.contextAttributes = Sets.newHashSet(); } }

Target:
ConfElement(StramElement element, ConfElement parent, Set<StramElement> additionalRelatedElements, Class<? extends Context> contextClass) { this.element = element; this.parent = parent; if (additionalRelatedElements != null) { this.allRelatedElements.addAll(additionalRelatedElements); } this.allRelatedElements.add(element); this.contextClass = contextClass; this.contextAttributes = contextClass != null ? ContextUtils.CONTEXT_CLASS_TO_ATTRIBUTES.get(contextClass) : new HashSet<String>(); }
Source:
public static IMEInventoryHandler getCell( final ItemStack o, final ISaveProvider container2 ) { try { return new CellInventoryHandler( new ItemCellInventory( o, container2 ), AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); } catch( final AppEngException e ) { return null; } }

Target:
public static IMEInventoryHandler getCell( final ItemStack o, final ISaveProvider container2 ) { try { return new ItemCellInventoryHandler( new ItemCellInventory( o, container2 ) ); } catch( final AppEngException e ) { return null; } }
Source:
private String registerClient(String appID, String clientStartupID) { long error = new long [1]; long clientInfo = OS.g_dbus_proxy_call_sync( sessionManagerProxy, Converter.javaStringToCString("RegisterClient"), composeVariantTupleSS(appID, clientStartupID), OS.G_DBUS_CALL_FLAGS_NONE, dbusTimeoutMsec, 0, error); if (clientInfo == 0) return extractFreeGError(error[0]); clientObjectPath = extractVariantTupleS(clientInfo); OS.g_variant_unref(clientInfo); return null; }

Target:
private String registerClient(String appID, String clientStartupID) { long args = OS.g_variant_new( Converter.javaStringToCString("(ss)"), Converter.javaStringToCString(appID), Converter.javaStringToCString(clientStartupID)); long error = new long [1]; long clientInfo = OS.g_dbus_proxy_call_sync( sessionManagerProxy, Converter.javaStringToCString("RegisterClient"), args, OS.G_DBUS_CALL_FLAGS_NONE, dbusTimeoutMsec, 0, error); if (clientInfo == 0) return extractFreeGError(error[0]); clientObjectPath = extractVariantTupleS(clientInfo); OS.g_variant_unref(clientInfo); return null; }
Source:
protected void determineMirror() { IBlockState current = getWorld().getBlockState(getPos()); IProperty<EnumRailDirection> shapeProp = ((BlockRailBase) current.getBlock()).getShapeProperty(); EnumRailDirection dir = current.getValue(shapeProp); boolean prevValue = isMirrored(); if (dir == EnumRailDirection.NORTH_SOUTH) { BlockPos offset = getPos(); if (TrackTools.isRailBlockAt(getWorld(), offset.west())) { offset = offset.west(); mirrored = true; } else { offset = offset.east(); mirrored = false; } if (TrackTools.isRailBlockAt(getWorld(), offset)) { IBlockState otherState = getWorld().getBlockState(getPos()); IProperty<EnumRailDirection> otherShapeProp = ((BlockRailBase) current.getBlock()).getShapeProperty(); EnumRailDirection otherDir = current.getValue(shapeProp); if (otherDir == EnumRailDirection.NORTH_SOUTH) getWorld().setBlockState(offset, otherState.withProperty(otherShapeProp, EnumRailDirection.EAST_WEST)); } } else if (dir == EnumRailDirection.EAST_WEST) mirrored = TrackTools.isRailBlockAt(getWorld(), getPos().north()); if (prevValue != isMirrored()) sendUpdateToClient(); }

Target:
protected void determineMirror() { EnumRailDirection dir = TrackTools.getTrackDirection(getWorld(), getPos()); boolean prevValue = isMirrored(); if (dir == EnumRailDirection.NORTH_SOUTH) { BlockPos offset = getPos(); if (TrackTools.isRailBlockAt(getWorld(), offset.west())) { offset = offset.west(); mirrored = true; } else { offset = offset.east(); mirrored = false; } if (TrackTools.isRailBlockAt(getWorld(), offset)) { EnumRailDirection otherDir = TrackTools.getTrackDirection(getWorld(), offset); if (otherDir == EnumRailDirection.NORTH_SOUTH) TrackTools.setTrackDirection(getWorld(), offset, EnumRailDirection.EAST_WEST); } } else if (dir == EnumRailDirection.EAST_WEST) mirrored = TrackTools.isRailBlockAt(getWorld(), getPos().north()); if (prevValue != isMirrored()) sendUpdateToClient(); }
Source:
void validate(final DirCacheEntry[] cache, final int cCnt, int cIdx, final int pathOff) { if (entrySpan >= 0 && cIdx + entrySpan <= cCnt) { return; } entrySpan = 0; if (cCnt == 0) { return; } final byte[] firstPath = cache[cIdx].path; int stIdx = 0; while (cIdx < cCnt) { final byte[] currPath = cache[cIdx].path; if (pathOff > 0 && !peq(firstPath, currPath, pathOff)) { break; } final int cc; if (stIdx < childCnt) { cc = namecmp(currPath, pathOff, children[stIdx]); if (cc > 0) { removeChild(stIdx); continue; } } else { cc = -1; } final DirCacheTree st; if (cc < 0) { final int p = slash(currPath, pathOff); if (p < 0) { cIdx++; entrySpan++; continue; } st = new DirCacheTree(this, currPath, pathOff, p - pathOff); insertChild(stIdx, st); } else { st = children[stIdx]; } st.validate(cache, cCnt, cIdx, pathOff + st.nameLength() + 1); cIdx += st.entrySpan; entrySpan += st.entrySpan; stIdx++; } while (stIdx < childCnt) removeChild(childCnt - 1); }

Target:
void validate(final DirCacheEntry[] cache, final int cCnt, int cIdx, final int pathOff) { if (entrySpan >= 0 && cIdx + entrySpan <= cCnt) { return; } entrySpan = 0; if (cCnt == 0) { return; } final byte[] firstPath = cache[cIdx].path; int stIdx = 0; while (cIdx < cCnt) { final byte[] currPath = cache[cIdx].path; if (pathOff > 0 && !peq(firstPath, currPath, pathOff)) { break; } DirCacheTree st = stIdx < childCnt ? children[stIdx] : null; final int cc = namecmp(currPath, pathOff, st); if (cc > 0) { removeChild(stIdx); continue; } if (cc < 0) { final int p = slash(currPath, pathOff); if (p < 0) { cIdx++; entrySpan++; continue; } st = new DirCacheTree(this, currPath, pathOff, p - pathOff); insertChild(stIdx, st); } assert(st != null); st.validate(cache, cCnt, cIdx, pathOff + st.nameLength() + 1); cIdx += st.entrySpan; entrySpan += st.entrySpan; stIdx++; } while (stIdx < childCnt) removeChild(childCnt - 1); }
Source:
public void restartFrom(RecordsRetrieved recordsRetrieved) { if (!(recordsRetrieved instanceof PrefetchRecordsRetrieved)) { throw new IllegalArgumentException( "Provided RecordsRetrieved was not produced by the PrefetchRecordsPublisher"); } PrefetchRecordsRetrieved prefetchRecordsRetrieved = (PrefetchRecordsRetrieved) recordsRetrieved; resetLock.writeLock().lock(); try { getRecordsResultQueue.clear(); log.debug("{} : Publisher thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnAck.set(false); prefetchCounters.reset(); highestSequenceNumber = prefetchRecordsRetrieved.lastBatchSequenceNumber(); dataFetcher.resetIterator(prefetchRecordsRetrieved.shardIterator(), highestSequenceNumber, initialPositionInStreamExtended); wasReset = true; } finally { resetLock.writeLock().unlock(); } }

Target:
public void restartFrom(RecordsRetrieved recordsRetrieved) { if (!(recordsRetrieved instanceof PrefetchRecordsRetrieved)) { throw new IllegalArgumentException( "Provided RecordsRetrieved was not produced by the PrefetchRecordsPublisher"); } PrefetchRecordsRetrieved prefetchRecordsRetrieved = (PrefetchRecordsRetrieved) recordsRetrieved; resetLock.writeLock().lock(); try { getRecordsResultQueue.clear(); log.debug("{} : Publisher thread takes over the draining control. Queue Size : {}, Demand : {}", shardId, getRecordsResultQueue.size(), requestedResponses.get()); shouldDrainEventOnlyOnAck.set(false); prefetchCounters.reset(); highestSequenceNumber = prefetchRecordsRetrieved.lastBatchSequenceNumber(); dataFetcher.resetIterator(prefetchRecordsRetrieved.shardIterator(), highestSequenceNumber, initialPositionInStreamExtended); wasReset = true; } finally { resetLock.writeLock().unlock(); } }
Source:
public BulkActionValidation newValidationInstance() { try { return validationClass.getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new RuntimeException("Cannot create validation class of type " + validationClass.getName(), e); } }

Target:
public BulkActionValidation newValidationInstance() { try { return validationClass.getDeclaredConstructor().newInstance(); } catch (ReflectiveOperationException e) { throw new NuxeoException("Cannot create validation class of type " + validationClass.getName(), e); } }
Source:
public JoinHash get() { Optional<JoinFilterFunction> filterFunction = filterFunctionFactory.map(factory -> factory.create(session.toConnectorSession(), addresses, channels)); return new JoinHash( pagesHash, filterFunction, positionLinks.map(links -> { List<JoinFilterFunction> searchFunctions = searchFunctionFactories.stream() .map(factory -> factory.create(session.toConnectorSession(), addresses, channels)) .collect(ImmutableList.toImmutableList()); return links.create(searchFunctions); })); }

Target:
public JoinHash get() { Optional<JoinFilterFunction> filterFunction = filterFunctionFactory.map(factory -> factory.create(session.toConnectorSession(), addresses, channels)); return new JoinHash( pagesHash, filterFunction, positionLinks.map(links -> { List<JoinFilterFunction> searchFunctions = searchFunctionFactories.stream() .map(factory -> factory.create(session.toConnectorSession(), addresses, channels)) .collect(toImmutableList()); return links.create(searchFunctions); })); }
Source:
public void testFullUrl() { Span span = new Span(); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://localhost:8080/my/path"); span.setBinaryAnnotations(Arrays.asList(ba)); URL url = span.url(); assertNotNull(url); assertEquals("/my/path", url.getPath()); }

Target:
public void testFullUrl() throws MalformedURLException { URL url = new URL("http://localhost:8080/my/path"); Span span = new Span(); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue(url.toString()); span.setBinaryAnnotations(Arrays.asList(ba)); URL result = span.url(); assertNotNull(result); assertEquals(url, result); }
Source:
protected void onInitUI() { super.onInitUI(); addressTxt = new NpTextArea(); addressTxt.setVisibleLines(4); addressTxt.setCharacterWidth(60); countryTxt = new NpTextBox(); countryTxt.setVisibleLength(40); countryTxt.setMaxLength(40); phoneTxt = new NpTextBox(); phoneTxt.setVisibleLength(30); phoneTxt.setMaxLength(30); faxTxt = new NpTextBox(); faxTxt.setVisibleLength(30); faxTxt.setMaxLength(30); final Grid infoSecure = new Grid(4, 2); infoSecure.setStyleName(Gerrit.RESOURCES.css().infoBlock()); infoSecure.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock()); final HTML privhtml = new HTML(Util.C.contactPrivacyDetailsHtml()); privhtml.setStyleName(Gerrit.RESOURCES.css().accountContactPrivacyDetails()); hasContact = new Label(); hasContact.setStyleName(Gerrit.RESOURCES.css().accountContactOnFile()); hasContact.setVisible(false); if (Gerrit.getConfig().isUseContactInfo()) { body.add(privhtml); body.add(hasContact); body.add(infoSecure); } row(infoSecure, 0, Util.C.contactFieldAddress(), addressTxt); row(infoSecure, 1, Util.C.contactFieldCountry(), countryTxt); row(infoSecure, 2, Util.C.contactFieldPhone(), phoneTxt); row(infoSecure, 3, Util.C.contactFieldFax(), faxTxt); infoSecure.getCellFormatter().addStyleName(0, 0, Gerrit.RESOURCES.css().topmost()); infoSecure.getCellFormatter().addStyleName(0, 1, Gerrit.RESOURCES.css().topmost()); infoSecure.getCellFormatter().addStyleName(3, 0, Gerrit.RESOURCES.css().bottomheader()); final OnEditEnabler sbl = new OnEditEnabler(save, addressTxt); sbl.listenTo(countryTxt); sbl.listenTo(phoneTxt); sbl.listenTo(faxTxt); }

Target:
protected void onInitUI() { super.onInitUI(); addressTxt = new NpTextArea(); addressTxt.setVisibleLines(4); addressTxt.setCharacterWidth(60); countryTxt = new NpTextBox(); countryTxt.setVisibleLength(40); countryTxt.setMaxLength(40); phoneTxt = new NpTextBox(); phoneTxt.setVisibleLength(30); phoneTxt.setMaxLength(30); faxTxt = new NpTextBox(); faxTxt.setVisibleLength(30); faxTxt.setMaxLength(30); final Grid infoSecure = new Grid(4, 2); infoSecure.setStyleName(Gerrit.RESOURCES.css().infoBlock()); infoSecure.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock()); final HTML privhtml = new HTML(Util.C.contactPrivacyDetailsHtml()); privhtml.setStyleName(Gerrit.RESOURCES.css().accountContactPrivacyDetails()); hasContact = new Label(); hasContact.setStyleName(Gerrit.RESOURCES.css().accountContactOnFile()); hasContact.setVisible(false); if (Gerrit.getConfig().isUseContactInfo()) { body.add(privhtml); body.add(hasContact); body.add(infoSecure); } row(infoSecure, 0, Util.C.contactFieldAddress(), addressTxt); row(infoSecure, 1, Util.C.contactFieldCountry(), countryTxt); row(infoSecure, 2, Util.C.contactFieldPhone(), phoneTxt); row(infoSecure, 3, Util.C.contactFieldFax(), faxTxt); infoSecure.getCellFormatter().addStyleName(0, 0, Gerrit.RESOURCES.css().topmost()); infoSecure.getCellFormatter().addStyleName(0, 1, Gerrit.RESOURCES.css().topmost()); infoSecure.getCellFormatter().addStyleName(3, 0, Gerrit.RESOURCES.css().bottomheader()); final OnEditEnabler sbl = new OnEditEnabler(save); sbl.listenTo(addressTxt); sbl.listenTo(countryTxt); sbl.listenTo(phoneTxt); sbl.listenTo(faxTxt); }
Source:
LogSegment(String name, File file, long capacityInBytes, StoreMetrics metrics) throws IOException { if (!file.exists() || !file.isFile()) { throw new IllegalArgumentException(file.getAbsolutePath() + " does not exist or is not a file"); } this.file = file; this.name = name; this.capacityInBytes = capacityInBytes; this.metrics = metrics; fileChannel = Utils.openChannel(file, true); segmentView = new Pair<>(file, fileChannel); state = State.FREE; endOffset = new AtomicLong(0); }

Target:
LogSegment(String name, File file, long capacityInBytes, StoreMetrics metrics) throws IOException { if (!file.exists() || !file.isFile()) { throw new IllegalArgumentException(file.getAbsolutePath() + " does not exist or is not a file"); } this.file = file; this.name = name; this.capacityInBytes = capacityInBytes; this.metrics = metrics; fileChannel = Utils.openChannel(file, true); segmentView = new Pair<>(file, fileChannel); endOffset = new AtomicLong(0); }
Source:
public void processPullReply(final K key, final V value) { final PullFuture<V> future = pendingPulls.get(key); if (future != null) { future.setValue(value); } else { throw new RuntimeException(String.format("Pending pull was not found for key %s", key)); } }

Target:
void processPullReply(final K key, final V value) { final PullFuture<V> future = pendingPulls.get(key); if (future != null) { future.setValue(value); } else { throw new RuntimeException(String.format("Pending pull was not found for key %s", key)); } }
Source:
public void removeContainerAgent(String containerId) { LOG.debug("Removing container agent {}", containerId); StreamingContainerAgent containerAgent = containers.remove(containerId); if (containerHeartBeatMissSet.contains(containerId)) { containerHeartBeatMissSet.remove(containerId); } if (containerAgent != null) { for (PTOperator oper : containerAgent.container.getOperators()) { StramEvent ev = new StramEvent.StopOperatorEvent(oper.getName(), oper.getId(), containerId); recordEventAsync(ev); } containerAgent.container.setFinishedTime(System.currentTimeMillis()); containerAgent.container.setState(PTContainer.State.KILLED); completedContainers.put(containerId, containerAgent.getContainerInfo()); } }

Target:
public void removeContainerAgent(String containerId) { LOG.debug("Removing container agent {}", containerId); StreamingContainerAgent containerAgent = containers.remove(containerId); if (containerAgent != null) { for (PTOperator oper : containerAgent.container.getOperators()) { StramEvent ev = new StramEvent.StopOperatorEvent(oper.getName(), oper.getId(), containerId); recordEventAsync(ev); } containerAgent.container.setFinishedTime(System.currentTimeMillis()); containerAgent.container.setState(PTContainer.State.KILLED); completedContainers.put(containerId, containerAgent.getContainerInfo()); } }
Source:
public boolean deserializeZxidDigest(InputArchive ia, long startZxidOfSnapshot) throws IOException { if (!DigestCalculator.digestEnabled()) { return false; } try { ZxidDigest zxidDigest = new ZxidDigest(); zxidDigest.deserialize(ia); if (zxidDigest.zxid > 0) { digestFromLoadedSnapshot = zxidDigest; LOG.info("The digest in the snapshot is {}, 0x{}, {}", digestFromLoadedSnapshot.digestVersion, Long.toHexString(digestFromLoadedSnapshot.zxid), digestFromLoadedSnapshot.digest); } else { digestFromLoadedSnapshot = null; LOG.info("The digest value is empty in snapshot"); } if (digestFromLoadedSnapshot != null && digestFromLoadedSnapshot.zxid < startZxidOfSnapshot) { LOG.info("The zxid of snapshot digest 0x{} is smaller " + "than the known snapshot highest zxid, the snapshot " + "started with zxid 0x{}. It will be invalid to use " + "this snapshot digest associated with this zxid, will " + "ignore comparing it.", Long.toHexString(digestFromLoadedSnapshot.zxid), Long.toHexString(startZxidOfSnapshot)); digestFromLoadedSnapshot = null; } return true; } catch (EOFException e) { LOG.warn("Got EOF exception while reading the digest, " + "likely due to the reading an older snapshot."); return false; } }

Target:
public boolean deserializeZxidDigest(InputArchive ia, long startZxidOfSnapshot) throws IOException { if (!ZooKeeperServer.isDigestEnabled()) { return false; } try { ZxidDigest zxidDigest = new ZxidDigest(); zxidDigest.deserialize(ia); if (zxidDigest.zxid > 0) { digestFromLoadedSnapshot = zxidDigest; LOG.info("The digest in the snapshot has digest version of {}, " + ", with zxid as 0x{}, and digest value as {}", digestFromLoadedSnapshot.digestVersion, Long.toHexString(digestFromLoadedSnapshot.zxid), digestFromLoadedSnapshot.digest); } else { digestFromLoadedSnapshot = null; LOG.info("The digest value is empty in snapshot"); } if (digestFromLoadedSnapshot != null && digestFromLoadedSnapshot.zxid < startZxidOfSnapshot) { LOG.info("The zxid of snapshot digest 0x{} is smaller " + "than the known snapshot highest zxid, the snapshot " + "started with zxid 0x{}. It will be invalid to use " + "this snapshot digest associated with this zxid, will " + "ignore comparing it.", Long.toHexString(digestFromLoadedSnapshot.zxid), Long.toHexString(startZxidOfSnapshot)); digestFromLoadedSnapshot = null; } return true; } catch (EOFException e) { LOG.warn("Got EOF exception while reading the digest, likely due to the reading an older snapshot."); return false; } }
Source:
private Collection<CommandParameter> getDiagramTypesCreation() { final Collection<CommandParameter> result = new HashSet<CommandParameter>(); for (final IDiagramTypeDescriptor diagramTypeDescriptor : DiagramTypeDescriptorRegistry.getInstance().getAllDiagramTypeDescriptors()) { DiagramDescription specificDiagramDescription = diagramTypeDescriptor.getDiagramDescriptionProvider().createDiagramDescription(); if (specificDiagramDescription.getDefaultLayer() == null) { specificDiagramDescription.setDefaultLayer(DescriptionFactory.eINSTANCE.createLayer()); } final CommandParameter typeCommandParameter = new CommandParameter(null, DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATIONS, specificDiagramDescription); result.add(typeCommandParameter); } return result; }

Target:
private Collection<CommandParameter> getDiagramTypesCreation() { final Collection<CommandParameter> result = new HashSet<CommandParameter>(); for (final IDiagramTypeDescriptor diagramTypeDescriptor : DiagramTypeDescriptorRegistry.getInstance().getAllDiagramTypeDescriptors()) { DiagramDescription specificDiagramDescription = diagramTypeDescriptor.getDiagramDescriptionProvider().createDiagramDescription(); if (specificDiagramDescription.getDefaultLayer() == null) { Layer layer = DescriptionFactory.eINSTANCE.createLayer(); layer.setName("Default"); specificDiagramDescription.setDefaultLayer(layer); } final CommandParameter typeCommandParameter = new CommandParameter(null, DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATIONS, specificDiagramDescription); result.add(typeCommandParameter); } return result; }
Source:
public void onFetched(FlurryAdInterstitial adInterstitial) { Log.d(LOG_TAG, "onFetched(" + adInterstitial.toString() + ")"); if (mListener != null) { mListener.onInterstitialLoaded(); } }

Target:
public void onFetched(FlurryAdInterstitial adInterstitial) { Log.d(LOG_TAG, "onFetched: Flurry interstitial ad fetched successfully!"); if (mListener != null) { mListener.onInterstitialLoaded(); } }
Source:
public void onMinecartPass(EntityMinecart cart) { if (!isPowered() && !theWorldAsserted().getBlockState(getPos().down()).getBlock().isVisuallyOpaque()) { if (cart.isBeingRidden()) { CartTools.removePassengers(cart, cart.getPositionVector().addVector(0, -2, 0)); } cart.getEntityData().setInteger("MountPrevention", TIME_TILL_NEXT_MOUNT); } }

Target:
public void onMinecartPass(EntityMinecart cart) { if (isPowered()) return; World world = theWorldAsserted(); BlockPos.PooledMutableBlockPos pos = BlockPos.PooledMutableBlockPos.retain().setPos(getTile().getPos()); for (int i = 0; i < 2; i++) { pos.move(EnumFacing.DOWN); if (world.getBlockState(pos).getBlock().isVisuallyOpaque()) return; } if (cart.isBeingRidden()) { CartTools.removePassengers(cart, cart.getPositionVector().addVector(0, -2, 0)); } cart.getEntityData().setInteger("MountPrevention", TIME_TILL_NEXT_MOUNT); }
Source:
public ResponseEntity<List<VocabularyDTO>> suggestLicenses(@RequestParam("userId") Long userId) { ENDING licenses are added -> do not need to suggest final List<VocabularyDTO> vocabularies = vocabularyConversionService.getUnavailableVocabularies(userId, true); return ResponseEntity.ok(vocabularies); }

Target:
public List<VocabularyDTO> suggestLicenses(@RequestParam("userId") Long userId) { ENDING licenses are added -> do not need to suggest final List<VocabularyDTO> vocabularies = vocabularyConversionService.getUnavailableVocabularies(userId, true); return vocabularies; }
Source:
public void forceGroupStructureSynchronization(PerunSession sess, Group group) throws InternalErrorException, GroupNotExistsException, PrivilegeException, GroupStructureSynchronizationAlreadyRunningException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "synchronizeGroupStructure"); } getGroupsManagerBl().forceGroupStructureSynchronization(sess, group); }

Target:
public void forceGroupStructureSynchronization(PerunSession sess, Group group) throws InternalErrorException, GroupNotExistsException, PrivilegeException, GroupStructureSynchronizationAlreadyRunningException { Utils.checkPerunSession(sess); getGroupsManagerBl().checkGroupExists(sess, group); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, group) && !AuthzResolver.isAuthorized(sess, Role.GROUPADMIN, group)) { throw new PrivilegeException(sess, "forceGroupStructureSynchronization"); } getGroupsManagerBl().forceGroupStructureSynchronization(sess, group); }
Source:
public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = new Base64().decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(decodedContent)); return new String(decrypted, ASCII); }

Target:
public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = UrlBase64.decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(decodedContent)); return new String(decrypted, ASCII); }
Source:
public void start(final Environment env) { startThread(new CommandRunnable() { @Override public void run() throws Exception { if (!currentUser.getCapabilities().canCreateProject()) { String msg = String.format( "fatal: %s does not have \"Create Project\" capability.", currentUser.getUserName()); throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, msg); } parseCommandLine(); if (!suggestParent) { if (projectName == null) { throw new Failure(1, "fatal: Option \"--name (-n)\" is required"); } try { final CreateProjectArgs args = new CreateProjectArgs(); args.setProjectName(projectName); args.setOwnerIds(ownerIds); args.setNewParent(newParent); args.setPermissionsOnly(permissionsOnly); args.setProjectDescription(projectDescription); args.setSubmitType(submitType); args.setContributorAgreements(contributorAgreements); args.setSignedOffBy(signedOffBy); args.setContentMerge(contentMerge); args.setChangeIdRequired(requireChangeID); args.setBranch(branch); args.setCreateEmptyCommit(createEmptyCommit); final CreateProject createProject = CreateProjectFactory.create(args); createProject.createProject(); } catch (ProjectCreationFailedException err) { throw new UnloggedFailure(1, "fatal: " + err.getMessage(), err); } } else { List<Project> parentCandidates = retrieveParentCandidatesFactory.create().getParentCandidates(); PrintWriter p = toPrintWriter(out); for (Project parent : parentCandidates) { p.print(parent.getNameKey() + "\n"); } p.flush(); } } }); }

Target:
public void start(final Environment env) { startThread(new CommandRunnable() { @Override public void run() throws Exception { if (!currentUser.getCapabilities().canCreateProject()) { String msg = String.format( "fatal: %s does not have \"Create Project\" capability.", currentUser.getUserName()); throw new UnloggedFailure(BaseCommand.STATUS_NOT_ADMIN, msg); } PrintWriter p = toPrintWriter(out); parseCommandLine(); try { if (!suggestParent) { if (projectName == null) { throw new UnloggedFailure(1, "Error: Project name is required."); } final CreateProjectArgs args = new CreateProjectArgs(); args.setProjectName(projectName); args.ownerIds = ownerIds; args.newParent = newParent; args.permissionsOnly = permissionsOnly; args.projectDescription = projectDescription; args.submitType = submitType; args.contributorAgreements = contributorAgreements; args.signedOffBy = signedOffBy; args.contentMerge = contentMerge; args.changeIdRequired = requireChangeID; args.branch = branch; args.createEmptyCommit = createEmptyCommit; final CreateProject createProject = CreateProjectFactory.create(args); createProject.createProject(); } else { List<Project.NameKey> parentCandidates = retrieveParentCandidatesFactory.create().get(); for (Project.NameKey parent : parentCandidates) { p.print(parent + "\n"); } } } catch (ProjectCreationFailedException err) { throw new UnloggedFailure(1, "Fatal: " + err.getMessage(), err); } finally { p.flush(); } } }); }
Source:
public void createTestByUnauthorizedUser() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .withLogo("ThisIsSomeDummyText") .build(); ObjectMapper mapper = new ObjectMapper(); CollectionRest collectionRest = new CollectionRest(); collectionRest.setName("Collection"); collectionRest.setMetadata(new MetadataRest() .put("dc.description", new MetadataValueRest("<p>Some cool HTML code here</p>")) .put("dc.description.abstract", new MetadataValueRest("Sample top-level community created via the REST API")) .put("dc.description.tableofcontents", new MetadataValueRest("<p>HTML News</p>")) .put("dc.rights", new MetadataValueRest("Custom Copyright Text")) .put("dc.title", new MetadataValueRest("Title Text"))); context.setCurrentUser(eperson); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(post("/api/core/collections") .content(mapper.writeValueAsBytes(collectionRest)) .param("parent", parentCommunity.getID().toString()) .contentType(contentType)) .andExpect(status().isForbidden()); }

Target:
public void createTestByUnauthorizedUser() throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context) .withName("Parent Community") .withLogo("ThisIsSomeDummyText") .build(); ObjectMapper mapper = new ObjectMapper(); CollectionRest collectionRest = new CollectionRest(); collectionRest.setName("Collection"); collectionRest.setMetadata(new MetadataRest() .put("dc.description", new MetadataValueRest("<p>Some cool HTML code here</p>")) .put("dc.description.abstract", new MetadataValueRest("Sample top-level community created via the REST API")) .put("dc.description.tableofcontents", new MetadataValueRest("<p>HTML News</p>")) .put("dc.rights", new MetadataValueRest("Custom Copyright Text")) .put("dc.title", new MetadataValueRest("Title Text"))); context.setCurrentUser(eperson); context.restoreAuthSystemState(); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(post("/api/core/collections") .content(mapper.writeValueAsBytes(collectionRest)) .param("parent", parentCommunity.getID().toString()) .contentType(contentType)) .andExpect(status().isForbidden()); }
Source:
public void testShouldAutomagicallyDetectGitDirectory() throws Exception { FileRepository r = createWorkRepository(); File d = new File(r.getDirectory(), "sub-dir"); assertTrue(d.mkdir()); assertEquals(r.getDirectory(), new FileRepositoryBuilder() .findGitDir(d).getGitDir()); }

Target:
public void testShouldAutomagicallyDetectGitDirectory() throws Exception { FileRepository r = createWorkRepository(); File d = new File(r.getDirectory(), "sub-dir"); FileUtils.mkdir(d); assertEquals(r.getDirectory(), new FileRepositoryBuilder() .findGitDir(d).getGitDir()); }
Source:
private void checkForParentModification() { if (this.structuralModificationCount != IonSequenceLite.this.structuralModificationCount) throw new ConcurrentModificationException(); }

Target:
private void checkForParentModification() { if (this.structuralModificationCount != IonSequenceLite.this.structuralModificationCount) { throw new ConcurrentModificationException(); } }