auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Map<String, Construct> evaluate(BindableEvent e) throws EventException { MCBlockBreakEvent event = (MCBlockBreakEvent) e; Map<String, Construct> map = evaluate_helper(event); map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN)); CArray blk = new CArray(Target.UNKNOWN); blk.set("type", new CInt(event.getBlock().getTypeId(), Target.UNKNOWN)); blk.set("data", new CInt(event.getBlock().getData(), Target.UNKNOWN)); blk.set("X", new CInt(event.getBlock().getX(), Target.UNKNOWN)); blk.set("Y", new CInt(event.getBlock().getY(), Target.UNKNOWN)); blk.set("Z", new CInt(event.getBlock().getZ(), Target.UNKNOWN)); blk.set("world", new CString(event.getBlock().getWorld().getName(), Target.UNKNOWN)); map.put("block", blk); CArray drops = new CArray(Target.UNKNOWN); Collection<ItemStack> items = event.getBlock().getDrops(); for(Iterator<ItemStack> iter = items.iterator(); iter.hasNext();) { <START> ItemStack stack = (ItemStack)iter.next(); <END> CArray item = new CArray(Target.UNKNOWN); item.set("amount", Integer.toString(stack.getAmount())); item.set("type", new CInt(stack.getTypeId(), Target.UNKNOWN)); item.set("durability", new CInt(stack.getDurability(), Target.UNKNOWN)); drops.push(item); } map.put("drops", drops); return map; }</code><technical_language>a method in Static convert item stack a CArray, instead of manually building it</technical_language>

Target:
public Map<String, Construct> evaluate(BindableEvent e) throws EventException { MCBlockBreakEvent event = (MCBlockBreakEvent) e; Map<String, Construct> map = evaluate_helper(event); map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN)); CArray blk = new CArray(Target.UNKNOWN); int blktype = event.getBlock().getTypeId(); blk.set("type", new CInt(blktype, Target.UNKNOWN)); int blkdata = event.getBlock().getData(); blk.set("data", new CInt(blkdata, Target.UNKNOWN)); blk.set("X", new CInt(event.getBlock().getX(), Target.UNKNOWN)); blk.set("Y", new CInt(event.getBlock().getY(), Target.UNKNOWN)); blk.set("Z", new CInt(event.getBlock().getZ(), Target.UNKNOWN)); blk.set("world", new CString(event.getBlock().getWorld().getName(), Target.UNKNOWN)); map.put("block", blk); CArray drops = new CArray(Target.UNKNOWN); Collection<ItemStack> items = event.getBlock().getDrops(); for(Iterator<ItemStack> iter = items.iterator(); iter.hasNext();) { MCItemStack stack = new BukkitMCItemStack((ItemStack)iter.next()); CArray item = (CArray)ObjectGenerator.GetGenerator().item(stack, Target.UNKNOWN); drops.push(item); } map.put("drops", drops); return map; }
Source:
<code>public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; <START> if (path.startsWith("~/")) END> attributesFile = fs.resolve(fs.userHome(), path.substring(2)); else attributesFile = fs.resolve(null, path); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; }</code><technical_language>style nit: missing braces</technical_language>

Target:
public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) { attributesFile = fs.resolve(fs.userHome(), path.substring(2)); } else { attributesFile = fs.resolve(null, path); } FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; }
Source:
<code>@Override public String toString() { if (mFileName != null) { return getName(); } else { return "InMemoryDexFile[cookie=" + Arrays.toString((long[]) <START> mCookie) + <END> "]"; } }</code><technical_language>mCookie accessed synchronized. a problem</technical_language>

Target:
@Override public String toString() { if (mFileName != null) { return getName(); } else { mCookieLock.lock(); try { return "InMemoryDexFile[cookie=" + Arrays.toString((long[]) mCookie) + "]"; } finally { mCookieLock.unlock(); } } }
Source:
<code>private void cleanUpWorkspaceResources(String deploymentName) throws IOException { Deployment deployment = getDeploymentByName(deploymentName); Service service = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (service != null) { LOG.info("Removing OpenShift Service {}", service.getMetadata().getName()); openShiftClient.resource(service).delete(); } if (deployment != null) { LOG.info("Removing OpenShift Deployment {}", deployment.getMetadata().getName()); openShiftClient.resource(deployment).delete(); } List<Pod> pods = openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName) .list() <START> .getItems(); <END> try { boolean podsTerminated = false; while (!podsTerminated) { Thread.sleep(OPENSHIFT_WAIT_POD_DELAY); podsTerminated = true; for (Pod pod : pods) { String podName = pod.getMetadata().getName(); podsTerminated &= (openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withName(podName) .get() == null); } } } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.info("Thread interrupted while cleaning up workspace"); } }</code><technical_language>get size of list? iterate this size get zero? A for loop in a while loop complicated. avoid for loop if get size of pods list iteration</technical_language>

Target:
private void cleanUpWorkspaceResources(String deploymentName) throws IOException { Deployment deployment = getDeploymentByName(deploymentName); Service service = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (service != null) { LOG.info("Removing OpenShift Service {}", service.getMetadata().getName()); openShiftClient.resource(service).delete(); } if (deployment != null) { LOG.info("Removing OpenShift Deployment {}", deployment.getMetadata().getName()); openShiftClient.resource(deployment).delete(); } try { for (int waitCount = 0; waitCount < OPENSHIFT_WAIT_POD_TIMEOUT; waitCount++) { List<Pod> pods = openShiftClient.pods() .inNamespace(openShiftCheProjectName) .withLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName) .list() .getItems(); if (pods.size() == 0) { return; } Thread.sleep(OPENSHIFT_WAIT_POD_DELAY); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOG.info("Thread interrupted while cleaning up workspace"); } throw new OpenShiftException("Timeout while waiting for pods to terminate"); }
Source:
<code>public Object evaluate(DeferredObject[] arguments) throws HiveException { result.clear(); try { if (arguments.length == 1 && argumentOI != null && arguments[0] != null) { String ip = ((StringObjectInspector) argumentOI).getPrimitiveJavaObject(arguments[0].get()); Map<String, Object> geoDataResult = geocode.getGeocodedData(ip); if (geoDataResult != null) { for (String field : geoDataResult.keySet()) { result.put(field, geoDataResult.get(field).toString()); } } } <START> } catch (Exception ex) { <END> LOG.error(ex); } return result; }</code><technical_language>swallow this exception. log rethrow</technical_language>

Target:
public Object evaluate(DeferredObject[] arguments) throws HiveException { result.clear(); if (arguments.length == 1 && argumentOI != null && arguments[0] != null) { String ip = ((StringObjectInspector) argumentOI).getPrimitiveJavaObject(arguments[0].get()); Map<String, Object> geoDataResult = geocode.getGeocodedData(ip); if (geoDataResult != null) { for (String field : geoDataResult.keySet()) { result.put(field, geoDataResult.get(field).toString()); } } } return result; }
Source:
<code>public boolean isNaN() { <START> return this.doubleValue() != this.doubleValue(); <END> }</code><technical_language>I Double.isNaN clearer. strictly necessary, this understood too</technical_language>

Target:
public boolean isNaN() { return Double.isNaN( this.doubleValue() ); }
Source:
<code>public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof InterpolationVariable)) { return false; } InterpolationVariable that = (InterpolationVariable) obj; return equalOrNull(this.varName, that.varName) && equalOrNull(this.dataType, that.dataType) && equalOrNull(this.factType, that.factType) && equalOrNull(this.factField, that.factField) <START> && equalOrNull(this.operator, <END> that.operator); }</code><technical_language>Thinking if need this equalOrNull, Objects.equals behavior. java @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof InterpolationVariable)) { return false; } InterpolationVariable = (InterpolationVariable) obj; return Objects.equals(this.varName, that.varName) && Objects.equals(this.dataType, that.dataType) && Objects.equals(this.factType, that.factType) && Objects.equals(this.factField, that.factField) && Objects.equals(this.operator, that.operator); }</technical_language>

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof InterpolationVariable)) { return false; } InterpolationVariable that = (InterpolationVariable) obj; return Objects.equals(this.varName, that.varName) && Objects.equals(this.dataType, that.dataType) && Objects.equals(this.factType, that.factType) && Objects.equals(this.factField, that.factField) && Objects.equals(this.operator, that.operator); }
Source:
<code>public static void verifyTags(String tagsString) { <START> final Pattern pattern = Pattern.compile("^([a-z0-9-_.]+)$"); <END> final List<String> verifyTags = filterStringToList(tagsString); for (String verifyTag : verifyTags) { if (!pattern.matcher(verifyTag).matches()) { throw new IllegalArgumentException("Tag " + verifyTag + " doesn't match ^([a-z0-9-_.]+)$"); } } }</code><technical_language>please move pattern const</technical_language>

Target:
public static void verifyTags(String tagsString) { final List<String> verifyTags = filterStringToList(tagsString); for (String verifyTag : verifyTags) { if (!VALID_REPO_PATTERN.matcher(verifyTag).matches()) { throw new IllegalArgumentException("Tag " + verifyTag + " doesn't match ^([a-z0-9-_.]+)$"); } } }
Source:
<code>private Flow flowFromLearnedAssociation(LearnedAssociation learnedAssociation, ExplodedGraph.Node node) { ProgramState programState = node.programState; Preconditions.checkState(programState != null, "Learned association with null state in parent node of the edge."); Symbol rhsSymbol = symbolFromStack(learnedAssociation.symbolicValue(), programState); if (rhsSymbol != null) { return Flow.of(location(node, String.format(IMPLIES_SAME_VALUE, learnedAssociation.symbol().name(), rhsSymbol.name()))); } Flow.Builder flowBuilder = Flow.builder(); ConstraintsByDomain allConstraints = programState.getConstraints(learnedAssociation.symbolicValue()); Collection<Constraint> constraints = filterByDomains(allConstraints); <START> boolean isBoolean = learnedAssociation.symbol.type().is("boolean"); <END> for (Constraint constraint : constraints) { if (isBoolean && constraint == ObjectConstraint.NOT_NULL) { continue; } String symbolName = learnedAssociation.symbol().name(); String msg; if (assigningNullFromTernary(node) || (assigningFromMethodInvocation(node) && assignedFromYieldWithUncertainResult(constraint, node))) { msg = IMPLIES_CAN_BE_MSG; } else { msg = IMPLIES_IS_MSG; } flowBuilder.add(location(node, String.format(msg, symbolName, constraint.valueAsString()))); } return flowBuilder.build(); }</code><technical_language>I I prefer test type().isPrimitive(Primitives.BOOLEAN), type().isPrimitive() , of primitive type null</technical_language>

Target:
private Flow flowFromLearnedAssociation(LearnedAssociation learnedAssociation, ExplodedGraph.Node node) { ProgramState programState = node.programState; Preconditions.checkState(programState != null, "Learned association with null state in parent node of the edge."); Symbol rhsSymbol = symbolFromStack(learnedAssociation.symbolicValue(), programState); if (rhsSymbol != null) { return Flow.of(location(node, String.format(IMPLIES_SAME_VALUE, learnedAssociation.symbol().name(), rhsSymbol.name()))); } Flow.Builder flowBuilder = Flow.builder(); ConstraintsByDomain allConstraints = programState.getConstraints(learnedAssociation.symbolicValue()); Collection<Constraint> constraints = filterByDomains(allConstraints); boolean isPrimitive = learnedAssociation.symbol.type().isPrimitive(); for (Constraint constraint : constraints) { if (isPrimitive && constraint == ObjectConstraint.NOT_NULL) { continue; } String symbolName = learnedAssociation.symbol().name(); String msg; if (assigningNullFromTernary(node) || (assigningFromMethodInvocation(node) && assignedFromYieldWithUncertainResult(constraint, node))) { msg = IMPLIES_CAN_BE_MSG; } else { msg = IMPLIES_IS_MSG; } flowBuilder.add(location(node, String.format(msg, symbolName, constraint.valueAsString()))); } return flowBuilder.build(); }
Source:
<code>protected void doSetUp() throws Exception { super.doSetUp(); flow = createAndRegisterFlow(muleContext, APPLE_FLOW, componentLocator); <START> untilSuccessful = buildUntilSuccessful("100"); <END> if (tx) { getInstance().bindTransaction(mock(Transaction.class)); } }</code><technical_language>constant declarative field</technical_language>

Target:
protected void doSetUp() throws Exception { super.doSetUp(); flow = createAndRegisterFlow(muleContext, APPLE_FLOW, componentLocator); untilSuccessful = buildUntilSuccessful(MILLIS_BETWEEN_RETRIES); if (tx) { getInstance().bindTransaction(mock(Transaction.class)); } }
Source:
<code>public void setUp() throws Exception { BrickTestUtils.createProjectAndGetStartScript("PhiroMoveMotorForwardBrickTest") <START> .addBrick(new PhiroMotorMoveForwardBrick( <END> PhiroMotorMoveForwardBrick.Motor.MOTOR_RIGHT, SET_SPEED_INITIALLY)); brickPosition = 1; baseActivityTestRule.launchActivity(null); }</code><technical_language>for readability, instantiate phiroMotorMoveForwardBrick separately</technical_language>

Target:
public void setUp() { PhiroMotorMoveForwardBrick phiroMotorMoveForwardBrick = new PhiroMotorMoveForwardBrick(PhiroMotorMoveForwardBrick.Motor .MOTOR_RIGHT, initialSpeed); BrickTestUtils.createProjectAndGetStartScript("PhiroMoveMotorForwardBrickTest") .addBrick(phiroMotorMoveForwardBrick); brickPosition = 1; baseActivityTestRule.launchActivity(null); }
Source:
<code>private ControlDecoration installAttributeDiffDecoration(String taskSummary, Control control, TaskAttributeDiff diff) { ControlDecoration controlDecoration = new ControlDecoration(control, (SWT.TOP | SWT.RIGHT)); controlDecoration.setImage(CommonImages.OVERLAY_SYNC_INCOMMING.createImage()); StringBuffer diffText = new StringBuffer(TaskDiffUtil.toString(diff)); <START> diffText.append("\n\nClick to view a full comparison."); <END> controlDecoration.setDescriptionText(diffText.toString()); controlDecoration.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { String name; if (diff.getLabel() == null || diff.getLabel().isEmpty()) { name = "attribute of " + taskSummary; } else { name = TaskDiffUtil.getName(diff) + " of " + taskSummary; } CompareConfiguration configuration = new CompareConfiguration(); configuration.setLeftLabel("Previous Value"); configuration.setRightLabel("Incoming Value"); CompareEditorInput editorInput = new CompareEditorInput(configuration) { @Override public String getTitle() { return "Compare " + name; } @Override protected Object prepareInput(IProgressMonitor monitor) { return new TaskAttributeDiffNode(Differencer.CHANGE, diff); } }; CompareUI.openCompareEditor(editorInput); } public void widgetDefaultSelected(SelectionEvent e) { } }); return controlDecoration; }</code><technical_language>extenalize Strings</technical_language>

Target:
private ControlDecoration installAttributeDiffDecoration(String taskSummary, Control control, TaskAttributeDiff diff) { ControlDecoration controlDecoration = new ControlDecoration(control, (SWT.TOP | SWT.RIGHT)); controlDecoration.setImage(TasksUiImages.INSPECT_ATTRIBUTE_DIFF.createImage()); StringBuffer diffText = new StringBuffer(TaskDiffUtil.toString(diff)); if (TaskDiffUtil.requiresTrim(diff)) { diffText.append("\n\n"); diffText.append(Messages.AttributeEditorToolkit_Click_To_View_A_Full_Comparison); controlDecoration.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { String name; if (diff.getLabel() == null || diff.getLabel().isEmpty()) { name = Messages.AttributeEditorToolkit_Attribute_Of + taskSummary; } else { name = TaskDiffUtil.getName(diff) + Messages.AttributeEditorToolkit_Of + taskSummary; } CompareConfiguration configuration = new CompareConfiguration(); configuration.setLeftLabel(Messages.AttributeEditorToolkit_Previous_Value); configuration.setRightLabel(Messages.AttributeEditorToolkit_Incoming_Value); CompareEditorInput editorInput = new CompareEditorInput(configuration) { @Override public String getTitle() { return Messages.AttributeEditorToolkit_Compare + name; } @Override protected Object prepareInput(IProgressMonitor monitor) { return new TaskAttributeDiffNode(Differencer.CHANGE, diff); } }; CompareUI.openCompareEditor(editorInput); } public void widgetDefaultSelected(SelectionEvent e) { } }); } controlDecoration.setDescriptionText(diffText.toString()); return controlDecoration; }
Source:
<code>public void fromRange(Range r) { range = <START> range == <END> null ? null : new CommentRange(range.startLine, range.startCharacter, range.endLine, range.endCharacter); }</code><technical_language>Eclipse is warning argument r is unused. I guess this changed r</technical_language>

Target:
public void fromRange(Range r) { range = r == null ? null : new CommentRange(range.startLine, range.startCharacter, range.endLine, range.endCharacter); }
Source:
<code>public void GIICompletesSuccessfullyWhenRunningDuringClear() { initDataStores(NUM_SERVERS); configureServers(regionShortcut); verifyRegionSizes(DATA_SIZE); <START> dataStores[1].invoke(new SerializableRunnable() { <END> @Override public void run() { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); } }); cluster.stop(2); createDelta(50); restartServerOnVM(2); AsyncInvocation async = createRegionAsync(dataStores[1]); invokeClear(dataStores[0]); dataStores[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedRequestImage, true)); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }</code><technical_language>a lamda dataStores[1].invokd(()->{....}); if block of code lamda is for tests, put in a method instead of duplicate them</technical_language>

Target:
public void GIICompletesSuccessfullyWhenRunningDuringClear() { startServers(NUM_SERVERS); verifyRegionSizes(DATA_SIZE); serverVMs[1].invoke(() -> { PauseDuringGIICallback myAfterReceivedImageReply = new PauseDuringGIICallback( InitialImageOperation.GIITestHookType.AfterReceivedImageReply, "_B__testPR_9"); InitialImageOperation.setGIITestHook(myAfterReceivedImageReply); }); cluster.stop(2); createDelta(50); restartServerOnVM(2); serverVMs[1].invoke(() -> { DistributionMessageObserver.setInstance(new PauseDuringClearDistributionMessageObserver()); }); AsyncInvocation async = createRegionAsync(serverVMs[1]); invokeClearAsync(serverVMs[0]); waitForCallbackStarted(serverVMs[1], InitialImageOperation.GIITestHookType.AfterReceivedImageReply); serverVMs[1].invoke(() -> InitialImageOperation.resetGIITestHook( InitialImageOperation.GIITestHookType.AfterReceivedImageReply, true)); serverVMs[1].invoke(() -> { PauseDuringClearDistributionMessageObserver observer = (PauseDuringClearDistributionMessageObserver) DistributionMessageObserver.getInstance(); DistributionMessageObserver.setInstance(null); observer.latch.countDown(); }); try { async.getResult(30000); } catch (InterruptedException ex) { Assert.fail("Async create interupted" + ex.getMessage()); } verifyRegionSizes(0); }
Source:
<code>public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); String blobIdStr = blobReadInfo.getBlobId().getID(); try { if (!blobReadInfo.isBlobDownloaded()) { blobReadInfo.downloadBlob(blobStore); } <START> ByteBuf outputBuf = blobReadInfo.getBlobContent().duplicate(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); byte[] array = new byte[(int) sizeToRead]; outputBuf.readerIndex((int) (relativeOffset)); outputBuf.readBytes(array); written = channel.write(ByteBuffer.wrap(array)); <END> } catch (StoreException ex) { throw new IOException("Write of cloud blob " + blobIdStr + " failed", ex); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobIdStr); return written; }</code><technical_language>extra step for this, do ByteBuf outputBuf = blobReadInfo.getBlobContent().duplicate(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); outputBuf.setIndex((int) (relativeOffset), (int)(relativeOffset + sizeToRead)); written = channel.write(outputBuf.nioBuffer());</technical_language>

Target:
public long writeTo(int index, WritableByteChannel channel, long relativeOffset, long maxSize) throws IOException { validateIndex(index); long written = 0; BlobReadInfo blobReadInfo = blobReadInfoList.get(index); String blobIdStr = blobReadInfo.getBlobId().getID(); try { if (!blobReadInfo.isBlobDownloaded()) { blobReadInfo.downloadBlob(blobStore); } ByteBuf outputBuf = blobReadInfo.getBlobContent().duplicate(); long sizeToRead = Math.min(maxSize, blobReadInfo.getBlobSize() - relativeOffset); outputBuf.setIndex((int) (relativeOffset), (int) (relativeOffset + sizeToRead)); written = channel.write(outputBuf.nioBuffer()); } catch (StoreException ex) { throw new IOException("Write of cloud blob " + blobIdStr + " failed", ex); } logger.trace("Downloaded bytes to the write channel from the cloud blob : {}", written, blobIdStr); return written; }
Source:
<code><START> public void updateAdmins(final List<Permission> newAdmins) { <END> if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot update admins: write operations on DB " + "are blocked by feature flag."); } validateAllAdmins(newAdmins); final List<Permission> currentAdmins = authorizationDbRepository.listAdmins(); final List<Permission> add = removeDefaultAdmin(newAdmins.stream() .filter(p -> !currentAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); final List<Permission> delete = removeDefaultAdmin(currentAdmins.stream() .filter(p -> !newAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); authorizationDbRepository.update(add, delete); }</code><technical_language>throws DbWriteOperationsBlockedException</technical_language>

Target:
public void updateAdmins(final List<Permission> newAdmins) throws DbWriteOperationsBlockedException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot update admins: write operations on DB " + "are blocked by feature flag."); } validateAllAdmins(newAdmins); final List<Permission> currentAdmins = authorizationDbRepository.listAdmins(); final List<Permission> add = removeDefaultAdmin(newAdmins.stream() .filter(p -> !currentAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); final List<Permission> delete = removeDefaultAdmin(currentAdmins.stream() .filter(p -> !newAdmins.stream().anyMatch(Predicate.isEqual(p))).collect(Collectors.toList())); authorizationDbRepository.update(add, delete); }
Source:
<code>protected void setup(Binder binder) { bindAuthenticationModule( <START> config -> config.getDruidAuthenticationType() == DruidConfig.DruidAuthenticationType.NONE, <END> noneAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == DruidConfig.DruidAuthenticationType.BASIC, basicAuthenticationModule()); }</code><technical_language>static import DruidConfig.DruidAuthenticationType.NONE</technical_language>

Target:
protected void setup(Binder binder) { bindAuthenticationModule( config -> config.getDruidAuthenticationType() == NONE, noneAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == BASIC, basicAuthenticationModule()); bindAuthenticationModule( config -> config.getDruidAuthenticationType() == KERBEROS, kerberosbAuthenticationModule()); }
Source:
<code>public void checkDigit_shouldChangeWhenAdjacentCharsAreTransposed() { <START> VerhoeffIdentifierValidator v = new VerhoeffIdentifierValidator(); <END> String test; int checkDigit; String pre; String post; int failures = 0; StringBuilder failureMsg = new StringBuilder(); char c; char d; final String lineSeparator = System.getProperty("line.separator"); for (String allowedIdentifier: allowedIdentifiers) { for (int i = 0; i < allowedIdentifier.length(); i++) { checkDigit = v.getCheckDigit(allowedIdentifier); for (int j = 1; j < allowedIdentifier.length(); j++) { c = allowedIdentifier.charAt(j - 1); d = allowedIdentifier.charAt(j); if (c != d) { pre = allowedIdentifier.substring(0, j - 1); post = allowedIdentifier.substring(j + 1); test = pre + d + c + post; if (checkDigit == v.getCheckDigit(test)) { failureMsg.append("Check digits for '"); failureMsg.append(allowedIdentifier); failureMsg.append("' and '"); failureMsg.append(test); failureMsg.append("' should be different, both were "); failureMsg.append(checkDigit); failureMsg.append(lineSeparator); failures++; } } } allowedIdentifier = allowedIdentifier.substring(1, allowedIdentifier.length()) + allowedIdentifier.charAt(0); } } assertTrue(failures + " transposed digits were not detected:\n" + failureMsg, failures == 0); }</code><technical_language>I rename v validator</technical_language>

Target:
public void checkDigit_shouldChangeWhenAdjacentCharsAreTransposed() { VerhoeffIdentifierValidator validator = new VerhoeffIdentifierValidator(); String test; int checkDigit; String pre; String post; int failures = 0; StringBuilder failureMsg = new StringBuilder(); char c; char d; final String lineSeparator = System.getProperty("line.separator"); for (String allowedIdentifier: allowedIdentifiers) { for (int i = 0; i < allowedIdentifier.length(); i++) { checkDigit = validator.getCheckDigit(allowedIdentifier); for (int j = 1; j < allowedIdentifier.length(); j++) { c = allowedIdentifier.charAt(j - 1); d = allowedIdentifier.charAt(j); if (c != d) { pre = allowedIdentifier.substring(0, j - 1); post = allowedIdentifier.substring(j + 1); test = pre + d + c + post; if (checkDigit == validator.getCheckDigit(test)) { failureMsg.append("Check digits for '"); failureMsg.append(allowedIdentifier); failureMsg.append("' and '"); failureMsg.append(test); failureMsg.append("' should be different, both were "); failureMsg.append(checkDigit); failureMsg.append(lineSeparator); failures++; } } } allowedIdentifier = allowedIdentifier.substring(1, allowedIdentifier.length()) + allowedIdentifier.charAt(0); } } assertTrue(failures + " transposed digits were not detected:\n" + failureMsg, failures == 0); }
Source:
<code>public MqttConnectOptions getConnectionInfo() { MqttConnectOptions options = this.clientFactory.getConnectionOptions(); if (options.getServerURIs() == null && getUrl() != null) { <START> if (options.getServerURIs() == null && getUrl() != null) { <END> options = MqttUtils.cloneConnectOptions(options); options.setServerURIs(new String[] { getUrl() }); } options.setServerURIs(new String[] { getUrl() }); } return options; }</code><technical_language>duplication for this ifs</technical_language>

Target:
public MqttConnectOptions getConnectionInfo() { MqttConnectOptions options = this.clientFactory.getConnectionOptions(); if (options.getServerURIs() == null) { String url = getUrl(); if (url != null) { options = MqttUtils.cloneConnectOptions(options); options.setServerURIs(new String[] { url }); } } return options; }
Source:
<code>public Builder useResourceOwnerMaskedPassword(String userName, String maskedPassword, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector) throws NoSuchAlgorithmException, InvalidKeySpecException { Assert.assertNotNull(maskedPassword); Assert.checkMinimumParameter("iterationCount", 1, iterationCount); Assert.assertNotNull(salt); byte[] finalMaskedSecretBytes = CodePointIterator.ofString(maskedPassword).base64Decode().drain(); if (algorithm == null) algorithm = MaskedPassword.ALGORITHM_MASKED_MD5_DES; <START> char[] finalInitialKeyMaterial = initialKeyMaterial == null ? "somearbitrarycrazystringthatdoesnotmatter".toCharArray() : initialKeyMaterial.toCharArray(); <END> byte[] finalSalt = CodePointIterator.ofString(salt).asUtf8().drain(); byte[] finalInitializationVector = initializationVector == null ? null : CodePointIterator.ofString(initializationVector).base64Decode().drain(); MaskedPasswordSpec spec = new MaskedPasswordSpec(finalInitialKeyMaterial, iterationCount, finalSalt, finalMaskedSecretBytes, finalInitializationVector); PasswordFactory factory = PasswordFactory.getInstance(algorithm); MaskedPassword password = factory.generatePassword(spec).castAs(MaskedPassword.class); ClearPasswordSpec clearSpec = factory.getKeySpec(password, ClearPasswordSpec.class); String finalPassword = String.valueOf(clearSpec.getEncodedPassword()); configureAuthenticationHandler(parameters -> configureResourceOwnerCredentialsParameters(parameters, userName, finalPassword)); return this; }</code><technical_language>good ""somearbitrarycrazystringthatdoesnotmatter" a constant</technical_language>

Target:
public Builder useResourceOwnerMaskedPassword(String userName, String maskedPassword, String algorithm, String initialKeyMaterial, int iterationCount, String salt, String initializationVector) throws NoSuchAlgorithmException, InvalidKeySpecException { String password = convertMaskedPasswordToClearText(maskedPassword, algorithm, initialKeyMaterial, iterationCount, salt, initializationVector); configureAuthenticationHandler(parameters -> configureResourceOwnerCredentialsParameters(parameters, userName, password)); return this; }
Source:
<code>public int compare(Object o1, Object o2) { if (o1 instanceof StagingEntry) { if (o2 instanceof StagingEntry) { StagingEntry e1 = (StagingEntry) o1; StagingEntry e2 = (StagingEntry) o2; if (fileNameMode) <START> return e1.getName().compareTo(e2.getName()); <END> return e1.getPath().compareTo(e2.getPath()); } else { return 1; } } else if (o1 instanceof StagingFolderEntry) { if (o2 instanceof StagingFolderEntry) { StagingFolderEntry f1 = (StagingFolderEntry) o1; StagingFolderEntry f2 = (StagingFolderEntry) o2; return f1.getPath().toString() .compareTo(f2.getPath().toString()); } else { return -1; } } else { return 0; } }</code><technical_language>if multiple files name (e.g. pom.xml) in directories? sort full path then</technical_language>

Target:
public int compare(Object o1, Object o2) { if (o1 instanceof StagingEntry) { if (o2 instanceof StagingEntry) { StagingEntry e1 = (StagingEntry) o1; StagingEntry e2 = (StagingEntry) o2; if (fileNameMode) { int result = e1.getName().compareTo(e2.getName()); if (result != 0) return result; else return e1.getParentPath().toString() .compareTo(e2.getParentPath().toString()); } return e1.getPath().compareTo(e2.getPath()); } else { return 1; } } else if (o1 instanceof StagingFolderEntry) { if (o2 instanceof StagingFolderEntry) { StagingFolderEntry f1 = (StagingFolderEntry) o1; StagingFolderEntry f2 = (StagingFolderEntry) o2; return f1.getPath().toString() .compareTo(f2.getPath().toString()); } else { return -1; } } else { return 0; } }
Source:
<code>public void start(Stage primaryStage) { final int w = (int) OriginalImage.getWidth(); <START> final int h = (int) OriginalImage.getHeight(); <END> final int zoom = 5; ImageView iv1 = new ImageView(); iv1.setImage(OriginalImage); iv1.setFitHeight( zoom* h); iv1.setFitWidth(zoom*w); ImageView iv2 = new ImageView(); iv2.setImage(composition); iv2.setFitHeight( zoom* h); iv2.setFitWidth(zoom*w); HBox root = new HBox(); Scene scene = new Scene(root); root.getChildren().addAll(iv1, iv2); primaryStage.setTitle("Neural Network Drawing Demo."); primaryStage.setScene(scene); primaryStage.show(); Platform.setImplicitExit(true); Platform.runLater(this::onCalc); }</code><technical_language>camel case</technical_language>

Target:
public void start(Stage primaryStage) { final int w = (int) originalImage.getWidth(); final int h = (int) originalImage.getHeight(); final int zoom = 5; ImageView iv1 = new ImageView(); iv1.setImage(originalImage); iv1.setFitHeight( zoom* h); iv1.setFitWidth(zoom*w); ImageView iv2 = new ImageView(); iv2.setImage(composition); iv2.setFitHeight( zoom* h); iv2.setFitWidth(zoom*w); HBox root = new HBox(); Scene scene = new Scene(root); root.getChildren().addAll(iv1, iv2); primaryStage.setTitle("Neural Network Drawing Demo."); primaryStage.setScene(scene); primaryStage.show(); Platform.setImplicitExit(true); Platform.runLater(this::onCalc); }
Source:
<code>protected String convertJsonToCSV(String jsonStr) { if (jsonStr == null) { return null; } StringBuilder str = new StringBuilder(); try { new JSONObject(jsonStr); <START> JFlat flatMe = new JFlat(jsonStr); <END> List<Object[]> json2csv = flatMe.json2Sheet().headerSeparator("_").getJsonAsSheet(); for (Object[] obj : json2csv) { str.append(Arrays.toString(obj)); } } catch (JSONException e) { log.error("Exception: {}", e); } catch (PathNotFoundException e) { log.error("Exception: {}", e); } catch (Exception e) { log.error("Exception: {}", e); } return str.toString(); }</code><technical_language>format of output is for JFlat. specific requirements JSON is flattened - good customization options</technical_language>

Target:
protected String convertJsonToCSV(String jsonStr) { if (jsonStr == null) { return null; } StringBuilder str = new StringBuilder(); JFlat flatMe = new JFlat(jsonStr); List<Object[]> json2csv; try { json2csv = flatMe.json2Sheet().headerSeparator("_").getJsonAsSheet(); for (Object[] obj : json2csv) { String objString = Arrays.toString(obj); if (objString != null) { objString = objString.substring(1, objString.length() - 1); } str.append(objString); str.append(System.getProperty("line.separator")); } } catch (Exception e) { log.debug("Exception while converting to CSV: {}", e.getMessage()); throw new IllegalStateException(e); } return str.toString(); }
Source:
<code>private static boolean orderIsDeterminedByOrderColumns(AbstractParsedStmt stmt, List<ParsedColInfo> orderColumns) { if (orderColumns.isEmpty()) { return false; } if (stmt instanceof ParsedSelectStmt) { ParsedSelectStmt selectStmt = (ParsedSelectStmt) stmt; ArrayList<AbstractExpression> nonOrdered = new ArrayList<AbstractExpression>(); return selectStmt.orderByColumnsDetermineAllDisplayColumns(selectStmt.displayColumns(), orderColumns, nonOrdered); } else { ParsedUnionStmt setOpStmt = (ParsedUnionStmt) stmt; switch (setOpStmt.m_unionType) { case EXCEPT: case EXCEPT_ALL: case INTERSECT: case INTERSECT_ALL: return orderIsDeterminedByOrderColumns(setOpStmt.m_children.get(0), orderColumns); default: <START> return false; <END> } } }</code><technical_language>giving in this case? Is a union deterministic order columns? Do need track names of order columns in input tables names of columns in output tables reassigned unions? thinking example "(select a, c ...) union (select c, a...)..." case (or above). This hard me</technical_language>

Target:
private static boolean orderIsDeterminedByOrderColumns(AbstractParsedStmt stmt, List<ParsedColInfo> orderColumns) { if (orderColumns.isEmpty()) { return false; } if (stmt instanceof ParsedSelectStmt) { ParsedSelectStmt selectStmt = (ParsedSelectStmt) stmt; ArrayList<AbstractExpression> nonOrdered = new ArrayList<AbstractExpression>(); return selectStmt.orderByColumnsDetermineAllDisplayColumns(selectStmt.displayColumns(), orderColumns, nonOrdered); } else { ParsedUnionStmt setOpStmt = (ParsedUnionStmt) stmt; switch (setOpStmt.m_unionType) { case EXCEPT: case EXCEPT_ALL: case INTERSECT: case INTERSECT_ALL: return orderIsDeterminedByOrderColumns(setOpStmt.m_children.get(0), orderColumns); case UNION: case UNION_ALL: return setOpStmt.getLeftmostSelectStmt().orderByColumnsDetermineAllDisplayColumnsForUnion(orderColumns); default: return false; } } }
Source:
<code>public void testReleaseAndClaim() throws Exception { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertNotNull(processInstanceId); assertTrue(processInstanceId.longValue() > 0); try { List<TaskSummary> taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); TaskSummary taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); taskClient.releaseTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Ready); taskClient.claimTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); taskClient.claimTask(CONTAINER_ID, taskSummary.getId(), USER_JOHN); } catch(KieServicesHttpException e) { assertEquals(Response.Status.FORBIDDEN.getStatusCode(), e.getHttpCode().intValue()); } catch(KieServicesException e) { <START> <END> } finally { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }</code><technical_language>+1 asserClientException consistent easier follow</technical_language>

Target:
public void testReleaseAndClaim() throws Exception { Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_USERTASK); assertNotNull(processInstanceId); assertTrue(processInstanceId.longValue() > 0); try { List<TaskSummary> taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); TaskSummary taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); taskClient.releaseTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Ready); taskClient.claimTask(CONTAINER_ID, taskSummary.getId(), USER_YODA); taskList = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10); assertNotNull(taskList); assertEquals(1, taskList.size()); taskSummary = taskList.get(0); checkTaskNameAndStatus(taskSummary, "First task", Status.Reserved); Long taskId = taskList.get(0).getId(); assertClientException( () -> taskClient.claimTask(CONTAINER_ID, taskId, USER_JOHN), 403, "User '[UserImpl:'"+ USER_JOHN +"']' was unable to execute operation 'Claim' on task id "+ taskId +" due to a no 'current status' match"); } finally { processClient.abortProcessInstance(CONTAINER_ID, processInstanceId); } }
Source:
<code>public void setType(RabbitTypes type) { this.type = type; <START> if (rabbit != null) { <END> ((EntityRabbit)((CraftRabbit)rabbit).getHandle()).r(type.type); } }</code><technical_language>&& rabbit.isValid npc.isSpawned() npc.getEntity</technical_language>

Target:
public void setType(RabbitTypes type) { this.type = type; if (rabbit != null && rabbit.isValid()) { ((EntityRabbit)((CraftRabbit)rabbit).getHandle()).r(type.type); } }
Source:
<code>public UserDetailsService userDetailsService() { <START> UserDetails userDetails = User.builder() <END> .passwordEncoder(rawPassword -> "{noop}" + rawPassword) .username("user") .password("password") .roles("USER") .build(); return new InMemoryUserDetailsManager(userDetails); }</code><technical_language>Please switch this withDefaultPasswordEncoder() is slightly storing passwords {noop} password in memory is hashed</technical_language>

Target:
public UserDetailsService userDetailsService() { UserDetails userDetails = User.withDefaultPasswordEncoder() .username("user") .password("password") .roles("USER") .build(); return new InMemoryUserDetailsManager(userDetails); }
Source:
<code>private void maybeSendRequestToNextProcessor(Request request) throws RequestProcessorException { <START> if (request.isFromLearner() && skipLearnerRequestToNextProcessor) { <END> ServerMetrics.getMetrics().SKIP_LEARNER_REQUEST_TO_NEXT_PROCESSOR_COUNT.add(1); } else { nextProcessor.processRequest(request); } }</code><technical_language>invert order, test field first, This option is disabled default save a bunch of CPU cycles</technical_language>

Target:
private void maybeSendRequestToNextProcessor(Request request) throws RequestProcessorException { if (skipLearnerRequestToNextProcessor && request.isFromLearner()) { ServerMetrics.getMetrics().SKIP_LEARNER_REQUEST_TO_NEXT_PROCESSOR_COUNT.add(1); } else { nextProcessor.processRequest(request); } }
Source:
<code>private void validateBucketizedEnabled(String path, boolean isRead) { if (!BUCKETIZE_ZNRECORD_ENABLED) { throw new HelixMetaDataAccessException( "Can't " + (isRead ? "read" : "write") + " bucktized ZNode " + path <START> + " because Bucktize feature is not enabled. Please check ZK system property 'zk.bucketize.znrecord.enabled' ."); <END> } }</code><technical_language>ZkSystemPropertyKeys.ZK_BUCKETIZE_ZNRECORD_ENABLED instead of hard coding it</technical_language>

Target:
private void validateBucketizedEnabled(String path, boolean isRead) { if (!ZNRECORD_BUCKETIZE_ENABLED) { throw new HelixMetaDataAccessException( "Can't " + (isRead ? "read" : "write") + " bucktized ZNode " + path + " because Bucktize feature is not enabled. Please check ZK system property: " + ZkSystemPropertyKeys.ZK_ZNRECORD_BUCKETIZE_ENABLED); } }
Source:
<code>public void testChainedMethodWithBracketOnNewLine() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addAttribute("arrayInitIndent", "2"); checkConfig.addAttribute("basicOffset", "2"); checkConfig.addAttribute("braceAdjustment", "0"); checkConfig.addAttribute("caseIndent", "2"); checkConfig.addAttribute("forceStrictCondition", "false"); checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "2"); checkConfig.addAttribute("throwsIndent", "2"); <START> final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; <END> final String fileName = "InputIndentationChainedMethodWithBracketOnNewLine.java"; verifyWarns(checkConfig, getPath(fileName), expected); }</code><technical_language>please add more Input file (or update Input introduce) cases violations example - <LINK_0> Hint: please copy code violations regression report, bunch of interestingly formatted code</technical_language>

Target:
public void testChainedMethodWithBracketOnNewLine() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(IndentationCheck.class); checkConfig.addAttribute("arrayInitIndent", "2"); checkConfig.addAttribute("basicOffset", "2"); checkConfig.addAttribute("braceAdjustment", "0"); checkConfig.addAttribute("caseIndent", "2"); checkConfig.addAttribute("forceStrictCondition", "false"); checkConfig.addAttribute("lineWrappingIndentation", "4"); checkConfig.addAttribute("tabWidth", "2"); checkConfig.addAttribute("throwsIndent", "2"); final String[] expected = { "44: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 6, 8), "45: " + getCheckMessage(MSG_CHILD_ERROR, "method call", 8, 10), "47: " + getCheckMessage(MSG_ERROR, "method call rparen", 6, 8), "61: " + getCheckMessage(MSG_ERROR, "foo", 5, 8), "82: " + getCheckMessage(MSG_ERROR, "if rcurly", 4, 6), "84: " + getCheckMessage(MSG_CHILD_ERROR, "method def", 2, 4), }; final String fileName = "InputIndentationChainedMethodWithBracketOnNewLine.java"; verifyWarns(checkConfig, getPath(fileName), expected); }
Source:
<code>private void removeEventListener(ClientDescriptor clientDescriptor, ServerSideServerStore cacheStore) { synchronized (eventListeners) { boolean wasEmpty = eventListeners.isEmpty(); <START> eventListeners.remove(clientDescriptor); <END> if (!wasEmpty && eventListeners.isEmpty()) { cacheStore.enableEvents(false); } } }</code><technical_language>This be: java if (eventListeners.remove(clientDescriptor) && eventListeners.isEmpty()) { cacheStore.enableEvents(false); }</technical_language>

Target:
private void removeEventListener(ClientDescriptor clientDescriptor, ServerSideServerStore cacheStore) { synchronized (eventListeners) { if (eventListeners.remove(clientDescriptor) && eventListeners.isEmpty()) { cacheStore.enableEvents(false); } } }
Source:
<code>public void testQueryCumulativeTable() { computeActual("SELECT * FROM \"*:*\""); computeActual("SELECT * FROM \"java.util.logging:*\""); <START> assertTrue(computeActual("SELECT * FROM \"java.lang:*\"").getRowCount() > 0); <END> assertTrue(computeActual("SELECT * FROM \"jAVA.LANg:*\"").getRowCount() > 0); }</code><technical_language>1</technical_language>

Target:
public void testQueryCumulativeTable() { computeActual("SELECT * FROM \"*:*\""); computeActual("SELECT * FROM \"java.util.logging:*\""); assertTrue(computeActual("SELECT * FROM \"java.lang:*\"").getRowCount() > 1); assertTrue(computeActual("SELECT * FROM \"jAVA.LANg:*\"").getRowCount() > 1); }
Source:
<code>public Jar pack(String profile) throws Exception { List<String> ignore = new ExtList<>(BUNDLE_SPECIFIC_HEADERS); try (ProjectBuilder pb = getBuilder(null)) { List<Builder> subBuilders = pb.getSubBuilders(); if (subBuilders.size() != 1) { error("Project has multiple bnd files, please select one of the bnd files").header(EXPORT) .context(profile); return null; } <START> try (Builder b = subBuilders.iterator() <END> .next()) { ignore.remove(BUNDLE_SYMBOLICNAME); ignore.remove(BUNDLE_VERSION); ignore.add(SERVICE_COMPONENT); try (ProjectLauncher launcher = getProjectLauncher()) { launcher.getRunProperties() .put("profile", profile); launcher.getRunProperties() .put(PROFILE, profile); Jar jar = launcher.executable(); Manifest m = jar.getManifest(); Attributes main = m.getMainAttributes(); for (String key : this) { if (Character.isUpperCase(key.charAt(0)) && !ignore.contains(key)) { String value = getProperty(key); if (value == null) continue; Name name = new Name(key); String trimmed = value.trim(); if (trimmed.isEmpty()) main.remove(name); else if (EMPTY_HEADER.equals(trimmed)) main.put(name, ""); else main.put(name, value); } } if (main.getValue(BUNDLE_SYMBOLICNAME) == null) main.putValue(BUNDLE_SYMBOLICNAME, b.getBsn()); if (main.getValue(BUNDLE_SYMBOLICNAME) == null) main.putValue(BUNDLE_SYMBOLICNAME, getName()); if (main.getValue(BUNDLE_VERSION) == null) { main.putValue(BUNDLE_VERSION, Version.LOWEST.toString()); warning("No version set, uses 0.0.0"); } jar.setManifest(m); jar.calcChecksums(new String[] { "SHA1", "MD5" }); launcher.removeClose(jar); return jar; } } } }</code><technical_language>calling pack a project a bit non-deterministic subbuilder subbuilder is defined order of subbuilderscan based File.listFiles() is defined a prescribed order of results. oddly, this method subbuilder obtain a BSN if is BSN in launcher's executable jar..</technical_language>

Target:
public Jar pack(String profile) throws Exception { return ExecutableJarExporter.pack(this, profile); }
Source:
<code>public List<ChoiceDTO> getChoices() { <START> return super.choices; <END> }</code><technical_language>This is worse before! need getter, access internal state. suggestion return super.getChoices();</technical_language>

Target:
public List<ChoiceDTO> getChoices() { return super.getChoices(); }