auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void refreshArticleRelationships(ArticleRevision sourceArticleRev) { ArticleXml sourceArticleXml = new ArticleXml(getManuscriptXml(sourceArticleRev.getIngestion())); Article sourceArticle = sourceArticleRev.getIngestion().getArticle(); List<RelatedArticleLink> xmlRelationships = sourceArticleXml.parseRelatedArticles(); List<ArticleRelationship> dbRelationships = getRelationshipsFrom(ArticleIdentifier.create(sourceArticle.getDoi())); dbRelationships.forEach(ar -> hibernateTemplate.delete(ar)); xmlRelationships.forEach(ar -> { getArticle(ar.getArticleId()).ifPresent((Article targetArticle) -> { hibernateTemplate.save(new ArticleRelationship(sourceArticle, targetArticle, ar.getType())); getLatestRevision(targetArticle).ifPresent((ArticleRevision targetArticleRev) -> { ArticleXml targetArticleXml = new ArticleXml(getManuscriptXml(targetArticleRev.getIngestion())); List<ArticleRelationship> reciprocalDbRelationships = getRelationshipsFrom(ArticleIdentifier.create(targetArticle.getDoi())).stream() .filter(dbAr -> dbAr.getTargetArticle() == sourceArticle) <START> .collect(Collectors.toList()); <END> targetArticleXml.parseRelatedArticles().stream() .filter(ral -> ral.getArticleId().getDoiName().equals(sourceArticle.getDoi())) .map(ral -> new ArticleRelationship(targetArticle, sourceArticle, ral.getType())) .filter(targetAr -> reciprocalDbRelationships.stream().noneMatch(dbr -> dbr.getType().equals(targetAr.getType()))) .forEach(targetAr -> hibernateTemplate.save(targetAr)); }); }); }); }</code><technical_language>move result of collect intermediate variable passed getRelationshipsFrom? auto-formatter handling indentation poorly</technical_language>

Target:
public void refreshArticleRelationships(ArticleRevision sourceArticleRev) { ArticleXml sourceArticleXml = new ArticleXml(getManuscriptXml(sourceArticleRev.getIngestion())); Article sourceArticle = sourceArticleRev.getIngestion().getArticle(); List<RelatedArticleLink> xmlRelationships = sourceArticleXml.parseRelatedArticles(); List<ArticleRelationship> dbRelationships = getRelationshipsFrom(ArticleIdentifier.create(sourceArticle.getDoi())); dbRelationships.forEach(ar -> hibernateTemplate.delete(ar)); xmlRelationships.forEach(ar -> { getArticle(ar.getArticleId()).ifPresent((Article relatedArticle) -> { hibernateTemplate.save(fromRelatedArticleLink(sourceArticle, ar)); getLatestRevision(relatedArticle).ifPresent((ArticleRevision relatedArticleRev) -> { ArticleXml relatedArticleXml = new ArticleXml(getManuscriptXml(relatedArticleRev.getIngestion())); Set<ArticleRelationship> inboundDbRelationships = getRelationshipsTo(ArticleIdentifier.create(sourceArticle.getDoi())).stream() .filter(dbAr -> dbAr.getSourceArticle().equals(relatedArticle)) .collect(Collectors.toSet()); relatedArticleXml.parseRelatedArticles().stream() .filter(ral -> ral.getArticleId().getDoiName().equals(sourceArticle.getDoi())) .map(ral -> fromRelatedArticleLink(relatedArticle, ral)) .filter(relatedAr -> !inboundDbRelationships.contains(relatedAr)) .forEach(relatedAr -> hibernateTemplate.save(relatedAr)); }); }); }); }
Source:
<code>public void put(K key, T obj) throws GoraException { try { if (obj.isDirty()) { Schema schema = obj.getSchema(); List<Schema.Field> fields = schema.getFields(); Map<Column, Object> data = new HashMap<>(); if (igniteMapping.getPrimaryKey().size() == 1) { Column getKey = igniteMapping.getPrimaryKey().get(0); data.put(getKey, key); } else { } for (Schema.Field field : fields) { <START> Column get = igniteMapping.getFields().get(field.name()); <END> Object v = obj.get(field.pos()); if (get != null && v != null) { Schema fieldSchema = field.schema(); Object serializedObj = serializeFieldValue(fieldSchema, v); data.put(get, serializedObj); } } String baseInsertStatement = IgniteSQLBuilder.baseInsertStatement(igniteMapping, data); try (PreparedStatement stmt = connection.prepareStatement(baseInsertStatement)) { IgniteSQLBuilder.fillInsertStatement(stmt, data); stmt.executeUpdate(); } catch (SQLException ex) { throw new GoraException(ex); } } else { LOG.info("Ignored putting object in the store as it is neither " + "new, neither dirty.", new Object[]{obj}); } } catch (Exception e) { throw new GoraException(e); } }</code><technical_language>Please intuitive names for variables Eg:- mappedColumn</technical_language>

Target:
public void put(K key, T obj) throws GoraException { try { if (obj.isDirty()) { Schema schema = obj.getSchema(); List<Schema.Field> fields = schema.getFields(); Map<Column, Object> data = new HashMap<>(); if (igniteMapping.getPrimaryKey().size() == 1) { Column getKey = igniteMapping.getPrimaryKey().get(0); data.put(getKey, key); } else { } for (Schema.Field field : fields) { Column mappedColumn = igniteMapping.getFields().get(field.name()); Object fieldValue = obj.get(field.pos()); if (mappedColumn != null && fieldValue != null) { Schema fieldSchema = field.schema(); Object serializedObj = serializeFieldValue(fieldSchema, fieldValue); data.put(mappedColumn, serializedObj); } } String baseInsertStatement = IgniteSQLBuilder.createInsertQuery(igniteMapping, data); try (PreparedStatement stmt = connection.prepareStatement(baseInsertStatement)) { IgniteSQLBuilder.fillInsertQuery(stmt, data); stmt.executeUpdate(); } catch (SQLException ex) { throw new GoraException(ex); } } else { LOG.info("Ignored putting object in the store as it is neither " + "new, neither dirty.", new Object[]{obj}); } } catch (Exception e) { throw new GoraException(e); } }
Source:
<code>public Yielder<OutType> next(final OutType initValue) { try { return wrapper.wrap(new Supplier<Yielder<OutType>>() { @Override public Yielder<OutType> get() { return new WrappingYielder<>(baseYielder.next(initValue), wrapper); } }); } catch (Throwable t) { try { wrapper.after(false, t); } catch (Exception e) { t.addSuppressed(e); } <START> if (t instanceof RuntimeException) { <END> throw t; } throw new RuntimeException(t); } }</code><technical_language>prompted changes</technical_language>

Target:
public Yielder<OutType> next(final OutType initValue) { try { return wrapper.wrap(new Supplier<Yielder<OutType>>() { @Override public Yielder<OutType> get() { return new WrappingYielder<>(baseYielder.next(initValue), wrapper); } }); } catch (Throwable t) { try { wrapper.after(false, t); } catch (Exception e) { t.addSuppressed(e); } Throwables.propagateIfPossible(t); throw new RuntimeException(t); } }
Source:
<code>public Contentlet fire(final Map<String, Object> properties, final String wfActionId) throws DotToolException { Contentlet contentlet = new Contentlet(); try { final MapToContentletPopulator mapToContentletPopulator = MapToContentletPopulator.INSTANCE; contentlet = mapToContentletPopulator.populate(contentlet, properties); if(UtilMethods.isSet(properties.get("inode"))) { contentlet.setInode((String) properties.get("inode")); } <START> final boolean ALLOW_FRONT_END_SAVING = Config <END> .getBooleanProperty("WORKFLOW_TOOL_ALLOW_FRONT_END_SAVING", false); final List<Category> cats = categoryAPI.getCategoriesFromContent(contentlet, user, ALLOW_FRONT_END_SAVING); final Map<Relationship, List<Contentlet>> relationships = (Map<Relationship, List<Contentlet>>) contentlet.get(RELATIONSHIP_KEY); final ContentletDependencies contentletDependencies = new ContentletDependencies.Builder() .workflowActionId(wfActionId) .respectAnonymousPermissions(ALLOW_FRONT_END_SAVING) .modUser(user).categories(cats) .relationships(relationshipAPI.getContentletRelationshipsFromMap(contentlet, relationships)) .indexPolicy(IndexPolicyProvider.getInstance().forSingleContent()) .build(); contentlet = workflowAPI.fireContentWorkflow(contentlet, contentletDependencies); } catch (Exception e) { throw new DotToolException(e); } return contentlet; }</code><technical_language>wrong convention</technical_language>

Target:
public Contentlet fire(final Map<String, Object> properties, final String wfActionId) throws DotToolException { Contentlet contentlet = new Contentlet(); try { final MapToContentletPopulator mapToContentletPopulator = MapToContentletPopulator.INSTANCE; contentlet = mapToContentletPopulator.populate(contentlet, properties); if(UtilMethods.isSet(properties.get("inode"))) { contentlet.setInode((String) properties.get("inode")); } final boolean allowFrontEndSaving = Config .getBooleanProperty("WORKFLOW_TOOL_ALLOW_FRONT_END_SAVING", false); final List<Category> categories = categoryAPI.getCategoriesFromContent(contentlet, user, allowFrontEndSaving); final Map<Relationship, List<Contentlet>> relationships = (Map<Relationship, List<Contentlet>>) contentlet.get(RELATIONSHIP_KEY); final ContentletDependencies contentletDependencies = new ContentletDependencies.Builder() .workflowActionId(wfActionId) .respectAnonymousPermissions(allowFrontEndSaving) .modUser(user).categories(categories) .relationships(relationshipAPI.getContentletRelationshipsFromMap(contentlet, relationships)) .indexPolicy(IndexPolicyProvider.getInstance().forSingleContent()) .build(); contentlet = workflowAPI.fireContentWorkflow(contentlet, contentletDependencies); } catch (Exception e) { throw new DotToolException(e); } return contentlet; }
Source:
<code>private Throwable getRealException(Throwable re) { if (re.getCause() == null) return re; Throwable cause = re.getCause(); <START> if (cause instanceof CacheException || cause instanceof RuntimeException || cause instanceof Error) <END> return getRealException(cause); else return re; }</code><technical_language>CacheException instanceOf RuntimeException, I guess simplify here</technical_language>

Target:
private Throwable getRealException(Throwable re) { if (re.getCause() == null) return re; Throwable cause = re.getCause(); if (cause instanceof RuntimeException || cause instanceof Error) return getRealException(cause); else return re; }
Source:
<code>public void testFormattedAmountUSAndGBP() throws Exception { final FixedPriceInvoiceItem fixedItemEUR = new FixedPriceInvoiceItem(UUID.randomUUID(), UUID.randomUUID(), null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), new LocalDate(), new BigDecimal("1499.95"), Currency.GBP); <START> final Invoice invoiceEUR = new DefaultInvoice(UUID.randomUUID(), new LocalDate(), new LocalDate(), Currency.GBP); <END> invoiceEUR.addInvoiceItem(fixedItemEUR); checkOutput(invoiceEUR, "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedChargedAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedPaidAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedBalance}}</strong></td>\n" + "</tr>", "<tr>\n" + " <td class=\"amount\"><strong>£1,499.95</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>£0.00</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>£1,499.95</strong></td>\n" + "</tr>", Locale.US); }</code><technical_language>invoiceGBP</technical_language>

Target:
public void testFormattedAmountUSAndGBP() throws Exception { final FixedPriceInvoiceItem fixedItem = new FixedPriceInvoiceItem(UUID.randomUUID(), UUID.randomUUID(), null, null, UUID.randomUUID().toString(), UUID.randomUUID().toString(), new LocalDate(), new BigDecimal("1499.95"), Currency.GBP); final Invoice invoice = new DefaultInvoice(UUID.randomUUID(), new LocalDate(), new LocalDate(), Currency.GBP); invoice.addInvoiceItem(fixedItem); checkOutput(invoice, "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedChargedAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedPaidAmount}}</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>{{invoice.formattedBalance}}</strong></td>\n" + "</tr>", "<tr>\n" + " <td class=\"amount\"><strong>£1,499.95</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>£0.00</strong></td>\n" + "</tr>\n" + "<tr>\n" + " <td class=\"amount\"><strong>£1,499.95</strong></td>\n" + "</tr>", Locale.US); }
Source:
<code>public String getProperty(String key) { String value = super.getProperty(key); <START> if (value != null) { <END> int beginIndex = 0; int startName = value.indexOf(PREFIX, beginIndex); while (startName != -1) { int endName = value.indexOf(SUFFIX, startName); if (endName == -1) { return value; } String constName = value.substring(startName + 1, endName); String constValue = getProperty(constName); if (constValue == null) { return value; } String newValue = (startName > 0) ? value.substring(0, startName) : ""; newValue += constValue; beginIndex = newValue.length(); newValue += value.substring(endName + 1); value = newValue; startName = value.indexOf(PREFIX, beginIndex); } } return value; }</code><technical_language>I prefer early exit in cases. E.g. if (value == null) { return null; }</technical_language>

Target:
public String getProperty(String key) { String value = getRawPropertyValue(key); return replaceProperties(value); }
Source:
<code>public Stream<Entry<K, V>> entryStream() { final ReadOptions readOptions = new ReadOptions(); readOptions.setSnapshot(null); final RocksDbEntryIterator entryIterator = new RocksDbEntryIterator(rocksDb.newIterator(readOptions), serializer); Stream<Entry<K, V>> resStream = StreamSupport.stream( <START> Spliterators.spliteratorUnknownSize(entryIterator, Spliterator.ORDERED), false); <END> resStream.onClose(entryIterator::close); return resStream; }</code><technical_language>is point of Spliterator</technical_language>

Target:
public Stream<Entry<K, V>> entryStream() { final RocksDbEntryIterator entryIterator = new RocksDbEntryIterator(rocksDb, serializer); Stream<Entry<K, V>> resStream = Streams.stream(entryIterator); resStream.onClose(entryIterator::close); return resStream; }
Source:
<code>private void disposeToolBarElement(ToolBarManager parentManager, MToolBarElement toolBarElement) { IContributionItem ici = getContribution(toolBarElement); if (ici == null) { return; } parentManager.remove(ici); <START> ici.dispose(); <END> clearModelToContribution(toolBarElement, ici); }</code><technical_language>dispose ici step</technical_language>

Target:
private void disposeToolBarElement(ToolBarManager parentManager, MToolBarElement toolBarElement) { IContributionItem ici = getContribution(toolBarElement); if (ici == null) { return; } parentManager.remove(ici); clearModelToContribution(toolBarElement, ici); ici.dispose(); }
Source:
<code>private JobGraph createJobGraph(TestCase testCase, int numTasks) { JobVertex source = new JobVertex("Source"); if (testCase == TestCase.JOB_FAILS || testCase == TestCase.JOB_IS_CANCELLED) { source.setInvokableClass(FailingBlockingInvokable.class); } else { source.setInvokableClass(NoOpInvokable.class); } source.setParallelism(numTasks); <START> JobGraph jobGraph = new JobGraph("BlobCleanupTest", source); jobGraph.setJobID(new JobID(0, testCase.ordinal())); return jobGraph; <END> }</code><technical_language>suggestion return new JobGraph( new JobID(0, testCase.ordinal()), "BlobCleanupTest", source);</technical_language>

Target:
private JobGraph createJobGraph(TestCase testCase, int numTasks) { JobVertex source = new JobVertex("Source"); if (testCase == TestCase.JOB_FAILS || testCase == TestCase.JOB_IS_CANCELLED) { source.setInvokableClass(FailingBlockingInvokable.class); } else { source.setInvokableClass(NoOpInvokable.class); } source.setParallelism(numTasks); return new JobGraph(new JobID(0, testCase.ordinal()), "BlobCleanupTest", source); }
Source:
<code>private PlaybackParameters retrievePlaybackParametersFromPreferences() { <START> SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); <END> final float speed = preferences .getFloat(context.getString(R.string.playback_speed_key), getPlaybackSpeed()); final float pitch = preferences.getFloat(context.getString(R.string.playback_pitch_key), getPlaybackPitch()); final boolean skipSilence = preferences .getBoolean(context.getString(R.string.playback_skip_silence_key), getPlaybackSkipSilence()); return new PlaybackParameters(speed, pitch, skipSilence); }</code><technical_language>this final well</technical_language>

Target:
private PlaybackParameters retrievePlaybackParametersFromPreferences() { final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); final float speed = preferences .getFloat(context.getString(R.string.playback_speed_key), getPlaybackSpeed()); final float pitch = preferences.getFloat(context.getString(R.string.playback_pitch_key), getPlaybackPitch()); final boolean skipSilence = preferences .getBoolean(context.getString(R.string.playback_skip_silence_key), getPlaybackSkipSilence()); return new PlaybackParameters(speed, pitch, skipSilence); }
Source:
<code>private void initializeDataChunks() { if (options.getChunkIdsOnly || options.getBlobOptions.getOperationType() == GetBlobOptions.OperationType.BlobInfo) { chunkIdIterator = null; numChunksTotal = 0; dataChunks = null; } else { <START> chunkIdIterator = keysAndSizesAndOffsets.listIterator(); <END> numChunksTotal = keysAndSizesAndOffsets.size(); dataChunks = new GetChunk[Math.min(keysAndSizesAndOffsets.size(), NonBlockingRouter.MAX_IN_MEM_CHUNKS)]; for (int i = 0; i < dataChunks.length; i++) { int idx = chunkIdIterator.nextIndex(); CompositeBlobInfo.ChunkMetadata keyAndOffset = chunkIdIterator.next(); dataChunks[i] = new GetChunk(idx, keyAndOffset); } } }</code><technical_language>change this name chunkMetadataList</technical_language>

Target:
private void initializeDataChunks() { if (options.getChunkIdsOnly || options.getBlobOptions.getOperationType() == GetBlobOptions.OperationType.BlobInfo) { chunkIdIterator = null; numChunksTotal = 0; dataChunks = null; } else { chunkIdIterator = chunkMetadataList.listIterator(); numChunksTotal = chunkMetadataList.size(); dataChunks = new GetChunk[Math.min(chunkMetadataList.size(), NonBlockingRouter.MAX_IN_MEM_CHUNKS)]; for (int i = 0; i < dataChunks.length; i++) { int idx = chunkIdIterator.nextIndex(); CompositeBlobInfo.ChunkMetadata keyAndOffset = chunkIdIterator.next(); dataChunks[i] = new GetChunk(idx, keyAndOffset); } } }
Source:
<code>public boolean remove(Object key, Object value) { cacheImplementation.assertKeyValueNotNull(key, value); <START> InvocationContext ctx = cacheImplementation.getInvocationContextWithImplicitTransaction(false, 1); <END> RemoveCommand command = cacheImplementation.createRemoveConditionalCommand(key, value, flags, ctx); return (Boolean) cacheImplementation.executeCommandAndCommitIfNeeded(ctx, command); }</code><technical_language>setting lockOwner here? (or in replace...)</technical_language>

Target:
public boolean remove(Object key, Object value) { return cacheImplementation.remove(key, value, flags, writeContext(1)); }
Source:
<code>public T take() { T headValue = null; try { headValue = super.take(); super.offer(headValue); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } return headValue; }</code><technical_language>logger instead system.err</technical_language>

Target:
public synchronized T take() { T headValue = null; try { headValue = super.take(); super.offer(headValue); } catch (InterruptedException e) { logger.error("Thread interrupted during the 'take' from a circular queue in the " + "RoundRobinAssignmentStrategy",e); } return headValue; }
Source:
<code>public void testCreateLocalNotificationAndVerify() { <START> Notification localPhoneNotification = new NotificationFactory(new SmartActionFactory(context)) <END> .buildSimpleNotification(context, localPhone); assertTrue(localPhoneNotification.priority != Notification.PRIORITY_MIN); }</code><technical_language>localPhone variable declare in this method. components of a test are: prepare, execute, assert. In prepare part suppose declare variables in test. a technical note is instanciate objects close usage garbage collection easier. setup method create objects in tests context</technical_language>

Target:
public void testCreateLocalNotificationAndVerify() { ClippingDto localClipping = new ClippingDto().setContent("+919876543210") .setType(ClippingDto.ClippingType.PHONE_NUMBER) .setClippingProvider(ClippingDto.ClippingProvider.LOCAL).setCreateAt(new Date()) .setDeviceId("uniqueId"); Notification localPhoneNotification = new NotificationFactory(new SmartActionFactory(context)) .buildSimpleNotification(context, localClipping); assertTrue(localPhoneNotification.priority != Notification.PRIORITY_MIN); }
Source:
<code>public static void main(String[] args) throws Exception { CommandLine cmdLine = null; try { cmdLine = new CommandLine(args); } catch (final Exception e) { System.out.println("Failed due to invalid parameters: " + Arrays.toString(args)); <START> e.printStackTrace(); <END> System.out.println("Use '-h' for more details."); System.exit(1); } initClassLoader(); ZapBootstrap bootstrap = createZapBootstrap(cmdLine); try { int rc = bootstrap.start(); if (rc != 0) { System.exit(rc); } } catch (final Exception e) { logger.fatal(e.getMessage(), e); System.exit(1); } }</code><technical_language>printStackTrace() provide useful? I users (or us) I end messy. Stack traces for working out error is, this is user supplying invalid cmdline option.</technical_language>

Target:
public static void main(String[] args) throws Exception { CommandLine cmdLine = null; try { cmdLine = new CommandLine(args); } catch (final Exception e) { System.out.println("Failed due to invalid parameters: " + Arrays.toString(args)); System.out.println(e.getMessage()); System.out.println("Use '-h' for more details."); System.exit(1); } initClassLoader(); ZapBootstrap bootstrap = createZapBootstrap(cmdLine); try { int rc = bootstrap.start(); if (rc != 0) { System.exit(rc); } } catch (final Exception e) { logger.fatal(e.getMessage(), e); System.exit(1); } }
Source:
<code>public void onDragDrop(TreeDragDropEvent event) { TreeNode dragTreeNode = event.getDragNode(); TreeNode dropTreeNode = event.getDropNode(); Object dragNodeObject = dragTreeNode.getData(); Object dropNodeObject = dropTreeNode.getData(); if (!(dragNodeObject instanceof StructureTreeNode) || !(dropNodeObject instanceof StructureTreeNode)) { Helper.setErrorMessage("Unable to move structure element!"); return; } StructureTreeNode dropNode = (StructureTreeNode) dropNodeObject; StructureTreeNode dragNode = (StructureTreeNode) dragNodeObject; if (dropNode.getDataObject() instanceof IncludedStructuralElement && dragNode.getDataObject() instanceof IncludedStructuralElement) { checkLogicalDragDrop((IncludedStructuralElement) dragNode.getDataObject(), (IncludedStructuralElement) dropNode.getDataObject()); <START> } else if (dropNode.getDataObject() instanceof MediaUnit && dropNode.getDataObject() instanceof MediaUnit) { <END> checkPhysicalDragDrop((MediaUnit) dragNode.getDataObject(), (MediaUnit) dropNode.getDataObject()); } else { Helper.setErrorMessage("Unable to move structure element!"); } }</code><technical_language>expression sides of &&</technical_language>

Target:
public void onDragDrop(TreeDragDropEvent event) { TreeNode dragTreeNode = event.getDragNode(); TreeNode dropTreeNode = event.getDropNode(); Object dragNodeObject = dragTreeNode.getData(); Object dropNodeObject = dropTreeNode.getData(); if (!(dragNodeObject instanceof StructureTreeNode) || !(dropNodeObject instanceof StructureTreeNode)) { Helper.setErrorMessage("Unable to move structure element!"); return; } StructureTreeNode dropNode = (StructureTreeNode) dropNodeObject; StructureTreeNode dragNode = (StructureTreeNode) dragNodeObject; if (dropNode.getDataObject() instanceof IncludedStructuralElement && dragNode.getDataObject() instanceof IncludedStructuralElement) { checkLogicalDragDrop((IncludedStructuralElement) dragNode.getDataObject(), (IncludedStructuralElement) dropNode.getDataObject()); } else if ((dropNode.getDataObject()) instanceof MediaUnit && dropNode.getDataObject() instanceof MediaUnit) { checkPhysicalDragDrop((MediaUnit) dragNode.getDataObject(), (MediaUnit) dropNode.getDataObject()); } else { Helper.setErrorMessage("Unable to move structure element!"); } }
Source:
<code>public void onConnectionStateChange(final ConnectionStateChange change) { <START> if (change.getCurrentState() == ConnectionState.CONNECTED) { <END> for(InternalChannel channel : channelNameToChannelMap.values()){ sendOrQueueSubscribeMessage(channel); } } }</code><technical_language>I this new indentation</technical_language>

Target:
public void onConnectionStateChange(final ConnectionStateChange change) { if (change.getCurrentState() == ConnectionState.CONNECTED) { for(final InternalChannel channel : channelNameToChannelMap.values()){ sendOrQueueSubscribeMessage(channel); } } }
Source:
<code>private void deleteBranches(final Set<String> branches) { ProjectApi.deleteBranches(getProjectKey(), branches, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { <START> for (int row = 1; row < table.getRowCount();) { BranchInfo k = getRowItem(row); if (k != null && branches.contains(k.ref())) { table.removeRow(row); } else { row++; } } updateDeleteButton(); delBranch.setVisible(branchTable.hasBranchCanDelete()); <END> } @Override public void onFailure(Throwable caught) { query = new Query(match).start(start).run(); super.onFailure(caught); } }); }</code><technical_language>do insert</technical_language>

Target:
private void deleteBranches(final Set<String> branches) { ProjectApi.deleteBranches(getProjectKey(), branches, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { query = new Query(match).start(start).run(); } @Override public void onFailure(Throwable caught) { query = new Query(match).start(start).run(); super.onFailure(caught); } }); }
Source:
<code>public void updateResponse(String id, InputStream stream) { BufferedInputStream dataStream = new BufferedInputStream(stream, DATA_BUFFER_SIZE); try (Connection connection = getConnection(); PreparedStatement myUpdateSQL = connection.prepareStatement(updateString)) { myUpdateSQL.setString(UPDATE_COLUMN_REQUEST_ID, id); myUpdateSQL.setAsciiStream(UPDATE_COLUMN_RESPONSE, dataStream, DATA_BUFFER_SIZE); <START> myUpdateSQL.executeUpdate(); <END> } catch (SQLException ex) { LOGGER.error("Could not update response in database", ex); } }</code><technical_language>suggest returning int created in update statements. This ability unit test this</technical_language>

Target:
public void updateResponse(String id, InputStream stream) { BufferedInputStream dataStream = new BufferedInputStream(stream, DATA_BUFFER_SIZE); try (Connection connection = getConnection(); PreparedStatement updateStatement = connection.prepareStatement(updateString)) { updateStatement.setString(UPDATE_COLUMN_REQUEST_ID, id); updateStatement.setAsciiStream(UPDATE_COLUMN_RESPONSE, dataStream, DATA_BUFFER_SIZE); updateStatement.executeUpdate(); } catch (SQLException ex) { LOGGER.error("Could not update response in database", ex); } }
Source:
<code>protected Entity replaceMember(Entity member, Location memberLoc) { synchronized (mutex) { Optional<Entity> added = growByOne(memberLoc, ImmutableMap.of()); if (!added.isPresent()) { String msg = String.format("In %s, failed to grow, to replace %s; not removing", this, member); throw new IllegalStateException(msg); } try { stopAndRemoveNode(member); } catch (Exception e) { Exceptions.propagateIfFatal(e); <START> throw new IllegalStateException("replaceMember failed to stop and remove old member "+member.getId(), e); <END> } return added.get(); } }</code><technical_language>Arguably correct throw IllegalStateException, in advance stopAndRemoveNode() fail (i.e. determine 'state' invoking method). suggestion below, cleaner add a new unchecked exception type</technical_language>

Target:
protected Entity replaceMember(Entity member, Location memberLoc) { synchronized (mutex) { Optional<Entity> added = growByOne(memberLoc, ImmutableMap.of()); if (!added.isPresent()) { String msg = String.format("In %s, failed to grow, to replace %s; not removing", this, member); throw new IllegalStateException(msg); } try { stopAndRemoveNode(member); } catch (Exception e) { Exceptions.propagateIfFatal(e); throw new StopFailedRuntimeException("replaceMember failed to stop and remove old member "+member.getId(), e); } return added.get(); } }
Source:
<code>private List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){ <START> ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService(); <END> String locales = configurationService.getArrayProperty("webui.supported.locales"); List<String> newAcceptableFilenames = new ArrayList<>(); newAcceptableFilenames.addAll(acceptableFilenames); for(String local : locales){ for(String acceptableFilename : acceptableFilenames){ String values = acceptableFilename.split("\\."); newAcceptableFilenames.add(values[0] + "_" + local + "." + values[1]); } } return newAcceptableFilenames; }</code><technical_language>NewsServiceImpl is a bean autowire configuration service in (you factory retrieve instance. example of autowiring: <LINK_0></technical_language>

Target:
protected List<String> addLocalesToAcceptableFilenames(List<String> acceptableFilenames){ String locales = configurationService.getArrayProperty("webui.supported.locales"); List<String> newAcceptableFilenames = new ArrayList<>(); newAcceptableFilenames.addAll(acceptableFilenames); for(String local : locales){ for(String acceptableFilename : acceptableFilenames){ int lastPoint = acceptableFilename.lastIndexOf("."); newAcceptableFilenames.add( acceptableFilename.substring(0, lastPoint) + "_" + local + acceptableFilename.substring(lastPoint)); } } return newAcceptableFilenames; }
Source:
<code>public void setReferenceIndex(final int referenceIndex) { if (referenceIndex == NO_ALIGNMENT_REFERENCE_INDEX) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; mReferenceName = NO_ALIGNMENT_REFERENCE_NAME; } else if (null == mHeader) { <START> throw new IllegalArgumentException("A non-null SAMFileHeader is required to resolve the reference index"); <END> } else { SAMSequenceRecord samSequence = mHeader.getSequence(referenceIndex); if (null != samSequence) { mReferenceIndex = referenceIndex; mReferenceName = samSequence.getSequenceName(); } else { throw new IllegalArgumentException("Reference index " + referenceIndex + " not found in sequence dictionary."); } } }</code><technical_language>IllegalStateException</technical_language>

Target:
public void setReferenceIndex(final int referenceIndex) { if (referenceIndex == NO_ALIGNMENT_REFERENCE_INDEX) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; mReferenceName = NO_ALIGNMENT_REFERENCE_NAME; } else if (null == mHeader) { throw new IllegalStateException("A non-null SAMFileHeader is required to resolve the reference index"); } else { SAMSequenceRecord samSequence = mHeader.getSequence(referenceIndex); if (null != samSequence) { mReferenceIndex = referenceIndex; mReferenceName = samSequence.getSequenceName(); } else { throw new IllegalArgumentException("Reference index " + referenceIndex + " not found in sequence dictionary."); } } }
Source:
<code>protected void checkProjectMapping(final Map<String, IReferencePoint> mapping) { for (final Entry<String, IReferencePoint> entry : mapping.entrySet()) { final String id = entry.getKey(); final IReferencePoint referencePoint = entry.getValue(); final ProjectNegotiationData data = getProjectNegotiationData(id); if (data == null) throw new IllegalArgumentException("invalid reference point id: " + id); if (!referencePointManager.projectExists(referencePoint)) <START> throw new IllegalArgumentException("reference point does not exist: " + referencePoint); <END> } }</code><technical_language>throw new IllegalArgumentException("project exist referencePoint " + referencePoint);</technical_language>

Target:
protected void checkProjectMapping(final Map<String, IReferencePoint> mapping) { for (final Entry<String, IReferencePoint> entry : mapping.entrySet()) { final String id = entry.getKey(); final IReferencePoint referencePoint = entry.getValue(); final ProjectNegotiationData data = getProjectNegotiationData(id); if (data == null) throw new IllegalArgumentException("invalid reference point id: " + id); if (!referencePointManager.projectExists(referencePoint)) throw new IllegalArgumentException( "project does not exist at the referencePoint " + referencePoint); } }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); for (int i = 0; i < fLocations.length; i++) { if (i > 0) { sb.append(", "); } sb.append("[location="); sb.append(fLocations[i]); sb.append(",rank="); sb.append(fRanks[i]); <START> sb.append("]"); <END> } sb.append("]"); return sb.toString(); }</code><technical_language>']'</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(' ').append('['); for (int i = 0; i < fLocations.length; i++) { if (i > 0) { sb.append(", "); } sb.append("[location="); sb.append(fLocations[i]); sb.append(",rank="); sb.append(fRanks[i]); sb.append(']'); } sb.append(']'); return sb.toString(); }
Source:
<code>public Result<BpmnNode> convert(IntermediateCatchEvent event) { CatchEventPropertyReader p = propertyReaderFactory.of(event); List<EventDefinition> eventDefinitions = p.getEventDefinitions(); switch (eventDefinitions.size()) { case 0: throw new UnsupportedOperationException("An intermediate catch event should contain exactly one definition"); case 1: return Match.of(EventDefinition.class, Result.class) .when(TimerEventDefinition.class, e -> timerEvent(event, e)) .when(SignalEventDefinition.class, e -> signalEvent(event, e)) .when(MessageEventDefinition.class, e -> messageEvent(event, e)) .when(ErrorEventDefinition.class, e -> errorEvent(event, e)) .when(ConditionalEventDefinition.class, e -> conditionalEvent(event, e)) .when(EscalationEventDefinition.class, e -> escalationEvent(event, e)) .when(CompensateEventDefinition.class, e -> compensationEvent(event, e)) <START> .defaultValue(Result.ignored("Ignored IntermediateCatchEvent")) <END> .mode(getMode()) .apply(eventDefinitions.get(0)) .value() .get(); default: throw new UnsupportedOperationException("Multiple definitions not supported for intermediate catch event"); } }</code><technical_language>sense add a MarshalingMessage Result.ignored a proper messageKey here</technical_language>

Target:
public Result<BpmnNode> convert(IntermediateCatchEvent event) { CatchEventPropertyReader p = propertyReaderFactory.of(event); List<EventDefinition> eventDefinitions = p.getEventDefinitions(); switch (eventDefinitions.size()) { case 0: throw new UnsupportedOperationException("An intermediate catch event should contain exactly one definition"); case 1: return Match.of(EventDefinition.class, Result.class) .when(TimerEventDefinition.class, e -> timerEvent(event, e)) .when(SignalEventDefinition.class, e -> signalEvent(event, e)) .when(MessageEventDefinition.class, e -> messageEvent(event, e)) .when(ErrorEventDefinition.class, e -> errorEvent(event, e)) .when(ConditionalEventDefinition.class, e -> conditionalEvent(event, e)) .when(EscalationEventDefinition.class, e -> escalationEvent(event, e)) .when(CompensateEventDefinition.class, e -> compensationEvent(event, e)) .defaultValue(Result.ignored("Ignored IntermediateCatchEvent", getNotFoundMessage(event))) .mode(getMode()) .apply(eventDefinitions.get(0)) .value(); default: throw new UnsupportedOperationException("Multiple definitions not supported for intermediate catch event"); } }
Source:
<code>int getScreenProtection() { <START> if (settings.contains("restlessMode") && (!settings.contains("restlessMode"))){ settings.edit().putString("screenProtection", "0").apply(); <END> settings.edit().remove("restlessMode").apply(); } return Integer.parseInt(settings.getString("screenProtection", "1")); }</code><technical_language>suggestion if (settings.contains("restlessMode") && settings.getBoolean("restlessMode", true)){ settings.edit().putString("screenProtection", "1").apply();</technical_language>

Target:
int getScreenProtection() { if (settings.contains("restlessMode") && (!settings.getBoolean("restlessMode",true))){ settings.edit().putString("screenProtection", "0").apply(); settings.edit().remove("restlessMode").apply(); } return Integer.parseInt(settings.getString("screenProtection", "1")); }
Source:
<code>private MElementContainer<?> getLastContainer() { MElementContainer<MUIElement> searchRoot = getContainer(); List<MUIElement> children = searchRoot.getChildren(); if (children.size() == 0) { MPartStack stack = modelService.createModelElement(MPartStack.class); searchRoot.getChildren().add(stack); return stack; } MElementContainer<?> lastContainer = getLastContainer(searchRoot, children); if (lastContainer == null) { MPartStack stack = modelService.createModelElement(MPartStack.class); modelService.insert(stack, (MPartSashContainerElement) children.get(0), EModelService.RIGHT_OF, 0.5f); return stack; } else if (!(lastContainer instanceof MPartStack)) { MPartStack stack = modelService.createModelElement(MPartStack.class); modelService.insert(stack, (MPartSashContainerElement) children.get(0), <START> EModelService.RIGHT_OF, 0.5f); <END> return stack; } return lastContainer; }</code><technical_language>be: modelService.insert(stack,(MPartSashContainerElement) lastContainer.getChildren().get(0), EModelService.RIGHT_OF, 0.5f); ? Otherwise, if - elseif blocks merged - identical</technical_language>

Target:
private MElementContainer<?> getLastContainer() { MElementContainer<MUIElement> searchRoot = getContainer(); List<MUIElement> children = searchRoot.getChildren(); if (children.size() == 0) { MPartStack stack = modelService.createModelElement(MPartStack.class); searchRoot.getChildren().add(stack); return stack; } MElementContainer<?> lastContainer = getLastContainer(searchRoot, children); if (lastContainer instanceof MPartStack) { return lastContainer; } MPartStack stack = modelService.createModelElement(MPartStack.class); stack.setElementId("CreatedByGetLastContainer"); if (children.get(0) instanceof MPartSashContainer) { MPartSashContainer psc = (MPartSashContainer) children.get(0); psc.getChildren().add(stack); } else { modelService.insert(stack, (MPartSashContainerElement) children.get(0), EModelService.RIGHT_OF, 0.5f); } return stack; }
Source:
<code>protected boolean canDoAction() { <START> disk = getDiskDao().get(getParameters().getDiskId()); <END> return isVmExist() && isVmUpOrDown() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk() && acquireLockInternal(); }</code><technical_language>Do call acquireLockInternal() explicitly here. called CommandBase performing canDoAction? furthermore, if do need call explicitly i guess call return other checks performed vm is locked</technical_language>

Target:
protected boolean canDoAction() { disk = getDiskDao().get(getParameters().getDiskId()); return isVmExist() && isVmUpOrDown() && isDiskExist(disk) && checkCanPerformPlugUnPlugDisk(); }
Source:
<code>public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); <START> <<<<<<< HEAD <END> ContextHolder.setServerName(client.getHostname()); ======= ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); >>>>>>> 5029ec3... image delete ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }</code><technical_language>Please clean it</technical_language>

Target:
public void run() { JsonRpcRequest request = null; try { request = JsonRpcRequest.fromByteArray(message); ContextHolder.init(); ContextHolder.setServerName(client.getRetryPolicy().getIdentifier()); log.debug("client policy identifier {}", client.getRetryPolicy().getIdentifier()); ResponseBuilder builder = new ResponseBuilder(request.getId()); String methodName = request.getMethod(); builder = CommandFactory.createCommand(methodName).run(request.getParams(), builder); send(builder.build(), request.getMethod()); } catch (Throwable e) { log.error("Failure in processing request", e); Map<String, Object> error = new HashMap<>(); error.put("code", 100); error.put("message", e.getMessage()); if (request != null) { send(new ResponseBuilder(request.getId()).withError(error).build(), request.getMethod()); } } }
Source:
<code><START> public static DocumentUriMaker uriMaker(String format) { <END> final class FormatUriMaker { private String formatter; FormatUriMaker(String format) { this.formatter = format; } String makeUri(AbstractWriteHandle content) { return String.format(formatter, UUID.randomUUID()); } } FormatUriMaker formatUriMaker = new FormatUriMaker(format); return formatUriMaker::makeUri; }</code><technical_language>For robustness, uriMaker() throw IllegalArgumentException if format is null</technical_language>

Target:
public static DocumentUriMaker uriMaker(String format) throws IllegalArgumentException{ if(format == null || format.length() == 0) throw new IllegalArgumentException("Format cannot be null or empty"); final class FormatUriMaker { private String uriFormat; FormatUriMaker(String format) { this.uriFormat = format; } String makeUri(AbstractWriteHandle content) { return String.format(uriFormat, UUID.randomUUID()); } } FormatUriMaker formatUriMaker = new FormatUriMaker(format); return formatUriMaker::makeUri; }
Source:
<code>public void addRegistryHook(RegistryHook<Item> hook) { <START> throw new UnsupportedOperationException("This registry does not support hooks"); <END> }</code><technical_language>option simply delegate itemRegistry, is done for tother overridden methods</technical_language>

Target:
public void addRegistryHook(RegistryHook<Item> hook) { if (itemRegistry != null) { itemRegistry.addRegistryHook(hook); } }
Source:
<code>public void checkSpecificAccessControl() { <START> String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); <END> gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.getId()), logic.getCourse(courseId)); }</code><technical_language>enable access for student here? need ask core members</technical_language>

Target:
public void checkSpecificAccessControl() { if (!(userInfo.isInstructor || userInfo.isStudent)) { throw new UnauthorizedAccessException("Student or instructor account is required to access this resource."); } String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); if (userInfo.isInstructor) { gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.getId()), logic.getCourse(courseId)); } if (userInfo.isStudent) { CourseAttributes course = logic.getCourse(courseId); gateKeeper.verifyAccessible(logic.getStudentForGoogleId(courseId, userInfo.id), course); } }
Source:
<code>public short undelete(MessageInfo info) throws StoreException { checkStarted(); try { BlobId blobId = (BlobId) info.getStoreKey(); short newLifeVersion = <START> requestAgent.doWithRetries(() -> cloudDestination.undeleteBlob(blobId, info.getLifeVersion()), "Undelete", <END> partitionId.toPathString()); addToCache(blobId.getID(), BlobState.CREATED); return newLifeVersion; } catch (CloudStorageException ex) { StoreErrorCodes errorCode = (ex.getStatusCode() == STATUS_NOT_FOUND) ? StoreErrorCodes.ID_Not_Found : StoreErrorCodes.IOError; throw new StoreException(ex, errorCode); } }</code><technical_language>I want point out info.getLifeVersion return -1 (MessageInfo.LIFE_VERSION_FROM_FRONTEND). If so, means fetch current lifeVersion increment put azure cosmo. add a todo deal it</technical_language>

Target:
public short undelete(MessageInfo info) throws StoreException { checkStarted(); try { return requestAgent.doWithRetries(() -> undeleteIfNeeded((BlobId) info.getStoreKey(), info.getLifeVersion()), "Undelete", partitionId.toPathString()); } catch (CloudStorageException cex) { StoreErrorCodes errorCode = (cex.getStatusCode() == STATUS_NOT_FOUND) ? StoreErrorCodes.ID_Not_Found : StoreErrorCodes.IOError; throw new StoreException(cex, errorCode); } }
Source:
<code>public String[] getParameterTypes() { <START> return parameterTypes.clone(); <END> }</code><technical_language>This is necessary control, suppress</technical_language>

Target:
public String[] getParameterTypes() { return parameterTypes; }
Source:
<code>public void addContainers(Set<PackingPlan.ContainerPlan> containersToAdd) { String basePodName = Runtime.topologyName(runtime) + "-0"; JsonNode podConfig; try { podConfig = controller.getBasePod(basePodName); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Problem retrieving base pod configuration", ioe); throw new TopologyRuntimeManagementException("Unable to add containers for update"); } ObjectMapper mapper = new ObjectMapper(); for (PackingPlan.ContainerPlan containerPlan : containersToAdd) { String newContainer = rebuildKubernetesPodSpec(podConfig, mapper, containerPlan, 0); try { controller.deployContainer(newContainer); } catch (IOException ioe) { LOG.log(Level.SEVERE, "Problem deploying new container", ioe); throw new TopologyRuntimeManagementException("Unable to add container for update"); } } <START> <END> }</code><technical_language>pls remove empty lines closing brackets</technical_language>

Target:
public void addContainers(Set<PackingPlan.ContainerPlan> containersToAdd) { String basePodName = Runtime.topologyName(runtime) + "-0"; JsonNode podConfig; try { podConfig = controller.getBasePod(basePodName); } catch (IOException ioe) { throw new TopologyRuntimeManagementException("Unable to retrieve base pod configuration from " + basePodName, ioe); } ObjectMapper mapper = new ObjectMapper(); int totalNewContainerCount = containersToAdd.size(); int deployedContainerCount = 0; for (PackingPlan.ContainerPlan containerPlan : containersToAdd) { String newContainer = rebuildKubernetesPodSpec(podConfig, mapper, containerPlan, 0); try { controller.deployContainer(newContainer); LOG.log(Level.INFO, "New container " + ++deployedContainerCount + "/" + totalNewContainerCount + " deployed"); } catch (IOException ioe) { throw new TopologyRuntimeManagementException("Problem adding container with id " + containerPlan.getId() + ". Deployed " + deployedContainerCount + " out of " + totalNewContainerCount + " containers", ioe); } } }
Source:
<code><START> public boolean canLogAtLevel(LogLevel logLevel) { <END> LogLevel environmentLoggingLevel = getEnvironmentLoggingLevel(); return canLogAtLevel(logLevel, environmentLoggingLevel); }</code><technical_language>this static accept a Class String? Right this get cases of ClientLogger private. I understand this is meant allow determine logic logging happen</technical_language>

Target:
public boolean canLogAtLevel(LogLevel logLevel) { return canLogAtLevel(logLevel, getEnvironmentLoggingLevel()); }