auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void testFirstEntry(ReportVideoCampaign first) { Assert.assertEquals(7848880157L, first.getAccountId().longValue()); Assert.assertEquals("a", first.getAccount()); Assert.assertEquals("a", first.getCampaignName()); Assert.assertEquals("enabled", first.getStatus()); Assert.assertEquals(179512L, first.getImpressions().longValue()); Assert.assertEquals(2295L, first.getViews().longValue()); Assert.assertEquals(73.16, first.getViewPlayed25BigDecimal().doubleValue()); Assert.assertEquals(53.38, first.getViewPlayed50BigDecimal().doubleValue()); Assert.assertEquals(42.15, first.getViewPlayed75BigDecimal().doubleValue()); Assert.assertEquals(41.82, first.getViewPlayed100BigDecimal().doubleValue()); Assert.assertEquals(0.00, first.getCtrBigDecimal().doubleValue()); Assert.assertEquals(0L, first.getWebsiteClicks().longValue()); }

Target:
protected void testFirstEntry(ReportVideoCampaign first) { Assert.assertEquals(123L, first.getAccountId().longValue()); Assert.assertEquals("a", first.getAccount()); Assert.assertEquals("a", first.getCampaignName()); Assert.assertEquals("enabled", first.getStatus()); Assert.assertEquals(179512L, first.getImpressions().longValue()); Assert.assertEquals(2295L, first.getViews().longValue()); Assert.assertEquals(73.16, first.getViewPlayed25BigDecimal().doubleValue()); Assert.assertEquals(53.38, first.getViewPlayed50BigDecimal().doubleValue()); Assert.assertEquals(42.15, first.getViewPlayed75BigDecimal().doubleValue()); Assert.assertEquals(41.82, first.getViewPlayed100BigDecimal().doubleValue()); Assert.assertEquals(0.00, first.getCtrBigDecimal().doubleValue()); Assert.assertEquals(1300L, first.getBudget().longValue()); Assert.assertEquals(0L, first.getWebsiteClicks().longValue()); }
Source:
public ConsistencyLevel getDefaultConsistencyLevel() { DatabaseAccount databaseAccount = this.globalEndpointManager.getDatabaseAccountFromCache(this.serviceEndpoint).block(); return BridgeInternal.getConsistencyPolicy(databaseAccount).getDefaultConsistencyLevel(); }

Target:
public Mono<ConsistencyLevel> getDefaultConsistencyLevel() { return this.globalEndpointManager.getDatabaseAccountFromCache(this.serviceEndpoint).map(databaseAccount -> BridgeInternal.getConsistencyPolicy(databaseAccount).getDefaultConsistencyLevel()); }
Source:
private static Boolean doBeforeAttributeRightsCheck(PerunSession sess, ActionType actionType, AttributeDefinition attrDef) throws InternalErrorException, AttributeNotExistsException { Utils.notNull(sess, "sess"); Utils.notNull(actionType, "ActionType"); Utils.notNull(attrDef, "AttributeDefinition"); getPerunBl().getAttributesManagerBl().checkAttributeExists(sess, attrDef); if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNADMIN)) { return true; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.ENGINE) && actionType.equals(ActionType.READ)) { return true; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNOBSERVER) && (actionType.equals(ActionType.READ) || actionType.equals(ActionType.READ_PUBLIC) || actionType.equals(ActionType.READ_VO))) { return true; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.RPC) && actionType.equals(ActionType.READ)) { return true; } return null; }

Target:
private static Boolean doBeforeAttributeRightsCheck(PerunSession sess, ActionType actionType, AttributeDefinition attrDef) throws InternalErrorException, AttributeNotExistsException { Utils.notNull(sess, "sess"); Utils.notNull(actionType, "ActionType"); Utils.notNull(attrDef, "AttributeDefinition"); getPerunBl().getAttributesManagerBl().checkAttributeExists(sess, attrDef); if (!sess.getPerunPrincipal().isAuthzInitialized()) { refreshAuthz(sess); } if (sess.getPerunPrincipal().getRoles() == null) { return false; } if (sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNADMIN)) { return true; } if ((actionType.equals(ActionType.READ) || actionType.equals(ActionType.READ_PUBLIC) || actionType.equals(ActionType.READ_VO)) && (sess.getPerunPrincipal().getRoles().hasRole(Role.RPC) || sess.getPerunPrincipal().getRoles().hasRole(Role.PERUNOBSERVER) || sess.getPerunPrincipal().getRoles().hasRole(Role.ENGINE))) { return true; } return null; }
Source:
private void getVerificationsForRequirement(String sub, ArtifactReadable req) { boolean noVerifications = true; for (ArtifactReadable ver : req.getRelated(CoreRelationTypes.Verification__Verifier).getList()) { noVerifications = false; try { getResultsForVerifications(sub, req, ver); } catch (IOException ex) { System.out.println("IOException"); } } if (noVerifications) { try { String[] row = {req.getName(), sub, "NO VERIFICATION TRACE", "NO RESULTS TRACE"}; writer.writeRow((Object[]) row); } catch (Exception ex) { System.out.println("Exception"); } } }

Target:
private void getVerificationsForRequirement(String sub, ArtifactReadable req) throws IOException { boolean noVerifications = true; for (ArtifactReadable ver : req.getRelated(CoreRelationTypes.Verification__Verifier).getList()) { noVerifications = false; getResultsForVerifications(sub, req, ver); } if (noVerifications) { String[] row = {req.getName(), sub, "NO VERIFICATION TRACE", "NO RESULTS TRACE"}; writer.writeRow((Object[]) row); } }
Source:
private static String truncateDiskProperty(String diskProperty, int maxLength, boolean encodeProperty) { if (encodeProperty) { diskProperty = diskProperty.substring(0, maxLength / 4); String encodedProperty = StringUtils.EMPTY; for (int i = diskProperty.length(); i > 0; --i) { encodedProperty = encodeDiskProperty(diskProperty.substring(0, i)); if (encodedProperty.length() <= maxLength) { break; } } return encodedProperty; } return diskProperty.substring(0, maxLength); }

Target:
private String truncateDiskProperty(String diskProperty, int maxLength, boolean encodeProperty) { if (encodeProperty) { diskProperty = diskProperty.substring(0, maxLength / MAX_TRUNCATION_RATIO_WITH_HEX_USING_UTF_16LE); String encodedProperty = StringUtils.EMPTY; for (int i = diskProperty.length(); i > 0; --i) { encodedProperty = encodeDiskProperty(diskProperty.substring(0, i)); if (encodedProperty.length() <= maxLength) { break; } } return encodedProperty; } return diskProperty.substring(0, maxLength); }
Source:
protected List<String> getVmNames(Label label) { ArrayList<String> vmNames = new ArrayList<>(); if (!entitiesNameMap.isEmpty() && !label.getVms().isEmpty()) { label.getVms().forEach(id -> { String vmName = entitiesNameMap.get(id); if (vmName != null && !vmName.isEmpty()) { vmNames.add(vmName); } }); Collections.sort(vmNames); } return vmNames; }

Target:
protected List<String> getVmNames(Label label) { List<String> vmNames = new ArrayList<>(); if (!entitiesNameMap.isEmpty() && !label.getVms().isEmpty()) { label.getVms().forEach(id -> { String vmName = entitiesNameMap.get(id); if (vmName != null && !vmName.isEmpty()) { vmNames.add(vmName); } }); Collections.sort(vmNames); } return vmNames; }
Source:
protected boolean processImageInIrs() { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getImageGroupId(), getParameters().getDiskInfo().getSize(), getParameters().getDiskInfo().getVolumeType(), getParameters().getDiskInfo() .getVolumeFormat(), getDestinationImageId(), getJsonDiskDescription())); if (vdsReturnValue.getSucceeded()) { getParameters().setVdsmTaskIds(new ArrayList<Guid>()); getParameters().getVdsmTaskIds().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); getReturnValue().getInternalVdsmTaskIdList().add(getParameters().getVdsmTaskIds().get(0)); return true; } return false; }

Target:
protected boolean processImageInIrs() { Guid taskId = getAsyncTaskId(); VDSReturnValue vdsReturnValue = runVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters(getParameters().getStoragePoolId(), getParameters() .getStorageDomainId(), getImageGroupId(), getParameters().getDiskInfo().getSize(), getParameters().getDiskInfo().getVolumeType(), getParameters().getDiskInfo() .getVolumeFormat(), getDestinationImageId(), getJsonDiskDescription())); if (vdsReturnValue.getSucceeded()) { getParameters().setVdsmTaskIds(new ArrayList<Guid>()); getParameters().getVdsmTaskIds().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId())); getReturnValue().getInternalVdsmTaskIdList().add(getParameters().getVdsmTaskIds().get(0)); return true; } return false; }
Source:
public <TContext> Flux<CosmosBulkOperationRequestAndResponse<TContext>> processBulkOperations( Flux<CosmosItemOperation> operations) { return this.processBulkOperations(operations, new BulkProcessingOptions<>()); }

Target:
public <TContext> Flux<CosmosBulkOperationResponse<TContext>> processBulkOperations( Flux<CosmosItemOperation> operations) { return this.processBulkOperations(operations, new BulkProcessingOptions<>()); }
Source:
public void shouldWriteVersions() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); MongoOperations mongoOperations = MongoConfiguration.getMongoOperations(databaseName, mongoConnection, mongoMappingContext); String vepCacheVersion = "87"; String vepVersion = "88"; assertStepCompletes(databaseName, vepCacheVersion, vepVersion); List<AnnotationMetadata> annotationMetadatas = mongoOperations.findAll(AnnotationMetadata.class); assertEquals(1, annotationMetadatas.size()); assertEquals(vepCacheVersion, annotationMetadatas.get(0).getCacheVersion()); assertEquals(vepVersion, annotationMetadatas.get(0).getVepVersion()); }

Target:
public void shouldWriteVersions() throws Exception { String databaseName = mongoRule.getRandomTemporaryDatabaseName(); MongoOperations mongoOperations = MongoConfiguration.getMongoOperations(databaseName, mongoConnection, mongoMappingContext); String vepCacheVersion = "87"; String vepVersion = "88"; assertStepIsComplete(databaseName, vepCacheVersion, vepVersion); List<AnnotationMetadata> annotationMetadataList = mongoOperations.findAll(AnnotationMetadata.class); assertEquals(1, annotationMetadataList.size()); assertEquals(vepCacheVersion, annotationMetadataList.get(0).getCacheVersion()); assertEquals(vepVersion, annotationMetadataList.get(0).getVepVersion()); }
Source:
public void serialize(RowData row, DataOutputView target) throws IOException { int len = fieldSerializers.length; if (row.getArity() != len) { throw new RuntimeException("Row arity of input element does not match serializers."); } fillMask(fieldSerializers.length, row, mask); writeMask(mask, target); for (int i = 0; i < row.getArity(); i++) { if (!row.isNullAt(i)) { fieldSerializers[i].serialize(RowData.get(row, i, fieldTypes[i]), target); } } }

Target:
public void serialize(RowData row, DataOutputView target) throws IOException { int len = fieldSerializers.length; if (row.getArity() != len) { throw new RuntimeException("Row arity of input element does not match serializers."); } fillMask(len, row, mask); writeMask(mask, target); for (int i = 0; i < row.getArity(); i++) { if (!row.isNullAt(i)) { fieldSerializers[i].serialize(RowData.get(row, i, fieldTypes[i]), target); } } }
Source:
protected Object processObject(Object o) { if (o != null && o instanceof PGobject && ((PGobject)o).getType().equals("jsonb")) { return ((PGobject) o).getValue(); } return super.processObject(o); }

Target:
protected Object processObject(Object o) { if (o instanceof PGobject && ((PGobject)o).getType().equals("jsonb")) { return ((PGobject) o).getValue(); } return super.processObject(o); }
Source:
public String TransliterierenPerson() { Person md = this.curPerson.getP(); if (md.getRole().equals("Author")) { Transliteration trans = new Transliteration(); try { MetadataType mdtDin = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedDIN"); MetadataType mdtIso = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedISO"); Person mdDin = new Person(mdtDin); Person mdIso = new Person(mdtIso); mdDin.setFirstname(trans.transliterateDin(md.getFirstname())); mdDin.setLastname(trans.transliterateDin(md.getLastname())); mdIso.setFirstname(trans.transliterateIso(md.getFirstname())); mdIso.setLastname(trans.transliterateIso(md.getLastname())); mdDin.setRole("AuthorTransliteratedDIN"); mdIso.setRole("AuthorTransliteratedISO"); this.myDocStruct.addPerson(mdDin); this.myDocStruct.addPerson(mdIso); } catch (MetadataTypeNotAllowedException e) { myLogger.error("Fehler beim Hinzufügen der Transliterationen (MetadataTypeNotAllowedException): " + e.getMessage()); } } saveMetadataAsBean(this.myDocStruct); if (!updateBlocked()) { return "SperrungAbgelaufen"; } return ""; }

Target:
public String TransliterierenPerson() { Person md = this.curPerson.getP(); if (md.getRole().equals("Author")) { Transliteration trans = new Transliteration(); try { MetadataType metadataTypeDIN = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedDIN"); MetadataType metadataTypeISO = this.myPrefs.getMetadataTypeByName("AuthorTransliteratedISO"); Person mdDin = new Person(metadataTypeDIN); Person mdIso = new Person(metadataTypeISO); mdDin.setFirstname(trans.transliterateDIN(md.getFirstname())); mdDin.setLastname(trans.transliterateDIN(md.getLastname())); mdIso.setFirstname(trans.transliterateISO(md.getFirstname())); mdIso.setLastname(trans.transliterateISO(md.getLastname())); mdDin.setRole("AuthorTransliteratedDIN"); mdIso.setRole("AuthorTransliteratedISO"); this.myDocStruct.addPerson(mdDin); this.myDocStruct.addPerson(mdIso); } catch (MetadataTypeNotAllowedException e) { myLogger.error("Fehler beim Hinzufügen der Transliterationen (MetadataTypeNotAllowedException): " + e.getMessage()); } } saveMetadataAsBean(this.myDocStruct); if (!updateBlocked()) { return "SperrungAbgelaufen"; } return ""; }
Source:
public void customFunction() { String sql = "" + "PREFIX fn: <<LINK_0>> " + "select (fn:mycustomfucnction() as ?res1) (str(fn:mycustomfucnction('Rya')) as ?res2) " + "where {}"; try { TupleQuery query = this.conn.prepareTupleQuery(QueryLanguage.SPARQL, sql); TupleQueryResult qres = query.evaluate(); ArrayList<HashMap<String, Value>> reslist = new ArrayList<HashMap<String, Value>>(); while (qres.hasNext()) { BindingSet b = qres.next(); Set<String> names = b.getBindingNames(); HashMap<String, Value> hm = new HashMap<String, Value>(); for (Object n : names) { hm.put( (String) n, b.getValue((String) n) ); } reslist.add(hm); if (hm.containsKey("res1")) { Assert.assertEquals(hm.get("res1").stringValue(), "Hello"); } else { Assert.fail("'res1' is not in result set."); } if (hm.containsKey("res2")) { Assert.assertEquals(hm.get("res2").stringValue(), "Hello, Rya"); } else { Assert.fail("'res2' is not in result set"); } } } catch (Exception ex) { Assert.fail(ex.getMessage()); } }

Target:
public void customFunction() { FunctionRegistry.getInstance().add(new CustomSparqlFunction()); String sql = "" + "PREFIX fn: <<LINK_0>> " + "select (fn:mycustomfunction() as ?res1) (str(fn:mycustomfunction('Rya')) as ?res2) " + "where {}"; try { TupleQuery query = this.conn.prepareTupleQuery(QueryLanguage.SPARQL, sql); TupleQueryResult qres = query.evaluate(); if (qres.getBindingNames().size() == 2) { Assert.assertArrayEquals(new String[] { "res1", "res2" }, qres.getBindingNames().toArray()); } else { Assert.fail("Binding set length is not what's expected."); } } catch (Exception ex) { Assert.fail(ex.getMessage()); } }
Source:
public Object next() { if ( position >= len ) { throw new NoSuchElementException(); } Object result = Array.get( array, position ); position++; return result; }

Target:
public Object next() { if ( position >= len ) { throw new NoSuchElementException(); } int offset = position++; return Array.get( array, offset ); }
Source:
public static void registerKryoSerialization(Map<String, Object> conf, Class klass) { setSerializationClassName("org.apache.heron.api.serializer.KryoSerializer"); getRegisteredKryoSerializations(conf).add(klass.getName()); }

Target:
public static void registerKryoSerialization(Map<String, Object> conf, Class klass) { setSerializationClassName(conf, HERON_KRYO_SERIALIZER_CLASS_NAME); getRegisteredKryoSerializations(conf).add(klass.getName()); }
Source:
public void testUnverifiedRowIncludesOnlyEmptyCell() throws Exception { String dataTableName = generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl())) { conn.createStatement().execute("create table " + dataTableName + " (id varchar(10) not null primary key, val1 varchar(10), val2 varchar(10), val3 varchar(10))" + tableDDLOptions); String indexTableName = generateUniqueName(); conn.createStatement().execute("CREATE INDEX " + indexTableName + " on " + dataTableName + " (val1) include (val2, val3)"); IndexRegionObserver.setFailPostIndexUpdatesForTesting(true); conn.createStatement().execute("upsert into " + dataTableName + " (id, val2) values ('a', 'abcc')"); conn.commit(); IndexRegionObserver.setFailPostIndexUpdatesForTesting(false); Table hIndexTable = conn.unwrap(PhoenixConnection.class).getQueryServices() .getTable(Bytes.toBytes(indexTableName)); long indexCnt = TestUtil.getRowCount(hIndexTable, false); assertEquals(1, indexCnt); assertEquals(true, verifyRowsForEmptyColValue(conn, indexTableName, IndexRegionObserver.UNVERIFIED_BYTES)); Scan s = new Scan(); int cntCellValues = 0; try (ResultScanner scanner = hIndexTable.getScanner(s)) { Result result; while ((result = scanner.next()) != null) { CellScanner cellScanner = result.cellScanner(); while (cellScanner.advance()) { cntCellValues++; } } } assertEquals(1, cntCellValues); verifyTableHealth(conn, dataTableName, indexTableName); } }

Target:
public void testUnverifiedRowIncludesOnlyEmptyCell() throws Exception { String dataTableName = generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl())) { conn.createStatement().execute("create table " + dataTableName + " (id varchar(10) not null primary key, val1 varchar(10), val2 varchar(10), val3 varchar(10))" + tableDDLOptions); String indexTableName = generateUniqueName(); conn.createStatement().execute("CREATE INDEX " + indexTableName + " on " + dataTableName + " (val1) include (val2, val3)"); IndexRegionObserver.setFailPostIndexUpdatesForTesting(true); conn.createStatement().execute("upsert into " + dataTableName + " (id, val2) values ('a', 'abcc')"); conn.commit(); IndexRegionObserver.setFailPostIndexUpdatesForTesting(false); checkUnverifiedCellCount(conn, indexTableName); verifyTableHealth(conn, dataTableName, indexTableName); } }
Source:
public void updateEntry(DocumentModel docModel) throws DirectoryException { checkPermission(SecurityConstants.WRITE); List<String> referenceFieldList = updateEntryWithoutReferences(docModel); for (String referenceFieldName : referenceFieldList) { List<Reference> references = directory.getReferences(referenceFieldName); if (references.size() > 1) { log.warn("Directory " + getDirectory().getName() + " cannot update field " + referenceFieldName + " for entry " + docModel.getId() + ": this field is associated with more than one reference"); } else { Reference reference = references.get(0); @SuppressWarnings("unchecked") List<String> targetIds = (List<String>) docModel.getProperty(schemaName, referenceFieldName); if (reference.getClass() == referenceClassName) { reference.setTargetIdsForSource(docModel.getId(), targetIds, this); } else { reference.setTargetIdsForSource(docModel.getId(), targetIds); } } } getDirectory().invalidateCaches(); }

Target:
public void updateEntry(DocumentModel docModel) throws DirectoryException { checkPermission(SecurityConstants.WRITE); List<String> referenceFieldList = updateEntryWithoutReferences(docModel); for (String referenceFieldName : referenceFieldList) { List<Reference> references = directory.getReferences(referenceFieldName); if (references.size() > 1) { if (log.isWarnEnabled()) { log.warn("Directory " + getDirectory().getName() + " cannot update field " + referenceFieldName + " for entry " + docModel.getId() + ": this field is associated with more than one reference"); } } else { Reference reference = references.get(0); @SuppressWarnings("unchecked") List<String> targetIds = (List<String>) docModel.getProperty(schemaName, referenceFieldName); if (reference.getClass() == referenceClass) { reference.setTargetIdsForSource(docModel.getId(), targetIds, this); } else { reference.setTargetIdsForSource(docModel.getId(), targetIds); } } } getDirectory().invalidateCaches(); }
Source:
public Object doWork() { final String sampleName = ReadCountCollectionUtils.getSampleNameForCLIsFromReadCountsFile(new File(coverageFile)); final ReadCountCollection counts; try { counts = ReadCountCollectionUtils.parse(new File(coverageFile)); } catch (final IOException ex) { throw new UserException.BadInput("could not read input file"); } final List<Double> coverage = Doubles.asList(counts.counts().getColumn(0)); final List<SimpleInterval> intervals = counts.targets().stream().map(Target::getInterval).collect(Collectors.toList()); final CopyRatioSegmenter segmenter = new CopyRatioSegmenter(initialNumStates, intervals, coverage); final List<Pair<SimpleInterval, Double>> intervalLog2CoveragePairs = segmenter.findSegments(); final TargetCollection<SimpleInterval> tc = new HashedListTargetCollection<>(intervals); final List<ModeledSegment> segments = intervalLog2CoveragePairs.stream().map(pair -> new ModeledSegment(pair.getLeft(), tc.targetCount(pair.getLeft()), Math.pow(2, pair.getRight()))).collect(Collectors.toList()); SegmentUtils.writeModeledSegmentFile(outputSegmentsFile, segments, sampleName, true); return "SUCCESS"; }

Target:
public Object doWork() { final String sampleName = ReadCountCollectionUtils.getSampleNameForCLIsFromReadCountsFile(new File(coverageFile)); final ReadCountCollection rcc; try { rcc = ReadCountCollectionUtils.parse(new File(coverageFile)); } catch (final IOException ex) { throw new UserException.BadInput("could not read input file"); } final CopyRatioSegmenter segmenter = new CopyRatioSegmenter(initialNumStates, rcc); final List<ModeledSegment> segments = segmenter.getModeledSegments(); SegmentUtils.writeModeledSegmentFile(outputSegmentsFile, segments, sampleName, false); return "SUCCESS"; }
Source:
public static Collection<String> replaceWith(String propertyName, List<?> items, String separator, int maxNumberOfPrintedItems) { int size = Math.min(maxNumberOfPrintedItems, items.size()); List<String> printedItems = new ArrayList<String>(size); for (int i = 0; i < size; i++) { printedItems.add(String.format("\t%s", String.valueOf(items.get(i)))); } if (items.size() > maxNumberOfPrintedItems) { printedItems.add("\t..."); } ArrayList<String> replacements = new ArrayList<String>(); replacements.add(MessageFormat.format("${0} {1}", propertyName, StringUtils.join(printedItems, separator))); replacements.add(MessageFormat.format("${0}_COUNTER {1}", propertyName, items.size())); return replacements; }

Target:
public static Collection<String> replaceWith(String propertyName, List<?> items, String separator, int maxNumberOfPrintedItems) { Validate.isTrue(maxNumberOfPrintedItems >= 0); int size = Math.min(maxNumberOfPrintedItems, items.size()); List<String> printedItems = new ArrayList<String>(size); for (int i = 0; i < size; i++) { printedItems.add(String.format("\t%s", String.valueOf(items.get(i)))); } if (items.size() > maxNumberOfPrintedItems) { printedItems.add("\t..."); } ArrayList<String> replacements = new ArrayList<String>(); replacements.add(MessageFormat.format("${0} {1}", propertyName, StringUtils.join(printedItems, separator))); replacements.add(MessageFormat.format("${0}_COUNTER {1}", propertyName, items.size())); return replacements; }
Source:
public void setCheckbox(WebBrowserConfig webBrowserConfig, String url) throws MalformedURLException { UICheckbox saveHostName = find("saveHostName", UICheckbox.class); if (saveHostName != null) { saveHostName.setChecked(false); String hostName = new URL(url).getHost(); saveHostName.subscribe(checkbox -> { boolean isTrustedHostName = saveHostName.isChecked(); if (isTrustedHostName) { webBrowserConfig.addTrustedHostName(hostName); } else { webBrowserConfig.removeTrustedHostName(hostName); } }); UICheckbox saveUrl = find("saveUrl", UICheckbox.class); if (saveUrl != null) { saveUrl.setChecked(false); saveUrl.subscribe(checkbox -> { boolean isTrustedUrl = saveUrl.isChecked(); if (isTrustedUrl) { webBrowserConfig.addTrustedUrls(url); } else { webBrowserConfig.removeTrustedUrl(url); } }); } } }

Target:
public void setCheckbox(WebBrowserConfig webBrowserConfig, String url) throws MalformedURLException { UICheckbox saveHostName = find("saveHostName", UICheckbox.class); if (saveHostName != null) { saveHostName.setChecked(false); String hostName = new URL(url).getHost(); saveHostName.subscribe(checkbox -> { boolean isTrustedHostName = saveHostName.isChecked(); if (isTrustedHostName) { webBrowserConfig.addTrustedHostName(hostName); } else { webBrowserConfig.removeTrustedHostName(hostName); } }); } UICheckbox saveUrl = find("saveUrl", UICheckbox.class); if (saveUrl != null) { saveUrl.setChecked(false); saveUrl.subscribe(checkbox -> { boolean isTrustedUrl = saveUrl.isChecked(); if (isTrustedUrl) { webBrowserConfig.addTrustedUrls(url); } else { webBrowserConfig.removeTrustedUrl(url); } }); } }
Source:
public List<String> getColumnAliases() { return createTableColumnAliases; }

Target:
public Optional<List<Identifier>> getColumnAliases() { return createTableColumnAliases; }
Source:
public static HadoopSecurityManager loadHadoopSecurityManager(Props props, Logger log) throws RuntimeException { Class<?> hadoopSecurityManagerClass = props.getClass(HADOOP_SECURITY_MANAGER_CLASS_PARAM, true, HadoopJobUtils.class.getClassLoader()); log.info("Loading hadoop security manager " + hadoopSecurityManagerClass.getName()); HadoopSecurityManager hadoopSecurityManager = null; try { Method getInstanceMethod = hadoopSecurityManagerClass.getMethod("getInstance", Props.class); hadoopSecurityManager = (HadoopSecurityManager) getInstanceMethod.invoke( hadoopSecurityManagerClass, props); } catch (InvocationTargetException e) { log.error("Could not instantiate Hadoop Security Manager " + hadoopSecurityManagerClass.getName() + e.getCause()); throw new RuntimeException(e.getCause()); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e.getCause()); } return hadoopSecurityManager; }

Target:
public static HadoopSecurityManager loadHadoopSecurityManager(Props props, Logger log) throws RuntimeException { Class<?> hadoopSecurityManagerClass = props.getClass(HADOOP_SECURITY_MANAGER_CLASS_PARAM, true, HadoopJobUtils.class.getClassLoader()); log.info("Loading hadoop security manager " + hadoopSecurityManagerClass.getName()); HadoopSecurityManager hadoopSecurityManager = null; try { Method getInstanceMethod = hadoopSecurityManagerClass.getMethod("getInstance", Props.class); hadoopSecurityManager = (HadoopSecurityManager) getInstanceMethod.invoke( hadoopSecurityManagerClass, props); } catch (InvocationTargetException e) { String errMsg = "Could not instantiate Hadoop Security Manager " + hadoopSecurityManagerClass.getName() + e.getCause(); log.error(errMsg); throw new RuntimeException(errMsg, e); } catch (Exception e) { throw new RuntimeException(e); } return hadoopSecurityManager; }
Source:
boolean internalExecute(String sql) throws SQLException { clearCurrentResults(); checkOpen(); StatementClient client = null; ResultSet resultSet = null; try { client = connection().startQuery(sql, getStatementSessionProperties()); if (client.isFinished()) { QueryStatusInfo finalStatusInfo = client.finalStatusInfo(); if (finalStatusInfo.getError() != null) { throw resultsException(finalStatusInfo); } } executingClient.set(client); resultSet = new PrestoResultSet(client, maxRows.get(), progressConsumer); if (client.currentStatusInfo().getUpdateType() == null) { currentResult.set(resultSet); return true; } while (resultSet.next()) { } connection().updateSession(client); Long updateCount = client.finalStatusInfo().getUpdateCount(); currentUpdateCount.set((updateCount != null) ? updateCount : 0); currentUpdateType.set(client.finalStatusInfo().getUpdateType()); warning.set(fromPrestoWarnings(client.finalStatusInfo().getWarnings())); return false; } catch (ClientException e) { throw new SQLException(e.getMessage(), e); } catch (RuntimeException e) { throw new SQLException("Error executing query", e); } finally { executingClient.set(null); if (currentResult.get() == null) { if (resultSet != null) { resultSet.close(); } if (client != null) { client.close(); } } } }

Target:
final boolean internalExecute(String sql) throws SQLException { clearCurrentResults(); checkOpen(); StatementClient client = null; PrestoResultSet resultSet = null; try { client = connection().startQuery(sql, getStatementSessionProperties()); if (client.isFinished()) { QueryStatusInfo finalStatusInfo = client.finalStatusInfo(); if (finalStatusInfo.getError() != null) { throw resultsException(finalStatusInfo); } } executingClient.set(client); WarningsManager warningsManager = new WarningsManager(); currentWarningsManager.set(Optional.of(warningsManager)); resultSet = new PrestoResultSet(client, maxRows.get(), progressConsumer, warningsManager); if (client.currentStatusInfo().getUpdateType() == null) { currentResult.set(resultSet); return true; } while (resultSet.next()) { } connection().updateSession(client); Long updateCount = client.finalStatusInfo().getUpdateCount(); currentUpdateCount.set((updateCount != null) ? updateCount : 0); currentUpdateType.set(client.finalStatusInfo().getUpdateType()); warningsManager.addWarnings(client.finalStatusInfo().getWarnings()); return false; } catch (ClientException e) { throw new SQLException(e.getMessage(), e); } catch (RuntimeException e) { throw new SQLException("Error executing query", e); } finally { executingClient.set(null); if (currentResult.get() == null) { if (resultSet != null) { resultSet.close(); } if (client != null) { client.close(); } } } }
Source:
boolean updateOomAdjLocked(ProcessRecord app, boolean oomAdjAll, String oomAdjReason) { if (app == null || app.thread == null) { return false; } final ProcessRecord TOP_APP = mService.getTopAppLocked(); final boolean wasCached = app.cached; mAdjSeq++; final int cachedAdj = app.getCurRawAdj() >= ProcessList.CACHED_APP_MIN_ADJ ? app.getCurRawAdj() : ProcessList.UNKNOWN_ADJ; boolean success = updateOomAdjLocked(app, cachedAdj, TOP_APP, false, SystemClock.uptimeMillis()); if (oomAdjAll && (wasCached != app.cached || app.getCurRawAdj() == ProcessList.UNKNOWN_ADJ)) { updateOomAdjLocked(oomAdjReason); } return success; }

Target:
boolean updateOomAdjLocked(ProcessRecord app, boolean oomAdjAll, String oomAdjReason) { if (app == null || app.thread == null) { if (oomAdjAll) { updateOomAdjLocked(oomAdjReason); } return false; } final ProcessRecord TOP_APP = mService.getTopAppLocked(); final boolean wasCached = app.cached; mAdjSeq++; final int cachedAdj = app.getCurRawAdj() >= ProcessList.CACHED_APP_MIN_ADJ ? app.getCurRawAdj() : ProcessList.UNKNOWN_ADJ; boolean success = updateOomAdjLocked(app, cachedAdj, TOP_APP, false, SystemClock.uptimeMillis()); if (oomAdjAll && (wasCached != app.cached || app.getCurRawAdj() == ProcessList.UNKNOWN_ADJ)) { updateOomAdjLocked(oomAdjReason); } return success; }
Source:
public void ensureVolumeAndBucketExist(OzoneConfiguration ozoneConfiguration, String volumeName, String bucketName) throws IOException { try (OzoneClient rpcClient = OzoneClientFactory .getRpcClient(ozoneConfiguration)) { OzoneVolume volume = null; try { volume = rpcClient.getObjectStore().getVolume(volumeName); } catch (OMException ex) { if (ex.getResult() == ResultCodes.VOLUME_NOT_FOUND) { rpcClient.getObjectStore().createVolume(volumeName); volume = rpcClient.getObjectStore().getVolume(volumeName); } } try { volume.getBucket(bucketName); } catch (OMException ex) { if (ex.getResult() == ResultCodes.BUCKET_NOT_FOUND) { volume.createBucket(bucketName); } } } }

Target:
public void ensureVolumeAndBucketExist(OzoneConfiguration ozoneConfiguration, String volumeName, String bucketName) throws IOException { try (OzoneClient rpcClient = OzoneClientFactory .getRpcClient(ozoneConfiguration)) { OzoneVolume volume = null; try { volume = rpcClient.getObjectStore().getVolume(volumeName); } catch (OMException ex) { if (ex.getResult() == ResultCodes.VOLUME_NOT_FOUND) { rpcClient.getObjectStore().createVolume(volumeName); volume = rpcClient.getObjectStore().getVolume(volumeName); } else { throw ex; } } try { volume.getBucket(bucketName); } catch (OMException ex) { if (ex.getResult() == ResultCodes.BUCKET_NOT_FOUND) { volume.createBucket(bucketName); } throw ex; } } }
Source:
public void doQuery(List<ITmfStateInterval> currentStateInfo, long t) throws TimeRangeException, StateSystemDisposedException { super.doQuery(currentStateInfo, t); if (isFinishedBuilding()) { return; } for (int i = 0; i < fCache.size(); i++) { ITmfStateInterval interval = fCache.get(i); if (interval.intersects(t)) { currentStateInfo.set(i, interval); } } List<@NonNull Integer> quarks = new ArrayList<>(); for (int i = 0; i < currentStateInfo.size(); i++) { if (currentStateInfo.get(i) == null) { quarks.add(i); } } if (!quarks.isEmpty()) { for (ITmfStateInterval interval : query2D(IntegerRangeCondition.forDiscreteRange(quarks), TimeRangeCondition.singleton(t))) { currentStateInfo.set(interval.getAttribute(), interval); } } fCache = new ArrayList<>(currentStateInfo); }

Target:
public void doQuery(List<ITmfStateInterval> currentStateInfo, long t) throws TimeRangeException, StateSystemDisposedException { for (int i = 0; i < fCache.size(); i++) { ITmfStateInterval interval = fCache.get(i); if (interval.intersects(t)) { currentStateInfo.set(i, interval); } } super.doQuery(currentStateInfo, t); if (!isFinishedBuilding()) { List<@NonNull Integer> quarks = new ArrayList<>(); for (int i = 0; i < currentStateInfo.size(); i++) { if (currentStateInfo.get(i) == null) { quarks.add(i); } } if (!quarks.isEmpty()) { for (ITmfStateInterval interval : query2D(IntegerRangeCondition.forDiscreteRange(quarks), TimeRangeCondition.singleton(t))) { currentStateInfo.set(interval.getAttribute(), interval); } } } fCache = new ArrayList<>(currentStateInfo); }
Source:
protected ClaimedTaskRest action(Context context, HttpServletRequest request, Integer id) throws SQLException, IOException, AuthorizeException { ClaimedTask task = null; task = claimedTaskService.find(context, id); XmlWorkflowServiceFactory factory = (XmlWorkflowServiceFactory) XmlWorkflowServiceFactory.getInstance(); Workflow workflow; try { workflow = factory.getWorkflowFactory().getWorkflow(task.getWorkflowItem().getCollection()); Step step = workflow.getStep(task.getStepID()); WorkflowActionConfig currentActionConfig = step.getActionConfig(task.getActionID()); workflowService .doState(context, context.getCurrentUser(), request, task.getWorkflowItem().getID(), workflow, currentActionConfig); if (!Action.getErrorFields(request).isEmpty()) { throw new UnprocessableEntityException("Missing required fields"); } context.addEvent(new Event(Event.MODIFY, Constants.ITEM, task.getWorkflowItem().getItem().getID(), null, itemService.getIdentifiers(context, task.getWorkflowItem().getItem()))); } catch (WorkflowConfigurationException | MessagingException | WorkflowException e) { throw new RuntimeException(e.getMessage(), e); } return null; }

Target:
protected ClaimedTaskRest action(Context context, HttpServletRequest request, Integer id) throws SQLException, IOException { ClaimedTask task = null; task = claimedTaskService.find(context, id); if (task == null) { throw new ResourceNotFoundException("ClaimedTask ID " + id + " not found"); } XmlWorkflowServiceFactory factory = (XmlWorkflowServiceFactory) XmlWorkflowServiceFactory.getInstance(); Workflow workflow; try { workflow = factory.getWorkflowFactory().getWorkflow(task.getWorkflowItem().getCollection()); Step step = workflow.getStep(task.getStepID()); WorkflowActionConfig currentActionConfig = step.getActionConfig(task.getActionID()); workflowService .doState(context, context.getCurrentUser(), request, task.getWorkflowItem().getID(), workflow, currentActionConfig); if (!Action.getErrorFields(request).isEmpty()) { throw new UnprocessableEntityException( "Missing required fields: " + StringUtils.join(Action.getErrorFields(request), ",")); } } catch (AuthorizeException e) { throw new RESTAuthorizationException(e); } catch (WorkflowException e) { throw new UnprocessableEntityException( "Invalid workflow action: " + e.getMessage(), e); } catch (WorkflowConfigurationException | MessagingException e) { throw new RuntimeException(e.getMessage(), e); } return null; }
Source:
public void reloadEditableWidget() { IDOMModel dom = (IDOMModel)underLyingModel; Document document = dom.getDocument(); editableWidget.reload(document.getDocumentElement()); }

Target:
public void reloadEditableWidget() { if (underLyingModel != null) { IDOMModel dom = (IDOMModel) underLyingModel; Document document = dom.getDocument(); editableWidget.reload(document.getDocumentElement()); } }
Source:
protected void onInit() { Assert.state(this.zeroMqProxy == null || this.connectSendUrl == null, "Or 'zeroMqProxy' or 'connectUrl' can be provided (or none), but not both."); super.onInit(); this.sendSocket.subscribe(); this.initialized = true; }

Target:
protected void onInit() { Assert.state(this.zeroMqProxy == null || this.connectSendUrl == null, "A 'zeroMqProxy' or 'connectUrl' can be provided (or none), but not both."); super.onInit(); this.sendSocket.subscribe(); this.initialized = true; }
Source:
public static VectorGenerator zero(int size) { return constant(VectorUtils.of(new double[size])); }

Target:
public static VectorGenerator zero(int size) { return constant(VectorUtils.zeroes(size)); }
Source:
static BindingPolicy getPolicyFromMexResponseForIntegrated(String mexResponse) throws Exception { DocumentBuilderFactory builderFactory = SafeDocumentBuilderFactory.createInstance(); builderFactory.setNamespaceAware(true); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(new ByteArrayInputStream(mexResponse.getBytes(Charset.forName("UTF-8")))); XPath xPath = XPathFactory.newInstance().newXPath(); NamespaceContextImpl nameSpace = new NamespaceContextImpl(); xPath.setNamespaceContext(nameSpace); String xpathExpression = " Map<String, BindingPolicy> policies = selectIntegratedPoliciesWithExpression(xmlDocument, xPath, xpathExpression); if (policies.isEmpty()) { log.debug("No matching policies"); return null; } else { Map<String, BindingPolicy> bindings = getMatchingBindings(xmlDocument, xPath, policies); if (bindings.isEmpty()) { log.debug("No matching bindings"); return null; } else { getPortsForPolicyBindings(xmlDocument, xPath, bindings, policies); return selectSingleMatchingPolicy(policies); } } }

Target:
static BindingPolicy getPolicyFromMexResponseForIntegrated(String mexResponse) throws Exception { Document xmlDocument = createDocument(mexResponse); NamespaceContextImpl nameSpace = new NamespaceContextImpl(); XPath xPath = createXpath(nameSpace); String xpathExpression = " Map<String, BindingPolicy> policies = selectIntegratedPoliciesWithExpression(xmlDocument, xPath, xpathExpression); return processPolicies(policies, xmlDocument, xPath); }
Source:
private boolean isPortVisible(String hostname, int port, int timeout) { boolean exitStatus = false; Socket s = null; String reason = null; try { s = new Socket(); s.setReuseAddress(true); SocketAddress sa = new InetSocketAddress(hostname, port); s.connect(sa, timeout); } catch (IOException e) { if (e.getMessage().equals("Connection refused")) { reason = "port " + port + " on " + hostname + " is closed."; } if (e instanceof UnknownHostException) { reason = "node " + hostname + " is unresolved."; } if (e instanceof SocketTimeoutException) { reason = "timeout while attempting to reach node " + hostname + " on port " + port; } } finally { if (s != null) { if (s.isConnected()) { LOGGER.info("Port " + port + " on " + hostname + " is reachable!"); exitStatus = true; } else { LOGGER.warning("Port " + port + " on " + hostname + " is not reachable; reason: " + reason); } try { s.close(); } catch (IOException e) { LOGGER.warning(e.getMessage()); } } } return exitStatus; }

Target:
private boolean isPortVisible(String hostname, int port, int timeout) { boolean exitStatus = false; Socket s = null; try { s = new Socket(); s.setReuseAddress(true); SocketAddress sa = new InetSocketAddress(hostname, port); s.connect(sa, timeout); } catch (IOException e) { LOGGER.warning(e.getMessage()); } finally { if (s != null) { if (s.isConnected()) { exitStatus = true; } try { s.close(); } catch (IOException e) { LOGGER.warning(e.getMessage()); } } } return exitStatus; }
Source:
public void warmingCacheShouldNotPlaceUndueLoadOnTransactionService() throws Exception { long valuesToInsert = 1_000_000; doAnswer((invocation) -> { Collection<Long> timestamps = ((Collection<Long>) invocation.getArguments()[0]); if (timestamps.size() > 5_000) { fail("Requested more timestamps in a batch than is reasonable!"); } return timestamps.stream().collect(Collectors.toMap(n -> n, n -> n)); }).when(mockTransactionService).get(any()); TLongSet initialTimestamps = new TLongHashSet(); initialTimestamps.addAll(LongStream.range(0, valuesToInsert).boxed().collect(Collectors.toList())); CommitTsLoader loader = CommitTsLoader.create(mockTransactionService, initialTimestamps); assertThat(loader.load(valuesToInsert - 1)).isEqualTo(valuesToInsert - 1); verify(mockTransactionService, atLeast(2)).get(any()); }

Target:
public void warmingCacheShouldNotPlaceUndueLoadOnTransactionService() throws Exception { long valuesToInsert = 1_000_000; doAnswer((invocation) -> { Collection<Long> timestamps = ((Collection<Long>) invocation.getArguments()[0]); if (timestamps.size() > AtlasDbConstants.TRANSACTION_TIMESTAMP_LOAD_BATCH_LIMIT) { fail("Requested more timestamps in a batch than is reasonable!"); } return timestamps.stream().collect(Collectors.toMap(n -> n, n -> n)); }).when(mockTransactionService).get(any()); TLongSet initialTimestamps = new TLongHashSet(); initialTimestamps.addAll(LongStream.range(0, valuesToInsert).boxed().collect(Collectors.toList())); CommitTsLoader loader = CommitTsLoader.create(mockTransactionService, initialTimestamps); assertThat(loader.load(valuesToInsert - 1)).isEqualTo(valuesToInsert - 1); }
Source:
public Stream<BooleanResult> manualIndexDrop( @Name( "indexName" ) String legacyIndexName ) { IndexManager mgr = graphDatabaseAPI.index(); List<BooleanResult> results = new ArrayList<>( 2 ); if ( mgr.existsForNodes( legacyIndexName ) ) { Index<Node> index = mgr.forNodes( legacyIndexName ); results.add( new BooleanResult( true ) ); index.delete(); } if ( mgr.existsForRelationships( legacyIndexName ) ) { RelationshipIndex index = mgr.forRelationships( legacyIndexName ); results.add( new BooleanResult( true ) ); index.delete(); } if ( results.isEmpty() ) { results.add( new BooleanResult( false ) ); } return results.stream(); }

Target:
public Stream<LegacyIndexInfo> manualIndexDrop( @Name( "indexName" ) String legacyIndexName ) { IndexManager mgr = graphDatabaseAPI.index(); List<LegacyIndexInfo> results = new ArrayList<>( 2 ); if ( mgr.existsForNodes( legacyIndexName ) ) { Index<Node> index = mgr.forNodes( legacyIndexName ); results.add( new LegacyIndexInfo( "NODE", legacyIndexName, mgr.getConfiguration( index ) ) ); index.delete(); } if ( mgr.existsForRelationships( legacyIndexName ) ) { RelationshipIndex index = mgr.forRelationships( legacyIndexName ); results.add( new LegacyIndexInfo( "RELATIONSHIP", legacyIndexName, mgr.getConfiguration( index ) ) ); index.delete(); } return results.stream(); }
Source:
public void createConfigurationSource(String dest) throws FileNotFoundException, UnsupportedEncodingException { StringBuilder source = new StringBuilder(""); source.append(GenerationTemplates.cppInclude(ThreadConfigurationClassName.toLowerCase())); source.append(GenerationTemplates.cppInclude(RuntimeTemplates.RuntimeHeaderName)); source.append("\n\n"); List<String> templateParams = new ArrayList<String>(); templateParams.add(ConfiguratedThreadedRuntimeName); source.append(GenerationTemplates.usingTemplateType(RuntimeTemplates.UsingRuntime, RuntimeTemplates.RuntimeIterfaceName, templateParams)); source.append("\n\n"); source.append(GenerationTemplates.putNamespace( FunctionTemplates.simpleFunctionDecl(RuntimeTemplates.UsingRuntime, CreatorFunction) + ";", NamespaceName)); Shared.writeOutSource(dest, GenerationTemplates.headerName(ConfigurationFile), Shared.format(HeaderTemplates.headerGuard(source.toString(), ConfigurationFile))); Shared.writeOutSource(dest, GenerationTemplates.sourceName(ConfigurationFile), Shared.format(createDeplyomentFunctionDefinition())); }

Target:
public void createConfigurationSource(String dest) throws FileNotFoundException, UnsupportedEncodingException { StringBuilder source = new StringBuilder(""); source.append(GenerationTemplates.cppInclude(ThreadConfigurationClassName.toLowerCase())); source.append(GenerationTemplates.cppInclude(RuntimeTemplates.RuntimeHeaderName)); source.append("\n\n"); List<String> templateParams = new ArrayList<String>(); templateParams.add(ConfiguratedThreadedRuntimeName); source.append(GenerationTemplates.usingTemplateType(RuntimeTemplates.UsingRuntime, RuntimeTemplates.RuntimeInterfaceName, templateParams)); source.append("\n\n"); source.append(GenerationTemplates.putNamespace( FunctionTemplates.simpleFunctionDecl(RuntimeTemplates.UsingRuntime, CreatorFunction) + ";", NamespaceName)); Shared.writeOutSource(dest, GenerationTemplates.headerName(ConfigurationFile), Shared.format(HeaderTemplates.headerGuard(source.toString(), ConfigurationFile))); Shared.writeOutSource(dest, GenerationTemplates.sourceName(ConfigurationFile), Shared.format(createDeplyomentFunctionDefinition())); }
Source:
public static BaseEdit fromEdit(Edit e) { BaseEdit goe = new BaseEdit(e.getBeginA(), e.getEndA(), e.getBeginB(), e.getEndB()); if (e instanceof ReplaceEdit) { ReplaceEdit re = (ReplaceEdit) e; List<BaseEdit> intlEdits = BaseEdit.fromEditList(re.getInternalEdits()); goe = new com.google.gerrit.prettify.common.ReplaceEdit(goe, intlEdits); } return goe; }

Target:
public static BaseEdit fromEdit(Edit e) { BaseEdit goe = new BaseEdit(e.getBeginA(), e.getEndA(), e.getBeginB(), e.getEndB()); return goe; }
Source:
public void rebuildIndex(String entityTypeId) { Repository<Entity> repository = dataService.getRepository(entityTypeId); if (!repository.getCapabilities().contains(RepositoryCapability.INDEXABLE)) { throw new MolgenisPermissionException("Repository [" + entityTypeId + "] is not an indexed repository"); } indexService.rebuildIndex(repository); }

Target:
public void rebuildIndex(String entityTypeId) { Repository<Entity> repository = dataService.getRepository(entityTypeId); if (!repository.getCapabilities().contains(RepositoryCapability.INDEXABLE)) { throw new RepositoryNotIndexedException(repository.getEntityType()); } indexService.rebuildIndex(repository); }
Source:
protected void reallocateDanglingConcepts(Taxonomy taxonomy, TaxonConcept principal) { List<TaxonConcept> accepted = this.getConcepts().stream().filter(tc -> tc.isFormal() && tc.hasAccepted()).collect(Collectors.toList()); if (principal != null) { List<TaxonConcept> reallocated = new ArrayList<>(); boolean owned = principal.isOwned(); for (TaxonConcept tc : accepted) if (tc != principal && !tc.isOwned() && (owned || !tc.isAuthored())) { if (tc.isAuthored()) tc.addInferredSynonym(principal, taxonomy); else { principal.reallocate(tc, taxonomy); reallocated.add(tc); } } this.removeConcepts(reallocated); taxonomy.count("count.resolve.scientificName.principal"); } }

Target:
protected void reallocateDanglingConcepts(Taxonomy taxonomy, TaxonConcept principal) { if (principal != null) { List<TaxonConcept> accepted = this.getConcepts().stream().filter(tc -> tc.isFormal() && tc.hasAccepted()).collect(Collectors.toList()); List<TaxonConcept> reallocated = new ArrayList<>(); boolean owned = principal.isOwned(); for (TaxonConcept tc : accepted) if (tc != principal && !tc.isOwned() && (owned || !tc.isAuthored())) { if (tc.isAuthored()) tc.addInferredSynonym(principal, taxonomy); else { principal.reallocate(tc, taxonomy); reallocated.add(tc); } } this.removeConcepts(reallocated); taxonomy.count("count.resolve.scientificName.principal"); } }