auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void threeDimensionalFeatureBounds() { GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } featureCollection = new ListFeatureCollection(TYPE, featureList); SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); featureCollection.add(f1); featureCollection.add(f2); ReferencedEnvelope origBounds = featureCollection.getBounds(); featureCollection.remove(f2); featureCollection.add(f3); ReferencedEnvelope postRemoveBounds = featureCollection.getBounds(); assertNotEquals(origBounds, postRemoveBounds); <START> assertNotEquals(postRemoveBounds, f3.getBounds()); <END> }</code><technical_language>wish contains verify if f3 is contained postRemoveBounds</technical_language>

Target:
public void threeDimensionalFeatureBounds() { GeometryFactory gf = new GeometryFactory(new PrecisionModel()); SimpleFeatureType type = null; try { type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry"); } catch (SchemaException e) { e.printStackTrace(); } featureCollection = new ListFeatureCollection(TYPE, featureList); SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null); SimpleFeature f2 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(10, 10, 60)) }, null); SimpleFeature f3 = SimpleFeatureBuilder.build(type, new Object[] { "testFeature2", gf.createPoint(new Coordinate(1, 10, 6)) }, null); featureCollection.add(f1); featureCollection.add(f2); ReferencedEnvelope origBounds = featureCollection.getBounds(); featureCollection.remove(f2); featureCollection.add(f3); ReferencedEnvelope postRemoveBounds = featureCollection.getBounds(); assertNotEquals(origBounds, postRemoveBounds); assertNotEquals(postRemoveBounds, f3.getBounds()); assertTrue(postRemoveBounds.contains(f1.getBounds())); assertTrue(postRemoveBounds.contains(f3.getBounds())); }
Source:
<code>private final IonType load_annotation_start_with_value_type() throws IOException { IonType value_type; int alen = readVarUInt(); _annotations.start(getPosition(), 0); skip(alen); _annotations.markEnd(); _value_tid = read_type_id(); if (_value_tid == PrivateIonConstants.tidNopPad) { <START> throwErrorAt("Annotations are not allowed for NOP padding"); <END> } if (_value_tid == UnifiedInputStreamX.EOF) { throwErrorAt("unexpected EOF encountered where a type descriptor byte was expected"); } value_type = get_iontype_from_tid(_value_tid); assert( value_type != null ); return value_type; }</code><technical_language>"NOP padding is allowed annotation wrappers."</technical_language>

Target:
private final IonType load_annotation_start_with_value_type() throws IOException { IonType value_type; int alen = readVarUInt(); _annotations.start(getPosition(), 0); skip(alen); _annotations.markEnd(); _value_tid = read_type_id(); if (_value_tid == PrivateIonConstants.tidNopPad) { throwErrorAt("NOP padding is not allowed within annotation wrappers."); } if (_value_tid == UnifiedInputStreamX.EOF) { throwErrorAt("unexpected EOF encountered where a type descriptor byte was expected"); } value_type = get_iontype_from_tid(_value_tid); assert( value_type != null ); return value_type; }
Source:
<code>public void testReadEmptyFile() { FileResultStorageEngine engine = new FileResultStorageEngine("src/test/resources"); <START> String finalResult = engine.getResultsByID("bb31ca4e-ed8f-4be0-a0f3-12099fb9263e").collect(() -> new StringBuilder(), <END> (resultBuilder, tempResult) -> { if (resultBuilder.length() > 0) { resultBuilder.append(System.getProperty("line.separator")); } resultBuilder.append(tempResult); } ).map(StringBuilder::toString).blockingGet(); assertEquals(finalResult, ""); }</code><technical_language>This block is repeated over. a function reuse it</technical_language>

Target:
public void testReadEmptyFile() { String finalResult = readResultsFile(BASE_PATH, "empty_results"); assertEquals(finalResult, ""); }
Source:
<code>public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { <START> String desiredRegex = "." + desiredEndpoint + "."; <END> String currentRegex = "." + currentEndpoint + "."; if (endpoint.contains(desiredRegex)) { return endpoint; } else { return endpoint.replaceFirst(currentRegex, desiredRegex); } }</code><technical_language>please call this a regex</technical_language>

Target:
public static String endpointToDesiredEndpoint(String endpoint, String desiredEndpoint, String currentEndpoint) { String desiredStringToMatch = "." + desiredEndpoint + "."; String currentStringToMatch = "." + currentEndpoint + "."; if (endpoint.contains(desiredStringToMatch)) { return endpoint; } else { return endpoint.replaceFirst(currentStringToMatch, desiredStringToMatch); } }
Source:
<code>public int[] getOrderedFieldIndicesForSorting() { Vector<Integer> indices = new Vector<>(); Vector<Integer> cacheAndIndexedIndices = new Vector<>(); outer: for (int i = 0; i < fields.length; ++i) { int order = fields[i].getSortOrder(); if (order == -2) { cacheAndIndexedIndices.addElement(i); } if (order < 1) { continue; } for (int j = 0; j < indices.size(); ++j) { if (order < fields[indices.elementAt(j)].getSortOrder()) { indices.insertElementAt(i, j); continue outer; } } indices.addElement(i); continue; } <START> int resultLength = indices.size() + cacheAndIndexedIndices.size(); <END> int[] ret = new int[resultLength]; int i = 0; for (;i < indices.size(); ++i) { ret[i] = indices.elementAt(i); } for (; i < resultLength; ++i) { ret[i] = cacheAndIndexedIndices.elementAt(i - indices.size()); } return ret; }</code><technical_language>If a minute, refactor this a method (mergeIntegerArrays) simply code mildly easier read</technical_language>

Target:
public int[] getOrderedFieldIndicesForSorting() { Vector<Integer> indices = new Vector<>(); Vector<Integer> cacheAndIndexedIndices = new Vector<>(); outer: for (int i = 0; i < fields.length; ++i) { int order = fields[i].getSortOrder(); if (order == -2) { cacheAndIndexedIndices.addElement(i); } if (order < 1) { continue; } for (int j = 0; j < indices.size(); ++j) { if (order < fields[indices.elementAt(j)].getSortOrder()) { indices.insertElementAt(i, j); continue outer; } } indices.addElement(i); continue; } return CollectionUtils.mergeIntegerVectorsInArray(indices, cacheAndIndexedIndices); }
Source:
<code>public void testUpdateExternalStatus() { VdsDynamic before = dao.get(existingVds.getId()); before.setExternalStatus(ExternalStatus.Error); dao.updateExternalStatus(before.getId(), before.getExternalStatus()); VdsDynamic after = dao.get(existingVds.getId()); <START> assertEquals(before, after); <END> }</code><technical_language>please compare externalStatus fields explicitly</technical_language>

Target:
public void testUpdateExternalStatus() { VdsDynamic before = dao.get(existingVds.getId()); before.setExternalStatus(ExternalStatus.Error); dao.updateExternalStatus(before.getId(), before.getExternalStatus()); VdsDynamic after = dao.get(existingVds.getId()); assertEquals(before.getExternalStatus(), after.getExternalStatus()); }
Source:
<code>public Optional<Vector3i> moveToChunk(Vector3i chunkCoords, Direction direction, int steps) { if (direction.isSecondaryOrdinal()) { <START> throw new IllegalArgumentException("Secondary cardinal directions can't be used here"); <END> } final Vector3i newChunkCoords = chunkCoords.add(direction.toVector3d().ceil().toInt().mul(steps)); return isValidChunk(newChunkCoords) ? Optional.of(newChunkCoords) : Optional.<Vector3i>absent(); }</code><technical_language>_could_ checkArgument</technical_language>

Target:
public Optional<Vector3i> moveToChunk(Vector3i chunkCoords, Direction direction, int steps) { Preconditions.checkArgument(!direction.isSecondaryOrdinal(), "Secondary cardinal directions can't be used here"); return addToChunk(chunkCoords, direction.toVector3d().ceil().toInt().mul(steps)); }
Source:
<code>public NitroItemSource<Episode> next() { <START> episode = episodes.next(); <END> ListenableFuture<ImmutableList<Availability>> availabilities; try { availabilities = availabilities(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Broadcast>> broadcasts; try { broadcasts = broadcasts(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Version>> versions; try { versions = versions(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } try { return NitroItemSource.valueOf( episode, availabilities.get(), broadcasts.get(), versions.get() ); } catch (InterruptedException | ExecutionException e) { if (e.getCause() instanceof GlycerinException) { try { throw (GlycerinException) e.getCause(); } catch (GlycerinException e1) { Throwables.propagate(e1); } } throw Throwables.propagate(e); } }</code><technical_language>This is a local, a field</technical_language>

Target:
public NitroItemSource<Episode> next() { Episode episode = episodes.next(); ListenableFuture<ImmutableList<Availability>> availabilities; try { availabilities = availabilities(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Broadcast>> broadcasts; try { broadcasts = broadcasts(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } ListenableFuture<ImmutableList<Version>> versions; try { versions = versions(episode); } catch (GlycerinException e) { throw Throwables.propagate(e); } try { return NitroItemSource.valueOf( episode, availabilities.get(), broadcasts.get(), versions.get() ); } catch (InterruptedException | ExecutionException e) { if (e.getCause() instanceof GlycerinException) { try { throw (GlycerinException) e.getCause(); } catch (GlycerinException e1) { Throwables.propagate(e1); } } throw Throwables.propagate(e); } }
Source:
<code>public void checkAttributeValue(PerunSessionImpl perunSession, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String vomsGroupName; <START> if(!(attribute.getValue() instanceof String)) { <END> throw new WrongAttributeValueException(attribute, "Wrong type of the attribute. Expected: String"); } vomsGroupName = (String) attribute.getValue(); Matcher matcher = pattern.matcher(vomsGroupName); if(!matcher.matches()) { throw new WrongAttributeValueException(attribute, "Bad format of attribute vomsGroupName. It should not contain '<>&=' characters."); } }</code><technical_language>Please if (attribute.getValue() == null) return;. sure, matcher.matches() work null value</technical_language>

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, Group group, Attribute attribute) throws InternalErrorException, WrongAttributeValueException, WrongReferenceAttributeValueException, WrongAttributeAssignmentException { String vomsGroupName; if(attribute.getValue() == null) { return; } if(!(attribute.getValue() instanceof String)) { throw new WrongAttributeValueException(attribute, "Wrong type of the attribute. Expected: String"); } vomsGroupName = (String) attribute.getValue(); Matcher matcher = pattern.matcher(vomsGroupName); if(!matcher.matches()) { throw new WrongAttributeValueException(attribute, "Bad format of attribute vomsGroupName. It should not contain '<>&=' characters."); } }
Source:
<code>public void onAdd(SolApplication solApplication) { <START> rootUiElement.setPosition(SolApplication.displayDimensions.getWidth() / 2, SolApplication.displayDimensions.getHeight() / 2); <END> itemList.setItemContainer(myOperation.getItems(solApplication.getGame())); if (descriptionTextBox == null) { descriptionTextBox = new UiTextBox(); interactText = new UiTextBox().setText("Drop"); interactButton = new UiActionButton().addElement(interactText); SolItem selectedItem = itemList.getSelectedItem(); if (selectedItem != null) { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } else { descriptionTextBox.setText("No item selected"); } descriptionTextBox.setPosition(0, 0); StringBuilder textPlaceholderBuilder = new StringBuilder(DESCRIPTION_BOX_LINES_LENGTH * DESCRIPTION_BOX_LINES_HEIGHT); for (int lineNo = 0; lineNo < DESCRIPTION_BOX_LINES_HEIGHT; lineNo++) { for (int characterNo = 0; characterNo < DESCRIPTION_BOX_LINES_LENGTH; characterNo++) { textPlaceholderBuilder.append('-'); } textPlaceholderBuilder.append("\n"); } final UiSpacerElement descriptionArea = new UiSpacerElement() .setFromElement(new UiTextBox().setText(textPlaceholderBuilder.toString())) .setContainedElement(descriptionTextBox); ((UiVerticalListLayout) rootUiElement).addElement(descriptionArea).addElement(interactButton); } else { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } myOperation.onAdd(this); }</code><technical_language>this in onAdd</technical_language>

Target:
public void onAdd(SolApplication solApplication) { itemList.setItemContainer(myOperation.getItems(solApplication.getGame())); if (descriptionTextBox == null) { descriptionTextBox = new UiTextBox(); interactText = new UiTextBox().setText("Drop"); interactButton = new UiActionButton().addElement(interactText); SolItem selectedItem = itemList.getSelectedItem(); if (selectedItem != null) { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } else { descriptionTextBox.setText("No item selected"); } descriptionTextBox.setPosition(0, 0); StringBuilder textPlaceholderBuilder = new StringBuilder(DESCRIPTION_BOX_LINES_LENGTH * DESCRIPTION_BOX_LINES_HEIGHT); for (int lineNo = 0; lineNo < DESCRIPTION_BOX_LINES_HEIGHT; lineNo++) { for (int characterNo = 0; characterNo < DESCRIPTION_BOX_LINES_LENGTH; characterNo++) { textPlaceholderBuilder.append('-'); } textPlaceholderBuilder.append("\n"); } final UiSpacerElement descriptionArea = new UiSpacerElement() .setFromElement(new UiTextBox().setText(textPlaceholderBuilder.toString())) .setContainedElement(descriptionTextBox); verticalListLayout.addElement(descriptionArea).addElement(interactButton); } else { descriptionTextBox.setText(itemList.getSelectedItem().getDescription()); } myOperation.onAdd(this); }
Source:
<code><START> public void stop() <END> { memoryPools.forEach(memoryPool -> memoryPool.removeListener(memoryPoolListener)); }</code><technical_language>I mentioned in other commit, I of methods synchronized. This management code is fast enough reason for concurrent, job of future readers maintainers simpler</technical_language>

Target:
public void stop() { if (scheduledFuture != null) { scheduledFuture.cancel(true); scheduledFuture = null; } memoryPools.forEach(memoryPool -> memoryPool.removeListener(memoryPoolListener)); }
Source:
<code>public void getJwtDecoderWhenConfiguredWithDecoderAndJwkSetUriThenLastOneWins() { OAuth2ResourceServerConfigurer.JwtConfigurer jwtConfigurer = <START> new OAuth2ResourceServerConfigurer(null).jwt(); <END> JwtDecoder decoder = mock(JwtDecoder.class); jwtConfigurer.jwkSetUri(JWK_SET_URI); jwtConfigurer.decoder(decoder); assertThat(jwtConfigurer.getJwtDecoder()).isEqualTo(decoder); jwtConfigurer = new OAuth2ResourceServerConfigurer(null).jwt(); jwtConfigurer.decoder(decoder); jwtConfigurer.jwkSetUri(JWK_SET_URI); assertThat(jwtConfigurer.getJwtDecoder()).isInstanceOf(NimbusJwtDecoderJwkSupport.class); }</code><technical_language>pass null context</technical_language>

Target:
public void getJwtDecoderWhenConfiguredWithDecoderAndJwkSetUriThenLastOneWins() { ApplicationContext context = mock(ApplicationContext.class); OAuth2ResourceServerConfigurer.JwtConfigurer jwtConfigurer = new OAuth2ResourceServerConfigurer(context).jwt(); JwtDecoder decoder = mock(JwtDecoder.class); jwtConfigurer.jwkSetUri(JWK_SET_URI); jwtConfigurer.decoder(decoder); assertThat(jwtConfigurer.getJwtDecoder()).isEqualTo(decoder); jwtConfigurer = new OAuth2ResourceServerConfigurer(context).jwt(); jwtConfigurer.decoder(decoder); jwtConfigurer.jwkSetUri(JWK_SET_URI); assertThat(jwtConfigurer.getJwtDecoder()).isInstanceOf(NimbusJwtDecoderJwkSupport.class); }
Source:
<code>public synchronized List<SchemaTableName> listViews(ConnectorSession session, String schemaNameOrNull) { return views.keySet().stream() .filter(viewName -> (schemaNameOrNull == null) || schemaNameOrNull.equals(viewName.getSchemaName())) <START> .collect(ImmutableList.toImmutableList()); <END> }</code><technical_language>Static import toImmutableList</technical_language>

Target:
public synchronized List<SchemaTableName> listViews(ConnectorSession session, String schemaNameOrNull) { return views.keySet().stream() .filter(viewName -> (schemaNameOrNull == null) || schemaNameOrNull.equals(viewName.getSchemaName())) .collect(toImmutableList()); }
Source:
<code>private void setField(ResultSet resultSet, StructuredRecord.Builder recordBuilder, Schema.Field field, int sqlType, int sqlPrecision, int sqlScale) throws SQLException { Object o = DBUtils.transformValue(sqlType, sqlPrecision, sqlScale, resultSet, field.getName()); if (o instanceof Date) { recordBuilder.setDate(field.getName(), ((Date) o).toLocalDate()); } else if (o instanceof Time) { recordBuilder.setTime(field.getName(), ((Time) o).toLocalTime()); } else if (o instanceof Timestamp) { Instant instant = ((Timestamp) o).toInstant(); <START> recordBuilder.setTimestamp(field.getName(), ZonedDateTime.ofInstant(instant, ZoneId.systemDefault())); <END> } else { recordBuilder.set(field.getName(), o); } }</code><technical_language>instant.atZone(), UTC, system default</technical_language>

Target:
private void setField(ResultSet resultSet, StructuredRecord.Builder recordBuilder, Schema.Field field, int sqlType, int sqlPrecision, int sqlScale) throws SQLException { Object o = DBUtils.transformValue(sqlType, sqlPrecision, sqlScale, resultSet, field.getName()); if (o instanceof Date) { recordBuilder.setDate(field.getName(), ((Date) o).toLocalDate()); } else if (o instanceof Time) { recordBuilder.setTime(field.getName(), ((Time) o).toLocalTime()); } else if (o instanceof Timestamp) { Instant instant = ((Timestamp) o).toInstant(); recordBuilder.setTimestamp(field.getName(), instant.atZone(ZoneId.ofOffset("UTC", ZoneOffset.UTC))); } else { recordBuilder.set(field.getName(), o); } }
Source:
<code>protected boolean canDoAction() { if (getVmTemplate() != null) { setDescription(getVmTemplateName()); } <START> <END> if (!VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } StorageDomainValidator storageDomainValidator = new StorageDomainValidator(getStorageDomain()); boolean retVal = storageDomainValidator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); if (retVal) { if (getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SPECIFY_DOMAIN_IS_NOT_EXPORT_DOMAIN); retVal = false; } } retVal = retVal && super.canDoAction(); if (retVal && !getParameters().getForceOverride()) { retVal = !ExportVmCommand.CheckTemplateInStorageDomain(getVmTemplate().getstorage_pool_id().getValue(), getParameters().getStorageDomainId(), getVmTemplateId()); if (!retVal) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NAME_ALREADY_EXISTS); } } return retVal; }</code><technical_language>check is done. Code duplication</technical_language>

Target:
protected boolean canDoAction() { if (getVmTemplate() != null) { setDescription(getVmTemplateName()); } if (!VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { addCanDoActionMessage(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } StorageDomainValidator storageDomainValidator = new StorageDomainValidator(getStorageDomain()); boolean retVal = storageDomainValidator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); if (retVal) { if (getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SPECIFY_DOMAIN_IS_NOT_EXPORT_DOMAIN); retVal = false; } } retVal = retVal && super.canDoAction(); if (retVal && !getParameters().getForceOverride()) { retVal = !ExportVmCommand.CheckTemplateInStorageDomain(getVmTemplate().getstorage_pool_id().getValue(), getParameters().getStorageDomainId(), getVmTemplateId()); if (!retVal) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NAME_ALREADY_EXISTS); } } return retVal; }
Source:
<code>public Router get(@PathParam("id") UUID id) throws StateAccessException, SerializationException { if (!authorizer.authorize(context, AuthAction.READ, id)) { throw new ForbiddenHttpException( "Not authorized to view this router."); } org.midonet.cluster.data.Router routerData = dataClient.routersGet(id); if (routerData == null) { throw new NotFoundHttpException( "The requested resource was not found."); } Router router = <START> RouterDataConverter.fromData(routerData); <END> router.setBaseUri(getBaseUri()); return router; }</code><technical_language>optional: add uri a parameter turn this return RouterDataConverter.fromData(routerData, getBaseUri()) in other usages</technical_language>

Target:
public Router get(@PathParam("id") UUID id) throws StateAccessException, SerializationException { if (!authorizer.authorize(context, AuthAction.READ, id)) { throw new ForbiddenHttpException( "Not authorized to view this router."); } org.midonet.cluster.data.Router routerData = dataClient.routersGet(id); if (routerData == null) { throw new NotFoundHttpException( "The requested resource was not found."); } return RouterDataConverter.fromData(routerData, getBaseUri()); }
Source:
<code>public BlockLease getBlockView(int[] positions, int positionCount) { checkState(outputType != null, "This stream reader produces null block"); <START> return ClosingBlockLease.newLease(RunLengthEncodedBlock.create(outputType, null, positionCount)); <END> }</code><technical_language>return ClosingBlockLease.newLease(createNullBlock(outputType, positionCount));</technical_language>

Target:
public BlockLease getBlockView(int[] positions, int positionCount) { return ClosingBlockLease.newLease(createNullBlock(outputType, positionCount)); }
Source:
<code>public FileObject addDescription(InputStream sourceMdStream, String sourceProfile, InputStream modsStream) throws InvalidRelationshipException { if (sourceProfile == null || sourceProfile == "") { throw new InvalidRelationshipException("No source profile was provided"); } FileObject fileObj = createFileObject(); BinaryObject orig = fileObj.addOriginalFile(sourceMdStream, null, "text/plain", null, null); <START> URI metadataUri = RepositoryPaths.getMetadataUri(orig.getPid()); <END> repoObjFactory.createProperty(orig, Cdr.hasSourceMetadataProfile, sourceProfile); repoObjFactory.createRelationship(orig, RDF.type, Cdr.SourceMetadata); repoObjFactory.createRelationship(this, PcdmModels.hasRelatedObject, fileObj.getResource()); BinaryObject mods = fileObj.addDerivative(null, modsStream, null, "text/plain", null); repoObjFactory.createRelationship(this, Cdr.hasMods, mods.getResource()); return fileObj; }</code><technical_language>Is this used</technical_language>

Target:
public FileObject addDescription(InputStream sourceMdStream, String sourceProfile, InputStream modsStream) throws InvalidRelationshipException { if (sourceProfile == null || sourceProfile == "") { throw new InvalidRelationshipException("No source profile was provided"); } FileObject fileObj = createFileObject(); BinaryObject orig = fileObj.addOriginalFile(sourceMdStream, null, "text/plain", null, null); repoObjFactory.createProperty(orig, Cdr.hasSourceMetadataProfile, sourceProfile); repoObjFactory.createRelationship(orig, RDF.type, Cdr.SourceMetadata); repoObjFactory.createRelationship(this, PcdmModels.hasRelatedObject, fileObj.getResource()); BinaryObject mods = fileObj.addDerivative(null, modsStream, null, "text/plain", null); repoObjFactory.createRelationship(this, Cdr.hasMods, mods.getResource()); return fileObj; }
Source:
<code>public void exportToTsv(@Nullable OutputStream stream) { TableViewer <START> statsViewer = <END> getTableViewer(); if (statsViewer == null) { return; } Table table = statsViewer.getTable(); ExportToTsvUtils.exportTableToTsv(table, stream); }</code><technical_language>stats</technical_language>

Target:
public void exportToTsv(@Nullable OutputStream stream) { TableViewer tableViewer = getTableViewer(); if (tableViewer == null) { return; } Table table = tableViewer.getTable(); ExportToTsvUtils.exportTableToTsv(table, stream); }
Source:
<code>private Object interpretDistanceToSpritePosition(Sprite currentSprite, String secondSpriteName) { Sprite secondSprite; try { secondSprite = ProjectManager.getInstance().getSceneToPlay().getSpriteBySpriteName(secondSpriteName); } catch (Resources.NotFoundException exception) { return 0d; <START> } <END> float secondSpriteXPosition = secondSprite.look.getXInUserInterfaceDimensionUnit(); float secondSpriteYPosition = secondSprite.look.getYInUserInterfaceDimensionUnit(); return currentSprite.look.getDistanceToInUserInterfaceDimensions(secondSpriteXPosition, secondSpriteYPosition); }</code><technical_language>of methods in try block throw a NotFoundException</technical_language>

Target:
private Object interpretDistanceToSpritePosition(Sprite currentSprite, String secondSpriteName) { Sprite secondSprite; secondSprite = ProjectManager.getInstance().getSceneToPlay().getSpriteBySpriteName(secondSpriteName); float secondSpriteXPosition = secondSprite.look.getXInUserInterfaceDimensionUnit(); float secondSpriteYPosition = secondSprite.look.getYInUserInterfaceDimensionUnit(); return currentSprite.look.getDistanceToInUserInterfaceDimensions(secondSpriteXPosition, secondSpriteYPosition); }
Source:
<code>private List<String> checkSeitenOhneDocstructs(FileformatInterface inRdf) throws PreferencesException { List<String> result = new ArrayList<>(); DocStructInterface boundBook = inRdf.getDigitalDocument().getPhysicalDocStruct(); if (boundBook == null || boundBook.getAllChildren() == null) { return result; } <START> for (DocStructInterface docStructInterface : boundBook.getAllChildren()) { <END> List<ReferenceInterface> refs = docStructInterface.getAllFromReferences(); String physical = ""; String logical = ""; if (refs.size() == 0) { for (MetadataInterface metadataInterface : docStructInterface.getAllMetadata()) { if (metadataInterface.getMetadataType().getName().equals("logicalPageNumber")) { logical = " (" + metadataInterface.getValue() + ")"; } if (metadataInterface.getMetadataType().getName().equals("physPageNumber")) { physical = metadataInterface.getValue(); } } result.add(physical + logical); } } return result; }</code><technical_language>Interface appended name of variable</technical_language>

Target:
private List<String> checkSeitenOhneDocstructs(FileformatInterface inRdf) throws PreferencesException { List<String> result = new ArrayList<>(); DocStructInterface boundBook = inRdf.getDigitalDocument().getPhysicalDocStruct(); if (boundBook == null || boundBook.getAllChildren() == null) { return result; } for (DocStructInterface docStruct : boundBook.getAllChildren()) { List<ReferenceInterface> refs = docStruct.getAllFromReferences(); String physical = ""; String logical = ""; if (refs.size() == 0) { for (MetadataInterface metadata : docStruct.getAllMetadata()) { if (metadata.getMetadataType().getName().equals("logicalPageNumber")) { logical = " (" + metadata.getValue() + ")"; } if (metadata.getMetadataType().getName().equals("physPageNumber")) { physical = metadata.getValue(); } } result.add(physical + logical); } } return result; }
Source:
<code>protected boolean canRunActionOnNonManagedVm() { <START> ValidationResult nonManagedVmValidationResult = VmHandler.canRunActionOnNonManagedVm(getVm(), getActionType()); <END> if (!nonManagedVmValidationResult.isValid()) { return failCanDoAction(nonManagedVmValidationResult.getMessage()); } return true; }</code><technical_language>a nice change, unrelated this patch in a separate one</technical_language>

Target:
protected boolean canRunActionOnNonManagedVm() { ValidationResult nonManagedVmValidationResult = VmHandler.canRunActionOnNonManagedVm(getVm(), this.getActionType()); if (!nonManagedVmValidationResult.isValid()) { return failCanDoAction(nonManagedVmValidationResult.getMessage()); } return true; }
Source:
<code>public long fastForwardFromEdits(DataTree dt, Map<Long, Integer> sessions, PlayBackListener listener) throws IOException { TxnIterator itr = txnLog.read(dt.lastProcessedZxid+1); long highestZxid = dt.lastProcessedZxid; TxnHeader hdr; int txnLoaded = 0; long startTime = Time.currentElapsedTime(); try { while (true) { hdr = itr.getHeader(); if (hdr == null) { return dt.lastProcessedZxid; } if (hdr.getZxid() < highestZxid && highestZxid != 0) { LOG.error("{}(highestZxid) > {}(next log) for type {}", highestZxid, hdr.getZxid(), hdr.getType()); } else { highestZxid = hdr.getZxid(); } try { processTransaction(hdr,dt,sessions, itr.getTxn()); <START> txnLoaded ++; <END> } catch(KeeperException.NoNodeException e) { throw new IOException("Failed to process transaction type: " + hdr.getType() + " error: " + e.getMessage(), e); } listener.onTxnLoaded(hdr, itr.getTxn()); if (!itr.next()) break; } } finally { if (itr != null) { itr.close(); } } long loadTime = Time.currentElapsedTime() - startTime; LOG.info("{} txns loaded in ms", txnLoaded, loadTime); ServerMetrics.STARTUP_TXNS_LOADED.add(txnLoaded); ServerMetrics.STARTUP_TXNS_LOAD_TIME.add(loadTime); return highestZxid; }</code><technical_language>Extra whitespace in command</technical_language>

Target:
public long fastForwardFromEdits(DataTree dt, Map<Long, Integer> sessions, PlayBackListener listener) throws IOException { TxnIterator itr = txnLog.read(dt.lastProcessedZxid+1); long highestZxid = dt.lastProcessedZxid; TxnHeader hdr; int txnLoaded = 0; long startTime = Time.currentElapsedTime(); try { while (true) { hdr = itr.getHeader(); if (hdr == null) { return dt.lastProcessedZxid; } if (hdr.getZxid() < highestZxid && highestZxid != 0) { LOG.error("{}(highestZxid) > {}(next log) for type {}", highestZxid, hdr.getZxid(), hdr.getType()); } else { highestZxid = hdr.getZxid(); } try { processTransaction(hdr,dt,sessions, itr.getTxn()); txnLoaded++; } catch(KeeperException.NoNodeException e) { throw new IOException("Failed to process transaction type: " + hdr.getType() + " error: " + e.getMessage(), e); } listener.onTxnLoaded(hdr, itr.getTxn()); if (!itr.next()) break; } } finally { if (itr != null) { itr.close(); } } long loadTime = Time.currentElapsedTime() - startTime; LOG.info("{} txns loaded in ms", txnLoaded, loadTime); ServerMetrics.getMetrics().STARTUP_TXNS_LOADED.add(txnLoaded); ServerMetrics.getMetrics().STARTUP_TXNS_LOAD_TIME.add(loadTime); return highestZxid; }
Source:
<code>public void getMessages() { testingClient.server().run(session -> { try { ThemeProvider extending = session.getProvider(ThemeProvider.class, "extending"); Theme theme = extending.getTheme("base", Theme.Type.LOGIN); <START> System.out.println(theme.getMessages("messages", Locale.ENGLISH)); <END> Assert.assertNotNull(theme.getMessages("messages", Locale.ENGLISH).get("test.keycloak-8818")); Assert.assertEquals("Keycloak Admin Console (from theme-resources)", theme.getMessages("admin-messages", Locale.ENGLISH).get("consoleTitle")); } catch (IOException e) { Assert.fail(e.getMessage()); } }); }</code><technical_language>Please remove this line want this output running tests</technical_language>

Target:
public void getMessages() { testingClient.server().run(session -> { try { ThemeProvider extending = session.getProvider(ThemeProvider.class, "extending"); Theme theme = extending.getTheme("base", Theme.Type.LOGIN); Assert.assertNotNull(theme.getMessages("messages", Locale.ENGLISH).get("test.keycloak-8818")); Assert.assertNotEquals("Full name (Theme-resources)", theme.getMessages("messages", Locale.ENGLISH).get("fullName")); } catch (IOException e) { Assert.fail(e.getMessage()); } }); }
Source:
<code>public ClientServiceInvokeRequest(BinaryReaderExImpl reader) { super(reader); name = reader.readString(); flags = reader.readByte(); timeout = reader.readLong(); int cnt = reader.readInt(); nodeIds = U.newHashSet(cnt); for (int i = 0; i < cnt; i++) nodeIds.add(reader.readUuid()); methodName = reader.readString(); paramTypeIds = reader.readIntArray(); int argCnt = reader.readInt(); args = new Object[argCnt]; <START> this.reader = reader; <END> int argsStartPos = reader.in().position(); for (int i = 0; i < argCnt; i++) args[i] = reader.readObjectDetached(); reader.in().position(argsStartPos); }</code><technical_language>This is making a big assumption reader is valid this constructor exited. I currently this works, great avoid this - fragile</technical_language>

Target:
public ClientServiceInvokeRequest(BinaryReaderExImpl reader) { super(reader); name = reader.readString(); flags = reader.readByte(); timeout = reader.readLong(); int cnt = reader.readInt(); nodeIds = new ArrayList<>(cnt); for (int i = 0; i < cnt; i++) nodeIds.add(new UUID(reader.readLong(), reader.readLong())); methodName = reader.readString(); int argCnt = reader.readInt(); paramTypeIds = hasParameterTypes() ? new int[argCnt] : null; args = new Object[argCnt]; this.reader = reader; int argsStartPos = reader.in().position(); for (int i = 0; i < argCnt; i++) { if (paramTypeIds != null) paramTypeIds[i] = reader.readInt(); args[i] = reader.readObjectDetached(); } reader.in().position(argsStartPos); }
Source:
<code>public void stopLifecyclesInRole(String role) { if (this.lazyLifecycles.size() > 0) { addLazyLifecycles(); } <START> List<SmartLifecycle> lifecycles = new ArrayList<SmartLifecycle>(this.lifecycles.get(role)); <END> if (lifecycles != null) { Collections.sort(lifecycles, new Comparator<SmartLifecycle>() { @Override public int compare(SmartLifecycle o1, SmartLifecycle o2) { return o1.getPhase() < o2.getPhase() ? 1 : o1.getPhase() > o2.getPhase() ? -1 : 0; } }); for (SmartLifecycle lifecycle : lifecycles) { try { lifecycle.stop(); } catch (Exception e) { logger.error("Failed to stop " + lifecycle + " in role " + role); } } } }</code><technical_language>NPE issue is</technical_language>

Target:
public void stopLifecyclesInRole(String role) { if (this.lazyLifecycles.size() > 0) { addLazyLifecycles(); } List<SmartLifecycle> lifecycles = this.lifecycles.get(role); if (lifecycles != null) { lifecycles = new ArrayList<SmartLifecycle>(lifecycles); Collections.sort(lifecycles, new Comparator<SmartLifecycle>() { @Override public int compare(SmartLifecycle o1, SmartLifecycle o2) { return o1.getPhase() < o2.getPhase() ? 1 : o1.getPhase() > o2.getPhase() ? -1 : 0; } }); for (SmartLifecycle lifecycle : lifecycles) { try { lifecycle.stop(); } catch (Exception e) { logger.error("Failed to stop " + lifecycle + " in role " + role); } } } }
Source:
<code>public void onVisitorPickup(final PlayerPickupItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!IslandGuard.inWorld(e.getPlayer())) { return; } if (plugin.getGrid().isAtSpawn(e.getItem().getLocation())) { if (Settings.allowSpawnVisitorItemPickup || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } } <START> if (plugin.getGrid().getIslandAt(e.getItem().getLocation()).getIgsFlag(Flags.allowVisitorItemDrop) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") <END> || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } e.setCancelled(true); }</code><technical_language>plugin.getGrid().getIslandAt(e.getItem().getLocation()) return a null if is island location. This happen admins create places in world classed island spawn. So, please add a null check</technical_language>

Target:
public void onVisitorPickup(final PlayerPickupItemEvent e) { if (DEBUG) { plugin.getLogger().info(e.getEventName()); } if (!IslandGuard.inWorld(e.getPlayer())) { return; } if (plugin.getGrid().isAtSpawn(e.getItem().getLocation())) { if (Settings.allowSpawnVisitorItemPickup || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } } if ((plugin.getGrid().getIslandAt(e.getItem().getLocation()) != null && plugin.getGrid().getIslandAt(e.getItem().getLocation()).getIgsFlag(Flags.allowVisitorItemDrop)) || e.getPlayer().isOp() || VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect") || plugin.getGrid().locationIsOnIsland(e.getPlayer(), e.getItem().getLocation())) { return; } e.setCancelled(true); }
Source:
<code>public PriamConfigurationPersister(IConfiguration config) { super(config); mergedConfigDirectory = Paths.get(config.getMergedConfigurationDirectory()); structuredPath = Paths.get(config.getMergedConfigurationDirectory(), "structured.json"); <START> <END> initialized = false; canWrite = false; }</code><technical_language>church of EAFP, spread good word. considered writing heavenly code, so? if(directory.mkdirs()) { Files.setPosixFilePermissions(mergedConfigDirectory, 0700); } allow eliminate canWrite variable, throw exception instead. run this iteration (once minute), a single mkdir* syscall is resource-intensive. * I checked, JVM LBYLs a stat() syscall instead</technical_language>

Target:
public PriamConfigurationPersister(IConfiguration config) { super(config); mergedConfigDirectory = Paths.get(config.getMergedConfigurationDirectory()); structuredPath = Paths.get(config.getMergedConfigurationDirectory(), "structured.json"); }
Source:
<code>private CollectedUpdateMetrics extractMetrics(String[] lines) throws IOException { CollectedUpdateMetrics collectedUpdateMetrics = new CollectedUpdateMetrics(); Iterator<String> lineIterator = Stream.of(lines) .filter(line -> line.startsWith("><body<p>totalElapsed")) .collect(Collectors.toList()) .iterator(); <START> for (MultiSyncStep step : MultiSyncStep.values()) { <END> if (lineIterator.hasNext()) collectedUpdateMetrics.add(step, getUpdateMetrics(lineIterator.next())); else break; } Map<String, String> lastLineMetrics = Stream.of(lines) .filter(line -> line.contains(COMMIT_TOTAL_ELAPSED)) .flatMap(this::extractStandardLinesMetrics) .collect(toMapCollector()); Integer commitTotalElapsed = asInt(lastLineMetrics.get(COMMIT_TOTAL_ELAPSED)); if (commitTotalElapsed != null) collectedUpdateMetrics.setCommitTotalElapsed(commitTotalElapsed); Integer mutationCount = asInt(lastLineMetrics.get("mutationCount")); if (mutationCount == null) throw new IOException("Couldn't find the mutation count!"); if (mutationCount != null) collectedUpdateMetrics.setMutationCount(mutationCount); return collectedUpdateMetrics; }</code><technical_language>need of optional updates have. In case send 6 lines do 6th line is createCleanupReferencesQuery createCleanupValuesQuery ? perfectly fine build this response handler time build query, track of MultiSyncStep steps sent. A response handler static. emit a warning if steps expect present in response</technical_language>

Target:
private CollectedUpdateMetrics extractMetrics(String[] lines) throws IOException { CollectedUpdateMetrics collectedUpdateMetrics = new CollectedUpdateMetrics(); Iterator<String> lineIterator = getPerQueryResponses(lines); for (MultiSyncStep step : MultiSyncStep.values()) { if (lineIterator.hasNext()) collectedUpdateMetrics.add(step, getUpdateMetrics(lineIterator.next())); else break; }§ Map<String, String> summaryMetrics = extractSummaryMetrics(lines); Integer commitTotalElapsed = asInt(summaryMetrics.get(COMMIT_TOTAL_ELAPSED)); if (commitTotalElapsed != null) collectedUpdateMetrics.setCommitTotalElapsed(commitTotalElapsed); Integer mutationCount = asInt(summaryMetrics.get(MUTATION_COUNT)); if (mutationCount == null) throw new IOException("Couldn't find the mutation count!"); collectedUpdateMetrics.setMutationCount(mutationCount); return collectedUpdateMetrics; }
Source:
<code>public Handler[] getHandlers() { <START> return handlers.keySet().stream().map(key -> handlers.get(key)).toArray(Handler[]::new); <END> }</code><technical_language>Changing Trie ArrayTernaryTrie introduces entrySet eliminate lookup in a loop. java private final ArrayTernaryTrie<Handler> handlers; handlers.entrySet().stream().map(Map.Entry::getValue).toArray(Handler[]::new); <LINK_0></technical_language>

Target:
public Handler[] getHandlers() { return handlers.entrySet().stream().map(e -> e.getValue()).toArray(Handler[]::new); }
Source:
<code>private void generateBloomFilterAndPersist() throws IOException { List<IndexEntry> entries = new ArrayList<>(); getIndexEntriesSince(null, new FindEntriesCondition(Long.MAX_VALUE), entries, new AtomicLong(0), true); for (IndexEntry entry : entries) { <START> bloomFilter.add(ByteBuffer.wrap(entry.getKey().toBytes())); <END> } persistBloomFilter(); }</code><technical_language>is bloomfilter initialized in this flow</technical_language>

Target:
private void generateBloomFilterAndPersist() throws IOException { List<IndexEntry> entries = new ArrayList<>(); getIndexEntriesSince(null, new FindEntriesCondition(Long.MAX_VALUE), entries, new AtomicLong(0), true); bloomFilter = FilterFactory.getFilter(entries.size(), config.storeIndexBloomMaxFalsePositiveProbability); for (IndexEntry entry : entries) { bloomFilter.add(ByteBuffer.wrap(entry.getKey().toBytes())); } persistBloomFilter(); }
Source:
<code>private void createSourceFile(GeneratedType model, ModelWriter modelWriter, Filer filer) { String fileName = ""; <START> if ( !Strings.isEmpty( model.getPackageName() ) ) { <END> fileName += model.getPackageName() + "."; } fileName += model.getName(); JavaFileObject sourceFile; try { sourceFile = filer.createSourceFile( fileName ); } catch ( IOException e ) { throw new RuntimeException( e ); } modelWriter.writeModel( sourceFile, model ); }</code><technical_language>new method fit nicely: if( model.hasPackageName() ) { ... }</technical_language>

Target:
private void createSourceFile(GeneratedType model, ModelWriter modelWriter, Filer filer) { String fileName = ""; if ( model.hasPackageName() ) { fileName += model.getPackageName() + "."; } fileName += model.getName(); JavaFileObject sourceFile; try { sourceFile = filer.createSourceFile( fileName ); } catch ( IOException e ) { throw new RuntimeException( e ); } modelWriter.writeModel( sourceFile, model ); }
Source:
<code>public Iterable<ConnectorIssue> analyze(MavenProject mavenProject) { List<ConnectorIssue> issues = Lists.newArrayList(super.analyze(mavenProject)); if (issues.isEmpty()) { Collection<File> testFiles = FileUtils.listFiles(fileSystem.baseDir(), new WildcardFileFilter(PATH), TrueFileFilter.INSTANCE); if (testFiles.size() > 1) { issues.add(new ConnectorIssue(KEY, "More than one .gitignore file in project.")); } else { try { List<String> gitIgnoreElements = FileUtils.readLines(Iterables.getOnlyElement(testFiles), StandardCharsets.UTF_8); Iterable<String> missingRequiredFields = Iterables.filter(requiredGitignoreFields, new matchesPredicate(gitIgnoreElements, applyByTrue)); if (!Iterables.isEmpty(missingRequiredFields)) { missingRequiredFields = Iterables.transform(missingRequiredFields, new Function<String, String>() { @Override public String apply(String input) { return input.replaceAll("(\\\\)|( *\\[/]\\?)|( *\\[\\*]\\?)", ""); } }); <START> issues.add(new ConnectorIssue(KEY, String.format(issueMessage, Joiner.on(", ") <END> .join(missingRequiredFields)))); } } catch (IOException e) { Throwables.propagate(e); } } } return issues; }</code><technical_language>ruleKey() instead of KEY this is inherited</technical_language>

Target:
public Iterable<ConnectorIssue> analyze(MavenProject mavenProject) { List<ConnectorIssue> issues = Lists.newArrayList(super.analyze(mavenProject)); System.out.println(getFileSystem().baseDir()); if (FileUtils.listFiles(getFileSystem().baseDir(), new WildcardFileFilter(PATH), TrueFileFilter.INSTANCE).size() > BigInteger.ONE.intValue()) { issues.add(new ConnectorIssue(KEY, "More than one .gitignore file in project.")); } return issues; }
Source:
<code>private static String checkVoltDBRootExistence(String newRootPath) { Path newRoot = Paths.get(newRootPath); if (!Files.exists(newRoot)) { return newRoot + " doesn't exist."; } else if (!Files.isDirectory(newRoot)) { <START> return newRoot + " does exist, but it doesn't look like a directory."; <END> } return "Success"; }</code><technical_language>simpler: "return newRoot + " is a directory.";</technical_language>

Target:
private static String checkVoltDBRootExistence(String newRootPath) { Path newRoot = Paths.get(newRootPath); if (!Files.exists(newRoot)) { return newRoot + " doesn't exist."; } else if (!Files.isDirectory(newRoot)) { return newRoot + " is not a directory."; } return SUCCESS; }
Source:
<code>public void visitStatementList(PyStatementListTree pyStatementListTree) { <START> if (isStmtListIncrementsNestingLevel(pyStatementListTree) && !pyStatementListTree.parent().is(Kind.FILE_INPUT)) { <END> nestingLevelStack.peek().increment(); super.visitStatementList(pyStatementListTree); nestingLevelStack.peek().decrement(); } else { super.visitStatementList(pyStatementListTree); } }</code><technical_language>move logic Kind.FILE_INPUT isStmtListIncrementsNestingLevel</technical_language>

Target:
public void visitStatementList(PyStatementListTree pyStatementListTree) { if (isStmtListIncrementsNestingLevel(pyStatementListTree)) { nestingLevelStack.peek().increment(); super.visitStatementList(pyStatementListTree); nestingLevelStack.peek().decrement(); } else { super.visitStatementList(pyStatementListTree); } }
Source:
<code>public boolean isEmpty() { <START> return (elementsInFile == 0) && this.list.size() == 0; <END> }</code><technical_language>this.size()</technical_language>

Target:
public boolean isEmpty() { return this.size() == 0; }
Source:
<code>private static String getUserName(Cause cause) { <START> if (Cause.UserIdCause.class.isInstance(cause)) { <END> Cause.UserIdCause userIdCause = (UserIdCause) cause; return userIdCause.getUserName(); } return null; }</code><technical_language>(legacy class Java operator)</technical_language>

Target:
private static String getUserName(Cause cause) { if (cause instanceof UserIdCause) { Cause.UserIdCause userIdCause = (UserIdCause) cause; return userIdCause.getUserName(); } else if (cause instanceof UserCause) { Cause.UserCause userCause = (UserCause) cause; return userCause.getUserName(); } return ""; }