auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static Set<Set<Integer>> computeStronglyConnectedComponents(final int numVertex, final List<List<Integer>> outEdges) { final Set<Set<Integer>> stronglyConnectedComponents = new HashSet<>(); final int[] vertexIndices = new int[numVertex]; Arrays.fill(vertexIndices, -1); final int[] vertexLowLinks = new int[numVertex]; <START> final Deque<Integer> stack = new ArrayDeque<>(numVertex); <END> final boolean[] onStack = new boolean[numVertex]; final AtomicInteger indexCounter = new AtomicInteger(0); for (int vertex = 0; vertex < numVertex; vertex++) { if (vertexIndices[vertex] == -1) { dfs(vertex, outEdges, vertexIndices, vertexLowLinks, stack, onStack, indexCounter, stronglyConnectedComponents); } } return stronglyConnectedComponents; }</code><technical_language>suggestion final Deque<Integer> ccStack = new ArrayDeque<>(numVertex);</technical_language>

Target:
static Set<Set<Integer>> computeStronglyConnectedComponents(final int numVertex, final List<List<Integer>> outEdges) { final Set<Set<Integer>> stronglyConnectedComponents = new HashSet<>(); final Deque<Integer> visitingStack = new ArrayDeque<>(numVertex); final boolean[] onVisitingStack = new boolean[numVertex]; final int[] vertexIndices = new int[numVertex]; Arrays.fill(vertexIndices, -1); final AtomicInteger indexCounter = new AtomicInteger(0); final int[] vertexLowLinks = new int[numVertex]; for (int vertex = 0; vertex < numVertex; vertex++) { if (!isVisited(vertex, vertexIndices)) { dfs(vertex, outEdges, vertexIndices, vertexLowLinks, visitingStack, onVisitingStack, indexCounter, stronglyConnectedComponents); } } return stronglyConnectedComponents; }
Source:
<code>private void impl$refreshTrackerStates(EntityType<?> entityType, net.minecraft.world.World world, CallbackInfo ci) { this.bridge$refreshTrackerStates(); final EntityTypeBridge entityTypeBridge = (EntityTypeBridge) entityType; if (!entityTypeBridge.bridge$checkedDamageEntity()) { try { <START> final String mapping = SpongeImplHooks.isDeobfuscatedEnvironment() ? "attackEntityFrom" : "func_70097_a"; <END> final Class<?>[] argTypes = {DamageSource.class, float.class}; final Class<?> clazz = this.getClass().getMethod(mapping, argTypes).getDeclaringClass(); if (!(clazz.equals(LivingEntity.class) || clazz.equals(PlayerEntity.class) || clazz.equals(ServerPlayerEntity.class))) { entityTypeBridge.bridge$setOverridesDamageEntity(true); } } catch (Throwable ex) { } finally { entityTypeBridge.bridge$setCheckedDamageEntity(true); } } }</code><technical_language>move Constants class</technical_language>

Target:
private void impl$refreshTrackerStates(EntityType<?> entityType, net.minecraft.world.World world, CallbackInfo ci) { this.bridge$refreshTrackerStates(); final EntityTypeBridge entityTypeBridge = (EntityTypeBridge) entityType; if (!entityTypeBridge.bridge$checkedDamageEntity()) { try { final String mapping = SpongeImplHooks.isDeobfuscatedEnvironment() ? Constants.Entity.ATTACK_ENTITY_FROM_MAPPING : Constants.Entity.ATTACK_ENTITY_FROM_OBFUSCATED; final Class<?>[] argTypes = {DamageSource.class, float.class}; final Class<?> clazz = this.getClass().getMethod(mapping, argTypes).getDeclaringClass(); if (!(clazz.equals(LivingEntity.class) || clazz.equals(PlayerEntity.class) || clazz.equals(ServerPlayerEntity.class))) { entityTypeBridge.bridge$setOverridesDamageEntity(true); } } catch (Throwable ex) { } finally { entityTypeBridge.bridge$setCheckedDamageEntity(true); } } }
Source:
<code>public CommandCallback getCallback() { if (getVm().isQualifiedForLiveSnapshotMerge() || getParameters().isUseCinderCommandCallback() || <START> FeatureSupported.isQemuimgCommitSupported(getStoragePool().getCompatibilityVersion())) { <END> return new ConcurrentChildCommandsExecutionCallback(); } return null; }</code><technical_language>please export this check a method, long repeating times</technical_language>

Target:
public CommandCallback getCallback() { if (getVm().isQualifiedForLiveSnapshotMerge() || getParameters().isUseCinderCommandCallback() || isQemuimgCommitSupported()) { return new ConcurrentChildCommandsExecutionCallback(); } return null; }
Source:
<code>public void testSimpleRootListing() throws IOException { describe("test the nonrecursive root listing calls"); FileSystem fs = getFileSystem(); Path root = new Path("/"); FileStatus[] statuses = fs.listStatus(root); String listStatusResult = join(statuses, "\n"); List<LocatedFileStatus> locatedStatusList = toList( fs.listLocatedStatus(root)); String locatedStatusResult = join(locatedStatusList, "\n"); assertEquals("listStatus(/) vs listLocatedStatus(/) with \n" + "listStatus =" + listStatusResult +" listLocatedStatus = " + locatedStatusResult, statuses.length, locatedStatusList.size()); List<LocatedFileStatus> fileList = toList(fs.listFiles(root, false)); String listFilesResult = join(fileList, "\n"); assertTrue("listStatus(/) vs listFiles(/, false) with \n" + "listStatus = " + listStatusResult + "listFiles = " + listFilesResult, fileList.size() <= statuses.length); List<FileStatus> statusList = (List<FileStatus>) iteratorToList( fs.listStatusIterator(root)); <START> String listStatusItrRes = join(statusList, "\n"); <END> assertEquals("listStatus(/) vs listStatusIterator(/) with \n" + "listStatus =" + listStatusResult +" listLocatedStatus = " + listStatusItrRes, statuses.length, statusList.size()); }</code><technical_language>if sets of listing collections, Assertions.assertThat() done earlier</technical_language>

Target:
public void testSimpleRootListing() throws IOException { describe("test the nonrecursive root listing calls"); FileSystem fs = getFileSystem(); Path root = new Path("/"); FileStatus[] statuses = fs.listStatus(root); String listStatusResult = join(statuses, "\n"); List<LocatedFileStatus> locatedStatusList = toList( fs.listLocatedStatus(root)); String locatedStatusResult = join(locatedStatusList, "\n"); assertEquals("listStatus(/) vs listLocatedStatus(/) with \n" + "listStatus =" + listStatusResult +" listLocatedStatus = " + locatedStatusResult, statuses.length, locatedStatusList.size()); List<LocatedFileStatus> fileList = toList(fs.listFiles(root, false)); String listFilesResult = join(fileList, "\n"); assertTrue("listStatus(/) vs listFiles(/, false) with \n" + "listStatus = " + listStatusResult + "listFiles = " + listFilesResult, fileList.size() <= statuses.length); List<FileStatus> statusList = (List<FileStatus>) iteratorToList( fs.listStatusIterator(root)); Assertions.assertThat(statusList) .describedAs("Result of listStatus(/) and listStatusIterator(/)" + " must match") .hasSameElementsAs(Arrays.stream(statuses) .collect(Collectors.toList())); }
Source:
<code>Object[] generateReturnValues(Doc doc) { cntx.expressions().forEach(x -> x.setNextRow(doc)); <START> List<Object> result = map(cntx.topLevelInputs(), Input::value); return result.isEmpty() ? null : result.toArray(); <END> }</code><technical_language>like: if (ctx.topLevelInputs.isEmpty()) { return null; } Object[] result = new Object[ctx.topLevelInputs().size()]; for (int i = 0; i < result.length; i++) { result[i] = ctx.topLevelInputs().get(i).value(); } return result; avoid some indirections. pre-assign topLevelInputs + expressions attribute in CTOR a reference context itself. Allows GC InputFactory.Context earlier pulls in some other objects</technical_language>

Target:
Object[] generateReturnValues(Doc doc) { if (inputs.isEmpty()) { return null; } expressions.forEach(x -> x.setNextRow(doc)); Object[] result = new Object[inputs.size()]; for (int i = 0; i < result.length; i++) { result[i] = inputs.get(i).value(); } return result; }
Source:
<code>public void printHelp(ICommandSender sender) { super.printHelp(sender); World world = CommandHelpers.getWorld(sender, this); <START> String message = StringUtil.localize("chat.bees.command.mode.current"); <END> message = message.replaceAll("%MODE", PluginApiculture.beeInterface.getBeekeepingMode(world).getName()); message = message.replaceAll("%WORLD", String.valueOf(world.getWorldInfo().getSaveVersion())); CommandHelpers.sendChatMessage(sender, message); CommandHelpers.sendChatMessage(sender, StringUtil.localizeAndFormat("chat.bees.command.mode.help", helpString)); }</code><technical_language>This rewritten sendLocalizedChat()</technical_language>

Target:
public void printHelp(ICommandSender sender) { super.printHelp(sender); World world = CommandHelpers.getWorld(sender, this); String modeName = PluginApiculture.beeInterface.getBeekeepingMode(world).getName(); String worldName = String.valueOf(world.getWorldInfo().getSaveVersion()); CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.mode.info.current", modeName, worldName); CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.beekeeping.mode.info.available", helpString); }
Source:
<code>public void addAnnotatedType(AnnotatedType<?> type, String id) { checkWithinObserverNotification(); addSyntheticAnnotatedType(type, id); <START> BootstrapLogger.LOG.addAnnotatedTypeCalled(receiver.getClass().getName(), type.getJavaClass()); <END> }</code><technical_language>I getReceiver().getClass() enough. consider type.toString() instead of type.getJavaClass()</technical_language>

Target:
public void addAnnotatedType(AnnotatedType<?> type, String id) { checkWithinObserverNotification(); addSyntheticAnnotatedType(type, id); BootstrapLogger.LOG.addAnnotatedTypeCalled(getReceiver(), type); }
Source:
<code>public static String speedToString(float speed, Resources resources) { float kmph = (float)3.6*speed; if (kmph < 1) return String.format("%.1g %s", kmph, resources.getString(R.string.trackmgr_speed_kmph)); <START> else if (kmph < 20) <END> return String.format("%.1f %s", kmph, resources.getString(R.string.trackmgr_speed_kmph)); else return String.format("%d %s", Math.round(kmph), resources.getString(R.string.trackmgr_speed_kmph)); }</code><technical_language>Some values (20, 10, 100, 1000 above) put in constants</technical_language>

Target:
public static String speedToString(float speed, Resources resources) { float kmph = (float)3.6*speed; if (kmph < 1) { return resources.getString(R.string.trackmgr_speed_in_kmph).replace("{0}", String.format("%.1g", kmph)); } else if (kmph < STOP_SHOWING_DECIMALS_AFTER) { return resources.getString(R.string.trackmgr_speed_in_kmph).replace("{0}", String.format("%.1f", kmph)); } else { return resources.getString(R.string.trackmgr_speed_in_kmph).replace("{0}", String.valueOf(Math.round(kmph))); } }
Source:
<code>public void initialize(final Query baseQuery) { transition(State.NEW, State.INITIALIZED); String queryId = baseQuery.getId(); if (Strings.isNullOrEmpty(queryId)) { queryId = UUID.randomUUID().toString(); } this.queryPlus = QueryPlus.wrap( <START> QueryContexts.withMaxQueryTimeout( <END> (Query) DirectDruidClient.withDefaultTimeoutAndMaxScatterGatherBytes( baseQuery.withId(queryId), serverConfig ), serverConfig.getMaxQueryTimeout()) ); this.toolChest = warehouse.getToolChest(baseQuery); }</code><technical_language>instead, rename DirectDruidClient.withDefaultTimeoutAndMaxScatterGatherBytes(..) DirectDruidClient.withTimeoutAndMaxScatterGatherBytes(..) care of max query timeout in there? Also, I move method DirectDruidClient QueryLifeCycle , more sense there</technical_language>

Target:
public void initialize(final Query baseQuery) { transition(State.NEW, State.INITIALIZED); String queryId = baseQuery.getId(); if (Strings.isNullOrEmpty(queryId)) { queryId = UUID.randomUUID().toString(); } this.queryPlus = QueryPlus.wrap(baseQuery.withId(queryId)); this.toolChest = warehouse.getToolChest(baseQuery); }
Source:
<code>public void initTable(final ImmutableList<String> columnHeads) { this.columnCount = columnHeads.size(); this.header = new ASCIITableHeader[this.columnCount]; for (int i = 0; i < this.columnCount; i++) { <START> header[i] = (new ASCIITableHeader(columnHeads.get(i), ASCIITable.ALIGN_LEFT)); <END> } }</code><technical_language>outer parens required</technical_language>

Target:
public void initTable(final ImmutableList<String> columnHeads) { this.columnCount = columnHeads.size(); this.header = new ASCIITableHeader[this.columnCount]; for (int i = 0; i < this.columnCount; i++) { header[i] = new ASCIITableHeader(columnHeads.get(i), ASCIITable.ALIGN_LEFT); } }
Source:
<code>public ProjectFeatureFlag(String name) { <START> this(name, true, null); <END> }</code><technical_language>check name</technical_language>

Target:
public ProjectFeatureFlag(String name) { this(notEmpty(name, "name"), true, null); }
Source:
<code>public String toJson() { Map<String, Object> map = new HashMap<String, Object>(); map.put(FIELD_HOST, getHost()); map.put(FIELD_SHORT_MESSAGE, getShortMessage()); map.put(FIELD_FULL_MESSAGE, getFullMessage()); map.put(FIELD_TIMESTAMP, getTimestamp()); map.put(FIELD_LEVEL, getLevel()); map.put(FIELD_FACILITY, getFacility()); for (Map.Entry<String, String> additionalField : additonalFields.entrySet()) { if (!ID_NAME.equals(additionalField.getKey())) { Object value; try { value = Double.parseDouble(additionalField.getValue()); } catch (NumberFormatException ex) { value = additionalField.getValue(); } <START> if (!stripLeadingUnderscore) { <END> map.put("_" + additionalField.getKey(), value); } else { map.put("" + additionalField.getKey(), value); } } } return JSONValue.toJSONString(map); }</code><technical_language>please add this method a String additionalFieldPrefix</technical_language>

Target:
public String toJson() { return toJson("_"); }
Source:
<code>public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { <START> int selectedRow = noteTable.convertRowIndexToModel(noteTable.getSelectedRow()); <END> int noteID = (int) noteTable.getModel().getValueAt(selectedRow, 0); HistoryReference hr = extHist.getHistoryReference(noteID); extHist.showInHistory(hr); } }</code><technical_language>need check for row -1 (no selection) ignore it, lead IndexOutOfBoundsException</technical_language>

Target:
public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { if (noteTable.getSelectedRow() == -1) { return; } int selectedRow = noteTable.convertRowIndexToModel(noteTable.getSelectedRow()); int messageId = ((NotesTableModel) noteTable.getModel()).getRow(selectedRow).getMessageId(); HistoryReference hr = extHist.getHistoryReference(messageId); extHist.showInHistory(hr); } }
Source:
<code>public void test_Ubuntu_12_0_4() throws Exception { <START> runTest(ImmutableMap.<String,Object>of("locationId", "dal06")); <END> }</code><technical_language>I thought "dal06" "region" "locationId". is "locationId" (and is in JcloudsLocation etc)</technical_language>

Target:
public void test_Ubuntu_12_0_4() throws Exception { runTest(ImmutableMap.<String,Object>of("imageId", "UBUNTU_12_64")); }
Source:
<code>private static Bitmap getCroppedCircleBitmap(Bitmap inputImage, int diameter) <START> throws IllegalArgumentException <END> { if (inputImage.getWidth() != inputImage.getHeight()) { throw new IllegalArgumentException(); } Bitmap scaledInputImage; if (inputImage.getWidth() != diameter || inputImage.getHeight() != diameter) { scaledInputImage = Bitmap.createScaledBitmap(inputImage, diameter, diameter, false); } else { scaledInputImage = inputImage; } Bitmap outputImage = Bitmap.createBitmap(diameter, diameter, Bitmap.Config.ARGB_8888); Rect rect = new Rect(0, 0, scaledInputImage.getWidth(), scaledInputImage.getHeight()); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setFilterBitmap(true); paint.setDither(true); Canvas canvas = new Canvas(outputImage); canvas.drawARGB(0, 0, 0, 0); canvas.drawCircle(diameter / 2f, diameter / 2f, diameter / 2f, paint); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(scaledInputImage, rect, rect, paint); return outputImage; }</code><technical_language>IllegalArgumentException is unchecked exception. remove method signature</technical_language>

Target:
private static Bitmap getCroppedCircleBitmap(Bitmap inputImage, int diameter) { if (inputImage.getWidth() != inputImage.getHeight()) { throw new IllegalArgumentException("Image should be squared."); } Bitmap scaledInputImage; if (inputImage.getWidth() != diameter || inputImage.getHeight() != diameter) { scaledInputImage = Bitmap.createScaledBitmap(inputImage, diameter, diameter, false); } else { scaledInputImage = inputImage; } Bitmap outputImage = Bitmap.createBitmap(diameter, diameter, Bitmap.Config.ARGB_8888); Rect rect = new Rect(0, 0, scaledInputImage.getWidth(), scaledInputImage.getHeight()); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setFilterBitmap(true); paint.setDither(true); Canvas canvas = new Canvas(outputImage); canvas.drawARGB(0, 0, 0, 0); canvas.drawCircle(diameter / 2f, diameter / 2f, diameter / 2f, paint); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN)); canvas.drawBitmap(scaledInputImage, rect, rect, paint); return outputImage; }
Source:
<code>public IBinding[] findBindings(IASTName n, boolean isPrefix, String[] namespaces) { IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix, namespaces); List<IBinding> filtered = new ArrayList<IBinding>(); ICPPClassType classType = null; if (getParent() instanceof CPPASTCompositeTypeSpecifier) { IASTName className = ((CPPASTCompositeTypeSpecifier) getParent()).getName(); IBinding binding = className.resolveBinding(); if (binding instanceof ICPPClassType) { classType = (ICPPClassType) binding; } } for (IBinding binding : bindings) { <START> if (binding instanceof ITypedef || binding instanceof ICPPAliasTemplate) { <END> IType type = SemanticUtil.getNestedType((IType) binding, SemanticUtil.TDEF); if (type instanceof ICPPClassType) { if (isBaseClassCandidate(classType, (ICPPClassType) type)) filtered.add(binding); } else if (type instanceof ICPPTemplateTypeParameter) { filtered.add(binding); } } else if (binding instanceof ICPPClassType) { if (isBaseClassCandidate(classType, (ICPPClassType) binding)) filtered.add(binding); } else if (binding instanceof ICPPTemplateTypeParameter) { filtered.add(binding); } } return filtered.toArray(new IBinding[filtered.size()]); }</code><technical_language>Rewrite avoid repeated code</technical_language>

Target:
public IBinding[] findBindings(IASTName n, boolean isPrefix, String[] namespaces) { IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix, namespaces); List<IBinding> filtered = new ArrayList<IBinding>(); ICPPClassType classType = null; if (getParent() instanceof CPPASTCompositeTypeSpecifier) { IASTName className = ((CPPASTCompositeTypeSpecifier) getParent()).getName(); IBinding binding = className.resolveBinding(); if (binding instanceof ICPPClassType) { classType = (ICPPClassType) binding; } } for (IBinding binding : bindings) { if (binding instanceof IType) { IType type = (IType) binding; while (type instanceof ITypedef || type instanceof ICPPAliasTemplate) { type = (type instanceof ITypedef) ? ((ITypedef) type).getType() : ((ICPPAliasTemplate) type).getType(); } if (type instanceof ICPPClassType) { if (isBaseClassCandidate(classType, (ICPPClassType) type)) filtered.add(binding); } else if (type instanceof ICPPTemplateTypeParameter) { filtered.add(binding); } } } return filtered.toArray(new IBinding[filtered.size()]); }
Source:
<code>public int getParameterCount(CurveName name) { <START> for (CurveParameterSize entry : data) { <END> if (entry.getName().equals(name)) { return entry.getParameterCount(); } } throw new IllegalArgumentException("Unable to find data for curve: " + name); }</code><technical_language>return data.stream() .filter(entry -> entry.getName().equals(name)) .findFirst() .map(CurveParameterSize::getParameterCount) .orElseThrow(() -> new IllegalArgumentException("Unable find data for curve: " + name));</technical_language>

Target:
public int getParameterCount(CurveName name) { return data.stream() .filter(entry -> entry.getName().equals(name)) .findFirst() .map(CurveParameterSize::getParameterCount) .orElseThrow(() -> new IllegalArgumentException("Unable to find data for curve: " + name)); }
Source:
<code>protected void configure(GenericExporter exporter) { super.configure(exporter); exporter.setEmbeddableAnnotation(Embeddable.class); exporter.setEmbeddedAnnotation(Embedded.class); exporter.setEntityAnnotation(Entity.class); exporter.setSkipAnnotation(Transient.class); exporter.setSupertypeAnnotation(MappedSuperclass.class); <START> exporter.addAnnotationHelper(new TypeFactory.AnnotationHelper() { <END> @Override public boolean isSupported(Class<? extends Annotation> annotationClass) { return Temporal.class.isAssignableFrom(annotationClass); } @Override public Object getCustomKey(Annotation annotation) { return ((Temporal)annotation).value(); } @Override public TypeCategory getTypeByAnnotation(Class<?> cl, Annotation annotation) { switch (((Temporal)annotation).value()){ case DATE: return TypeCategory.DATE; case TIME: return TypeCategory.TIME; case TIMESTAMP: return TypeCategory.DATETIME; } return null; } }); }</code><technical_language>this anonymous class moved out a dedicated class a static final default instance (e.g. INSTANCE) private constructor</technical_language>

Target:
protected void configure(GenericExporter exporter) { super.configure(exporter); exporter.setEmbeddableAnnotation(Embeddable.class); exporter.setEmbeddedAnnotation(Embedded.class); exporter.setEntityAnnotation(Entity.class); exporter.setSkipAnnotation(Transient.class); exporter.setSupertypeAnnotation(MappedSuperclass.class); exporter.addAnnotationHelper(JPATemporalAnnotationHelper.INSTANCE); }
Source:
<code><START> void handleFinish(@Nullable HttpResponse response, @Nullable Throwable error, Span span) { <END> if (response == null && error == null) { throw new IllegalArgumentException( "Either the response or error parameters may be null, but not both"); } if (span.isNoop()) return; long finishTimestamp = response != null ? response.finishTimestamp() : 0L; SpanCustomizer customizer = span.customizer(); try { if (error != null) errorParser.error(error, customizer); responseParser.parse(response, error, span.context(), customizer); } finally { if (finishTimestamp == 0L) { span.finish(); } else { span.finish(finishTimestamp); } } }</code><technical_language>@anuraaga this is check moved HttpClientHandler#handleReceive, if this check moved beginning of handleReceive</technical_language>

Target:
void handleFinish(@Nullable HttpResponse response, @Nullable Throwable error, Span span) { if (response == null && error == null) { throw new IllegalArgumentException( "Either the response or error parameters may be null, but not both"); } if (span.isNoop()) return; if (error != null) { span.error(error); if (response == null) { span.finish(); return; } } try { responseParser.parse(response, span.context(), span.customizer()); } finally { long finishTimestamp = response.finishTimestamp(); if (finishTimestamp == 0L) { span.finish(); } else { span.finish(finishTimestamp); } } }
Source:
<code>public static double stArea(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); <START> return geometry.getEsriGeometry().calculateArea2D(); <END> }</code><technical_language>@Description L138 needs updating</technical_language>

Target:
public static double stArea(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType()); if (type == GeometryType.GEOMETRY_COLLECTION) { double area = 0.0; GeometryCursor cursor = geometry.getEsriGeometryCursor(); while (true) { com.esri.core.geometry.Geometry esriGeometry = cursor.next(); if (esriGeometry == null) { return area; } area += esriGeometry.calculateArea2D(); } } return geometry.getEsriGeometry().calculateArea2D(); }
Source:
<code>private static void init_() { <START> while (aorm == null) { <END> String url = PortalConfiguration.RM_URL.getValueAsString(); String cred_path = PortalConfiguration.RM_CACHE_CREDENTIALS.getValueAsStringOrNull(); try { if (aorm == null) { rm = new RMProxyUserInterface(); aorm = PAActiveObject.turnActive(rm); if (cred_path != null && !(new File(cred_path)).exists()) { logger.error("Credentials path set in " + PortalConfiguration.RM_CACHE_CREDENTIALS.getKey() + " but file " + cred_path + " does not exist"); } if (cred_path != null && new File(cred_path).exists()) { Credentials cred = Credentials.getCredentials(cred_path); aorm.init(url, cred); } else { String login = PortalConfiguration.RM_CACHE_LOGIN.getValueAsString(); String password = PortalConfiguration.RM_CACHE_PASSWORD.getValueAsString(); aorm.init(url, new CredData(login, password)); } } } catch (Exception e) { logger.warn("Could not connect to resource manager at " + url + " retrying in 8 seconds", e); if (aorm != null) { PAActiveObject.terminateActiveObject(aorm, true); aorm = null; } new Sleeper(8 * 1000, logger).sleep(); continue; } } }</code><technical_language>give a name instead of aorm</technical_language>

Target:
private static void init_() { while (rm == null) { String url = PortalConfiguration.RM_URL.getValueAsString(); String cred_path = PortalConfiguration.RM_CACHE_CREDENTIALS.getValueAsStringOrNull(); try { if (rm == null) { rm = PAActiveObject.newActive(RMProxyUserInterface.class, new Object[] {}); if (cred_path != null && !(new File(cred_path)).exists()) { logger.error("Credentials path set in " + PortalConfiguration.RM_CACHE_CREDENTIALS.getKey() + " but file " + cred_path + " does not exist"); } if (cred_path != null && new File(cred_path).exists()) { Credentials cred = Credentials.getCredentials(cred_path); rm.init(url, cred); } else { String login = PortalConfiguration.RM_CACHE_LOGIN.getValueAsString(); String password = PortalConfiguration.RM_CACHE_PASSWORD.getValueAsString(); rm.init(url, new CredData(login, password)); } } } catch (Exception e) { logger.warn("Could not connect to resource manager at " + url + " retrying in 8 seconds", e); if (rm != null) { PAActiveObject.terminateActiveObject(rm, true); rm = null; } new Sleeper(8 * 1000, logger).sleep(); continue; } } }
Source:
<code>public void addIntermediate(GroupByIdBlock groupIdsBlock, Block block) { checkState(rawInputs != null && blockBuilders == null); checkState(block instanceof ArrayBlock); ArrayBlock arrayBlock = (ArrayBlock) block; ColumnarArray columnarArray = toColumnarArray(block); ColumnarRow columnarRow = toColumnarRow(columnarArray.getElementsBlock()); int newPositionCount = columnarRow.getPositionCount(); long[] newGroupIds = new long[newPositionCount]; boolean[] nulls = new boolean[newPositionCount]; int currentRowBlockIndex = 0; for (int groupIdPosition = 0; groupIdPosition < groupIdsBlock.getPositionCount(); groupIdPosition++) { for (int unused = 0; unused < arrayBlock.getBlock(groupIdPosition).getPositionCount(); unused++) { newGroupIds[currentRowBlockIndex] = groupIdsBlock.getGroupId(groupIdPosition); nulls[currentRowBlockIndex] = groupIdsBlock.isNull(groupIdPosition); currentRowBlockIndex++; } } Block[] blocks = new Block[spillingTypes.size()]; for (int channel = 0; channel < spillingTypes.size(); channel++) { blocks[channel] = columnarRow.getField(channel); } <START> Page page = new Page(blocks); <END> GroupByIdBlock squashedGroupIds = new GroupByIdBlock(groupIdsBlock.getGroupCount(), new LongArrayBlock(newPositionCount, Optional.of(nulls), newGroupIds)); rawInputsSize += page.getSizeInBytes(); rawInputs.add(new GroupIdPage(squashedGroupIds, page)); }</code><technical_language>check state output instanceof ArrayBlockBuilder</technical_language>

Target:
public void addIntermediate(GroupByIdBlock groupIdsBlock, Block block) { checkState(rawInputs != null && blockBuilders == null); checkState(block instanceof ArrayBlock); ArrayBlock arrayBlock = (ArrayBlock) block; ColumnarArray columnarArray = toColumnarArray(block); ColumnarRow columnarRow = toColumnarRow(columnarArray.getElementsBlock()); int newPositionCount = columnarRow.getPositionCount(); long[] newGroupIds = new long[newPositionCount]; boolean[] nulls = new boolean[newPositionCount]; int currentRowBlockIndex = 0; for (int groupIdPosition = 0; groupIdPosition < groupIdsBlock.getPositionCount(); groupIdPosition++) { for (int unused = 0; unused < arrayBlock.getBlock(groupIdPosition).getPositionCount(); unused++) { newGroupIds[currentRowBlockIndex] = groupIdsBlock.getGroupId(groupIdPosition); nulls[currentRowBlockIndex] = groupIdsBlock.isNull(groupIdPosition); currentRowBlockIndex++; } } Block[] blocks = new Block[spillingTypes.size()]; for (int channel = 0; channel < spillingTypes.size(); channel++) { blocks[channel] = columnarRow.getField(channel); } Page page = new Page(blocks); GroupByIdBlock squashedGroupIds = new GroupByIdBlock(groupIdsBlock.getGroupCount(), new LongArrayBlock(newPositionCount, Optional.of(nulls), newGroupIds)); rawInputs.ensureCapacity(rawInputsLength); rawInputs.set(rawInputsLength, new GroupIdPage(squashedGroupIds, page)); rawInputsLength++; }
Source:
<code>@Override public void onCompleted() { if (!terminated) { <START> subscriber.onCompleted(); <END> } }</code><technical_language>terminated = true</technical_language>

Target:
@Override public void onCompleted() { if (!subscriberTerminated) { subscriber.onCompleted(); } }
Source:
<code>private void createPresenterUiHandlers() { if (!presenterConfigModel.isUseAddUihandlers()) { return; } RenderedTemplate renderedTemplate = null; <START> if (presenterConfigModel.getNestedPresenter()) { <END> renderedTemplate = createdNestedPresenterTemplates.getUihandlers(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getUihandlers(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getUihandlers(); } PsiClass createdPsiClass = createPsiClass(createdPresenterPackage, renderedTemplate); createdPsiClass.navigate(true); }</code><technical_language>extract</technical_language>

Target:
private void createPresenterUiHandlers() { if (!presenterConfigModel.isUseAddUihandlers()) { return; } RenderedTemplate renderedTemplate = null; if (presenterConfigModel.getNestedPresenter()) { renderedTemplate = createdNestedPresenterTemplates.getUihandlers(); } else if (presenterConfigModel.getPresenterWidget()) { renderedTemplate = createdPresenterWidgetTemplates.getUihandlers(); } else if (presenterConfigModel.getPopupPresenter()) { renderedTemplate = createdPopupPresenterTemplates.getUihandlers(); } PsiClass createdPsiClass = createPsiClass(createdPresenterPackage, renderedTemplate); navigateToClass(createdPsiClass); }
Source:
<code>public void onEditFailure(@NonNull Throwable caught) { showProgressBar(false); if (caught instanceof MwException) { handleEditingException((MwException) caught); <START> L.e(caught); } else { showRetryDialog(caught); L.e(caught); <END> } }</code><technical_language>common L.e(caught) extracted bottom</technical_language>

Target:
public void onEditFailure(@NonNull Throwable caught) { showProgressBar(false); if (caught instanceof MwException) { handleEditingException((MwException) caught); } else { showRetryDialog(caught); } L.e(caught); }
Source:
<code>public boolean isCurrentlyRead() { if (!getMarkedReadAt().isPresent()) { return false; } <START> if (getUpdatedAt() == null) { <END> return getMarkedReadAt().get().isAfter(getCreatedAt()); } return getMarkedReadAt().get().isAfter(getUpdatedAt()); }</code><technical_language>Is update time null? If this is account for GitHub Issues created, set creation time in TurboIssue constructor</technical_language>

Target:
public boolean isCurrentlyRead() { if (!getMarkedReadAt().isPresent()) { return false; } return getMarkedReadAt().get().isAfter(getUpdatedAt()); }
Source:
<code>protected void applyReceiveOnlyAdviceChain(Collection<Advice> chain) { if (AopUtils.isAopProxy(this.source)) { Advisor[] advisors = ((Advised) this.source).getAdvisors(); for (Advisor advisor : advisors) { Advice advice = advisor.getAdvice(); if (advice != null && this.appliedAdvices.contains(advice)) { ((Advised) this.source).removeAdvice(advice); } } for (Advice advice : chain) { NameMatchMethodPointcutAdvisor sourceAdvice = new NameMatchMethodPointcutAdvisor(advice); <START> sourceAdvice.addMethodName("receive"); <END> ((Advised) this.source).addAdvice(advice); } } else { ProxyFactory proxyFactory = new ProxyFactory(this.source); for (Advice advice : chain) { proxyFactory.addAdvice(advice); } this.source = (MessageSource<?>) proxyFactory.getProxy(getBeanClassLoader()); } this.appliedAdvices.clear(); this.appliedAdvices.addAll(chain); }</code><technical_language>missed something: java for (Advice advice : chain) { NameMatchMethodPointcutAdvisor sourceAdvice = new NameMatchMethodPointcutAdvisor(advice); sourceAdvice.addMethodName("receive"); ((Advised) this.source).addAdvice(advice); } Look, do logic based Advice NameMatchMethodPointcutAdvisor. work in cases do deal restricted Advisor..</technical_language>

Target:
protected void applyReceiveOnlyAdviceChain(Collection<Advice> chain) { if (AopUtils.isAopProxy(this.source)) { for (Advice advice : this.appliedAdvices) { ((Advised) this.source).removeAdvice(advice); } for (Advice advice : chain) { NameMatchMethodPointcutAdvisor sourceAdvisor = new NameMatchMethodPointcutAdvisor(advice); sourceAdvisor.addMethodName("receive"); ((Advised) this.source).addAdvisor(sourceAdvisor); } } else { ProxyFactory proxyFactory = new ProxyFactory(this.source); for (Advice advice : chain) { proxyFactory.addAdvice(advice); } this.source = (MessageSource<?>) proxyFactory.getProxy(getBeanClassLoader()); } this.appliedAdvices.clear(); this.appliedAdvices.addAll(chain); }
Source:
<code>List<InputRow> readAllRows(InputEntityReader reader) throws IOException { List<InputRow> rows = new ArrayList<>(); try (CloseableIterator<InputRow> iterator = reader.read()) { <START> while (iterator.hasNext()) { rows.add(iterator.next()); } <END> } return rows; }</code><technical_language>Another option is do iterator.forEachRemaining(rows::add) instead. Similar for method below</technical_language>

Target:
List<InputRow> readAllRows(InputEntityReader reader) throws IOException { List<InputRow> rows = new ArrayList<>(); try (CloseableIterator<InputRow> iterator = reader.read()) { iterator.forEachRemaining(rows::add); } return rows; }
Source:
<code>public double interestingness() { <START> if (content.isEmpty() || content instanceof SegmentStringCollapsed) { <END> return 0; } final String uninteresting = "N"; final String rawContent = content.toString(); final String cleanContent = rawContent.replace(uninteresting, ""); double contentScore = (rawContent.length() + cleanContent.length()) / 2.0; return contentScore / sources.size(); }</code><technical_language>turn segment SegmentStringCollapsed, if SegmentStringCollapsed 0 interestingness. Sooo interestingness 0 now</technical_language>

Target:
public double interestingness() { if (content.isEmpty()) { return 0; } final String uninteresting = "N"; final String rawContent = content.toString(); final String cleanContent = rawContent.replace(uninteresting, ""); double contentScore = (rawContent.length() + cleanContent.length()) / 2.0; return contentScore / sources.size(); }
Source:
<code>public void testDecodeLiteralResponse() throws Exception { <START> final String literalResponse = "* 1 FETCH {10}\r\n" + "abcdefgh\r\n" + "\r\n"; <END> final byte[] responseBytes = literalResponse.getBytes(StandardCharsets.US_ASCII); final ByteBuf buffer = Unpooled.copiedBuffer(responseBytes, 0, responseBytes.length); final ImapClientRespReader respReader = new ImapClientRespReader(Integer.MAX_VALUE); final ByteBuf resultBuf = (ByteBuf) respReader.decode(null, buffer); final String result = resultBuf.toString(StandardCharsets.US_ASCII); Assert.assertEquals(result, literalResponse); }</code><technical_language>"* 1 FETCH BODY[HEADER] {10}\r\n" + "he: ader\r\n" + "\r\n"</technical_language>

Target:
public void testDecodeLiteralResponse() throws Exception { final String literalResponse = "* 1 FETCH BODY[HEADER] {10}\r\n" + "he: ader\r\n" + "\r\n"; final byte[] responseBytes = literalResponse.getBytes(StandardCharsets.US_ASCII); final ByteBuf buffer = Unpooled.copiedBuffer(responseBytes, 0, responseBytes.length); final ImapClientRespReader respReader = new ImapClientRespReader(Integer.MAX_VALUE); final ByteBuf resultBuf = (ByteBuf) respReader.decode(null, buffer); final String result = resultBuf.toString(StandardCharsets.US_ASCII); Assert.assertEquals(result, literalResponse); }
Source:
<code>private Map<String, ResourceAssignment> getBaselineAssignment( AssignmentMetadataStore assignmentMetadataStore, CurrentStateOutput currentStateOutput, Set<String> resources) throws HelixRebalanceException { Map<String, ResourceAssignment> currentBaseline = Collections.emptyMap(); if (assignmentMetadataStore != null) { try { _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.StateReadLatencyGauge.name(), LatencyMetric.class).startMeasuringLatency(); currentBaseline = assignmentMetadataStore.getBaseline(); <START> _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.StateReadLatencyGauge.name(), LatencyMetric.class).endMeasuringLatency(); <END> } catch (HelixException ex) { LOG.error("Failed to get the current baseline assignment.", ex); } catch (Exception ex) { throw new HelixRebalanceException( "Failed to get the current baseline assignment because of unexpected error.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } if (currentBaseline.isEmpty()) { LOG.warn("The current baseline assignment record is empty. Use the current states instead."); currentBaseline = getCurrentStateAssingment(currentStateOutput, resources); } return currentBaseline; }</code><technical_language>temp var for metric object</technical_language>

Target:
private Map<String, ResourceAssignment> getBaselineAssignment( AssignmentMetadataStore assignmentMetadataStore, CurrentStateOutput currentStateOutput, Set<String> resources) throws HelixRebalanceException { Map<String, ResourceAssignment> currentBaseline = Collections.emptyMap(); if (assignmentMetadataStore != null) { try { LatencyMetric stateReadLatency = _metricCollector.getMetric( WagedRebalancerMetricCollector.WagedRebalancerMetricNames.StateReadLatencyGauge.name(), LatencyMetric.class); stateReadLatency.startMeasuringLatency(); currentBaseline = assignmentMetadataStore.getBaseline(); stateReadLatency.endMeasuringLatency(); } catch (HelixException ex) { LOG.error("Failed to get the current baseline assignment.", ex); } catch (Exception ex) { throw new HelixRebalanceException( "Failed to get the current baseline assignment because of unexpected error.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } if (currentBaseline.isEmpty()) { LOG.warn("The current baseline assignment record is empty. Use the current states instead."); currentBaseline = getCurrentStateAssingment(currentStateOutput, resources); } return currentBaseline; }
Source:
<code><START> private DocumentMetadata.Builder handlePersons(Result result, DocumentMetadata.Builder builder) <END> throws IOException { if (CollectionUtils.isNotEmpty(result.getAuthor())) { List<Author> authors = new ArrayList<>(); for (eu.dnetlib.dhp.schema.oaf.Author sourceAuthor : result.getAuthor()) { Author.Builder authorBuilder = Author.newBuilder(); handleName(sourceAuthor.getName(), authorBuilder); handleSurname(sourceAuthor.getSurname(), authorBuilder); handleFullName(sourceAuthor.getFullname(), authorBuilder); if (isDataValid(authorBuilder)) { authors.add(authorBuilder.build()); } } if (!authors.isEmpty()) { builder.setAuthors(authors); } } return builder; }</code><technical_language>return void exception is thrown</technical_language>

Target:
private static void handlePersons(Result result, DocumentMetadata.Builder builder) throws IOException { if (CollectionUtils.isNotEmpty(result.getAuthor())) { List<Author> authors = result.getAuthor().stream().map(sourceAuthor -> { Author.Builder authorBuilder = Author.newBuilder(); handleName(sourceAuthor.getName(), authorBuilder); handleSurname(sourceAuthor.getSurname(), authorBuilder); handleFullName(sourceAuthor.getFullname(), authorBuilder); return authorBuilder; }).filter(DocumentMetadataConverter::isDataValid).map(Author.Builder::build).collect(Collectors.toList()); if (!authors.isEmpty()) { builder.setAuthors(authors); } } }
Source:
<code>static ThriftDDL filterThriftDDL(ThriftDDL thriftDDL, List<HiveColumnHandle> columns) { if (thriftDDL == null || thriftDDL.getFields() == null || thriftDDL.getFields().isEmpty()) { return thriftDDL; } <START> Set<String> columnNames = new HashSet<>(); <END> for (HiveColumnHandle column : columns) { columnNames.add(column.getName()); } thriftDDL.setFields(thriftDDL.getFields().stream().filter(field -> columnNames.contains(field.getName())).collect(Collectors.toList())); return thriftDDL; }</code><technical_language>do columns.stream() .map(HiveColumnHandle::getName) .collect(toImmutableSet())</technical_language>

Target:
private static ThriftDDL filterThriftDDL(ThriftDDL thriftDDL, List<HiveColumnHandle> columns) { if (thriftDDL == null) { return null; } List<ThriftField> fields = thriftDDL.getFields(); if (fields == null || fields.isEmpty()) { return thriftDDL; } Set<String> columnNames = columns.stream() .map(HiveColumnHandle::getName) .collect(toImmutableSet()); List<ThriftField> filteredFields = fields.stream() .filter(field -> columnNames.contains(field.getName())) .collect(toList()); thriftDDL.setFields(filteredFields); return thriftDDL; }
Source:
<code>public Domain call() throws LibvirtException { long flags = VIR_MIGRATE_LIVE; if (dconn.getLibVirVersion() >= 1000003) { flags += VIR_MIGRATE_COMPRESSED; } if (migrateStorage) { <START> flags += VIR_MIGRATE_NON_SHARED_DISK; <END> } if (autoConvergence && dconn.getLibVirVersion() >= 1002003) { flags += VIR_MIGRATE_AUTO_CONVERGE; } return dm.migrate(dconn, flags, dxml, vmName, "tcp:" + destIp, libvirtComputingResource.getMigrateSpeed()); }</code><technical_language>changes :thumbsup:</technical_language>

Target:
public Domain call() throws LibvirtException { long flags = VIR_MIGRATE_LIVE; if (dconn.getLibVirVersion() >= LIBVIRT_VERSION_SUPPORTS_MIGRATE_COMPRESSED) { flags += VIR_MIGRATE_COMPRESSED; } if (migrateStorage) { flags += VIR_MIGRATE_NON_SHARED_DISK; } if (autoConvergence && dconn.getLibVirVersion() >= 1002003) { flags += VIR_MIGRATE_AUTO_CONVERGE; } return dm.migrate(dconn, flags, dxml, vmName, "tcp:" + destIp, libvirtComputingResource.getMigrateSpeed()); }
Source:
<code>public CoreGenerator(Path projectRoot) { this.jpCoreSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-core"); this.jssLogicSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-symbol-solver-logic"); this.jssModelSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-symbol-solver-model"); this.jssSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-symbol-solver-core"); final Path generatedJavaCcRoot = projectRoot.resolve("javaparser-core").resolve("target").resolve("generated-sources").resolve("javacc"); this.generatedJavaCcSourceRoot = new SourceRoot(generatedJavaCcRoot, parserConfiguration); <START> this.sourceRoots = new ArrayList<>(7); <END> this.sourceRoots.add(this.jpCoreSourceRoot); this.sourceRoots.add(this.jssLogicSourceRoot); this.sourceRoots.add(this.jssModelSourceRoot); this.sourceRoots.add(this.jssSourceRoot); this.sourceRoots.add(this.generatedJavaCcSourceRoot); }</code><technical_language>time do win this explicit optimization</technical_language>

Target:
public CoreGenerator(Path projectRoot) { jpCoreSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-core"); jssLogicSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-symbol-solver-logic"); jssModelSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-symbol-solver-model"); jssSourceRoot = getSourceRootForJpModule(projectRoot, "javaparser-symbol-solver-core"); final Path generatedJavaCcRoot = projectRoot.resolve("javaparser-core").resolve("target").resolve("generated-sources").resolve("javacc"); generatedJavaCcSourceRoot = new SourceRoot(generatedJavaCcRoot, parserConfiguration); sourceRoots = new ArrayList<>(7); sourceRoots.add(jpCoreSourceRoot); sourceRoots.add(jssLogicSourceRoot); sourceRoots.add(jssModelSourceRoot); sourceRoots.add(jssSourceRoot); sourceRoots.add(generatedJavaCcSourceRoot); }
Source:
<code>private static void maybeReportIssue( int flagValue, JavaContext context, MethodInvocation node) { if ((flagValue & GET_SIGNATURES_FLAG) != 0) { <START> context.report(ISSUE, context.getLocation(node), <END> "App signatures could potentially be exploited."); } }</code><technical_language>pass in "node" a parameter context.getLocation call here. node is lint for @SuppressLint annotations etc. Also, instead of passing in "node" location node, want context.getLocation(node.astArguments().last()) instead, parameter (where flags passed) want call user's attention to</technical_language>

Target:
private static void maybeReportIssue( int flagValue, JavaContext context, MethodInvocation node) { if ((flagValue & GET_SIGNATURES_FLAG) != 0) { context.report(ISSUE, node, context.getLocation(node.astArguments().last()), "Reading app signatures from getPackageInfo: The app signatures " + "could be exploited if not validated properly; " + "see issue explanation for details."); } }
Source:
<code>public void channelClosed( Channel channel ) { decrementIdle( channel ); metricsListener.afterClosed( serverAddress( channel ) ); <START> allChannels.remove( channel ); <END> }</code><technical_language>Closed channels automatically removed a channel group. This line removed</technical_language>

Target:
public void channelClosed( Channel channel ) { decrementIdle( channel ); metricsListener.afterClosed( serverAddress( channel ) ); }
Source:
<code>public static String getDiffCommandsForEE(String diffCmds) { if (diffCmds == null || diffCmds.length() == 0) return ""; StringBuilder sb = new StringBuilder(); String[] cmds = diffCmds.split("\n"); boolean skip = false; for (int i = 0; i < cmds.length; i++) { String stmt = cmds[i]; CatalogCmd catCmd = Catalog.parseStmt(stmt); if (catCmd.cmd == 'a' || catCmd.cmd == 'd') { <START> skip = catCmd.isProcedureRelatedCmd() ? true : false; <END> } if (!skip) { sb.append(stmt).append("\n"); } } return sb.toString(); }</code><technical_language>remove "? true : false". CatalogUtil.getDiffCommandsForEE() is invoke Site. If so, I recommend rename this method return a boolean soon a delete add command is identified</technical_language>

Target:
public static String getDiffCommandsForEE(String diffCmds) { if (diffCmds == null || diffCmds.length() == 0) return ""; StringBuilder sb = new StringBuilder(); String[] cmds = diffCmds.split("\n"); boolean skip = false; for (int i = 0; i < cmds.length; i++) { String stmt = cmds[i]; char cmd = Catalog.parseStmtCmd(stmt); if (cmd == 'a' || cmd == 'd') { CatalogCmd catCmd = Catalog.parseStmt(stmt); skip = catCmd.isProcedureRelatedCmd(); } if (!skip) { sb.append(stmt).append("\n"); } } return sb.toString(); }