auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void createAutoCompleteData() { if (redisPool == null || redis_properties_key == null || redis_properties_key.equals("")) { return; } try { LOG.info("Creating auto complete data for front end"); Map<String, Map<String, Set<Object>>> typeMap = new HashMap<>(); for (Entity e : unfilteredEntities.values()) { String type = (String) e.getFilterProperties().get("type"); if (null != type) { Map<String, Set<Object>> typeData = typeMap.get(type); if (null == typeData) { typeData = new HashMap<>(); typeMap.put(type, typeData); } for (String k : e.getFilterProperties().keySet()) { Set<Object> values = typeData.get(k); if (null == values) { values = new HashSet<>(); typeData.put(k, values); } values.add(e.getFilterProperties().get(k)); } } } typeMap.remove("GLOBAL"); ObjectMapper mapper = new ObjectMapper(); String v = mapper.writeValueAsString(typeMap); Jedis jedis = redisPool.getResource(); <START> try { <END> jedis.set(redis_properties_key.getBytes(), Snappy.compress(v.getBytes("UTF-8"))); } finally { jedis.close(); } LOG.info("Done writing auto complete data for front end"); } catch (Exception ex) { LOG.error("Error during generating auto complete data"); } }</code><technical_language>try-with-resource here, i.e. try (Jedis jedis = redisPool.getResource()) {...} --- automatically closing</technical_language>

Target:
private void createAutoCompleteData() { if (redisPool == null || redis_properties_key == null || redis_properties_key.equals("")) { return; } try { LOG.info("Creating auto complete data for front end"); Map<String, Map<String, Set<Object>>> typeMap = new HashMap<>(); for (Entity e : unfilteredEntities.values()) { String type = (String) e.getFilterProperties().get("type"); if (null != type) { Map<String, Set<Object>> typeData = typeMap.get(type); if (null == typeData) { typeData = new HashMap<>(); typeMap.put(type, typeData); } for (String k : e.getFilterProperties().keySet()) { Set<Object> values = typeData.get(k); if (null == values) { values = new HashSet<>(); typeData.put(k, values); } values.add(e.getFilterProperties().get(k)); } } } typeMap.remove("GLOBAL"); ObjectMapper mapper = new ObjectMapper(); String v = mapper.writeValueAsString(typeMap); try (Jedis jedis = redisPool.getResource()) { jedis.set(redis_properties_key.getBytes(), Snappy.compress(v.getBytes("UTF-8"))); } LOG.info("Done writing auto complete data for front end"); } catch (Exception ex) { LOG.error("Error during generating auto complete data"); } }
Source:
<code>public void annotationToFieldsReturnsValuesInTheMapThatAreUnmodifiable() { <START> exception.expect(UnsupportedOperationException.class); <END> TestClass tc = new TestClass(FieldAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkField>> annotationToFields = tc.getAnnotationToFields(); List<FrameworkField> fields = annotationToFields.get(Rule.class); fields.add(null); }</code><technical_language>put this line right call fields.add(null)</technical_language>

Target:
public void annotationToFieldsReturnsValuesInTheMapThatAreUnmodifiable() { TestClass tc = new TestClass(FieldAnnotated.class); Map<Class<? extends Annotation>, List<FrameworkField>> annotationToFields = tc.getAnnotationToFields(); List<FrameworkField> fields = annotationToFields.get(Rule.class); exception.expect(UnsupportedOperationException.class); fields.add(null); }
Source:
<code>public final int read(final String table, final String key, final Set<String> fields, final HashMap<String, ByteIterator> result) { try { final MongoCollection collection = database.getCollection(table); final DocumentBuilder query = DOCUMENT_BUILDER.get().reset().add("_id", key); Document queryResult = null; if (fields != null) { final DocumentBuilder fieldsToReturn = BuilderFactory.start(); final Iterator<String> iter = fields.iterator(); while (iter.hasNext()) { fieldsToReturn.add(iter.next(), 1); } final Find.Builder fb = new Find.Builder(query); fb.projection(fieldsToReturn); fb.setLimit(1); fb.setBatchSize(1); fb.readPreference(readPreference); final MongoIterator<Document> ci = collection.find(fb.build()); if (ci.hasNext()) { queryResult = ci.next(); ci.close(); } } else { queryResult = collection.findOne(query); } if (queryResult != null) { fillMap(result, queryResult); } <START> return queryResult != null ? StatusCode.OK : StatusCode.ERROR; <END> } catch (final Exception e) { System.err.println(e.toString()); return StatusCode.ERROR; } }</code><technical_language>StatusCode.ERROR Status.NOT_FOUND</technical_language>

Target:
public final Status read(final String table, final String key, final Set<String> fields, final HashMap<String, ByteIterator> result) { try { final MongoCollection collection = database.getCollection(table); final DocumentBuilder query = DOCUMENT_BUILDER.get().reset().add("_id", key); Document queryResult = null; if (fields != null) { final DocumentBuilder fieldsToReturn = BuilderFactory.start(); final Iterator<String> iter = fields.iterator(); while (iter.hasNext()) { fieldsToReturn.add(iter.next(), 1); } final Find.Builder fb = new Find.Builder(query); fb.projection(fieldsToReturn); fb.setLimit(1); fb.setBatchSize(1); fb.readPreference(readPreference); final MongoIterator<Document> ci = collection.find(fb.build()); if (ci.hasNext()) { queryResult = ci.next(); ci.close(); } } else { queryResult = collection.findOne(query); } if (queryResult != null) { fillMap(result, queryResult); } return queryResult != null ? Status.OK : Status.NOT_FOUND; } catch (final Exception e) { System.err.println(e.toString()); return Status.ERROR; } }
Source:
<code>PgPool sqlClient(int size) { PoolOptions options = new PoolOptions(); PgConnectOptions connectOptions = new PgConnectOptions(); Matcher matcher = Pattern.compile("vertx-reactive:postgresql://([-a-zA-Z]+):([0-9]+)/(.*)").matcher(url); matcher.matches(); connectOptions.setDatabase(matcher.group(3)); connectOptions.setHost(matcher.group(1)); <START> connectOptions.setPort(Integer.parseInt(matcher.group(2))); <END> connectOptions.setUser(user); connectOptions.setPassword(pass); connectOptions.setCachePreparedStatements(true); options.setMaxSize(size); return PgPool.pool(vertx, connectOptions, options); }</code><technical_language>nice for constants for readability</technical_language>

Target:
PgPool sqlClient(int size) { PoolOptions options = new PoolOptions(); PgConnectOptions connectOptions = new PgConnectOptions(); Matcher matcher = Pattern.compile(PG_URI_MATCHER).matcher(url); matcher.matches(); connectOptions.setDatabase(matcher.group(3)); connectOptions.setHost(matcher.group(1)); connectOptions.setPort(Integer.parseInt(matcher.group(2))); connectOptions.setUser(user); connectOptions.setPassword(pass); connectOptions.setCachePreparedStatements(true); options.setMaxSize(size); return PgPool.pool(vertx, connectOptions, options); }
Source:
<code>private static String escapeName(String name) { if (JavaSyntaxUtils.isReserved(name)) { name = name + "$"; } <START> if (!Character.isJavaIdentifierStart(name.charAt(0))) { <END> name = "_" + name; } return name; }</code><technical_language>mutually exclusive? is a micro optimization</technical_language>

Target:
private static String escapeName(String name) { if (JavaSyntaxUtils.isReserved(name)) { name = name + "$"; } else if (!Character.isJavaIdentifierStart(name.charAt(0))) { name = "_" + name; } return name; }
Source:
<code>public String docs() { <START> return "{type: <macro> The entity type of the entity | id <macro> The entity id of the entity | player: <macro> The player triggering the event}" <END> + " This event is called when an entity toggles it's gliding state (Using Elytra)." + " {id: The entityID of the entity | type: The entity type of the entity |" + " gliding: true if the entity is entering gliding mode, false if the entity is leaving it |" + " player: If the entity is a player, this will contain their name, otherwise null}" + " {}" + " {}"; }</code><technical_language>Missing colon "id"</technical_language>

Target:
public String docs() { return "{type: <macro> The entity type of the entity | id: <macro> The entity id of the entity | player: <macro> The player triggering the event}" + " This event is called when an entity toggles it's gliding state (Using Elytra)." + " {id: The entityID of the entity | type: The entity type of the entity |" + " gliding: true if the entity is entering gliding mode, false if the entity is leaving it |" + " player: If the entity is a player, this will contain their name, otherwise null}" + " {}" + " {}"; }
Source:
<code>protected void addPages() { try { IEditorInput editorInput = this.getEditorInput(); if (editorInput instanceof FileEditorInput) { addPage(0, new DefaultSessionEditorPage(this, session)); } } catch (PartInitException e) { ErrorDialog.openError(getSite().getShell(), <START> "Error creating nested session editor", null, <END> e.getStatus()); } }</code><technical_language>externalized</technical_language>

Target:
protected void addPages() { try { IEditorInput editorInput = this.getEditorInput(); if (editorInput instanceof FileEditorInput) { addPage(0, new DefaultSessionEditorPage(this, session)); } } catch (PartInitException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_page_loading_error_message, new Object[0]), e.getMessage(), e.getStatus()); } }
Source:
<code>private String formatMessage(Object[] outputData) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < splitTemplateArray.length; i++) { if (i % 2 == 0) { stringBuilder.append(splitTemplateArray[i]); } else { <START> stringBuilder.append(outputData[Integer.parseInt(splitTemplateArray[i])]); <END> } } return stringBuilder.toString(); }</code><technical_language>Integer.parseInt time expensive check if skip</technical_language>

Target:
private String formatMessage(Object[] outputData) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < splitTemplateArray.length; i++) { if (i % 2 == 0) { stringBuilder.append(splitTemplateArray[i]); } else { stringBuilder.append(outputData[positionArray[i / 2]]); } } return stringBuilder.toString(); }
Source:
<code><START> public void <END> fireFilterChanged() { for (ITimeGraphViewerFilterListener listener : fViewerFilterListeners) { listener.filterChanged(); } }</code><technical_language>this need public</technical_language>

Target:
private void fireFilterChanged() { for (ITimeGraphViewerFilterListener listener : fViewerFilterListeners) { listener.filterChanged(); } }
Source:
<code>InstantiatorProvider2 getInstantiatorProvider() { if (defaultInstantiatorProvider == null) { defaultInstantiatorProvider = (new DefaultMockitoPlugins()).getDefaultPlugin(InstantiatorProvider.class); } <START> if (instantiatorProvider.getClass() != defaultInstantiatorProvider.getClass()) { <END> return new InstantiatorProvider2() { @Override public Instantiator getInstantiator(final MockCreationSettings<?> settings) { return new Instantiator() { @Override public <T> T newInstance(Class<T> cls) throws InstantiationException { try { return instantiatorProvider.getInstantiator(settings).newInstance(cls); } catch (org.mockito.internal.creation.instance.InstantiationException e) { throw new InstantiationException(e.getMessage(), e.getCause()); } } }; } }; } return instantiatorProvider2; }</code><technical_language>complexity of loading plugins in PluginLoader type. is hard understand here. Example implementation: Object plugin = new PluginLoader(pluginSwitch).loadPlugin(InstantiatorProvider.class, InstantiatorProvider2.class); //returned plugin is of 2 types, 'instanceof' find out create a new type adapts InstantiatorProvider2 interface PluginRegistry this: private final InstantiatorProvider2 instantiatorProvider2 = new InstantiatorProviderWrapper( new PluginLoader(pluginSwitch).loadPlugin(InstantiatorProvider.class, InstantiatorProvider2.class)); I implementing remove need for LegacyDefaultInstantiatorProvider class included in this PR</technical_language>

Target:
InstantiatorProvider2 getInstantiatorProvider() { return instantiatorProvider; }
Source:
<code>public void addItem(final ShoppingCartItem item) { ShoppingCartItem cartItem = getItemFromCart(item); ShoppingCartItem sessionItem = getItemFromSession(item); <START> if (sessionItem != null && cartItem == null) { <END> addItemToCart(item); } else if (cartItem == null) { addItemToCart(item); addItemToSession(item); } }</code><technical_language>This sounds clearer: if (cartItem == null) { addItemToCart(); if (sessionItem == null) { addItemToSession(); } }</technical_language>

Target:
public void addItem(final ShoppingCartItem item) { ShoppingCartItem existingItemOfSameType = getItemFromCart(item); if (existingItemOfSameType != null) { existingItemOfSameType.addMore(item.getQuantity()); ShoppingCartQuantityChangeEvent.fire(this, existingItemOfSameType, existingItemOfSameType.getQuantity()); } else { items.add(item); ShoppingCartChangedEvent.fire(item, this); } shoppingCartLocalStorage.update(items); }
Source:
<code><START> private String sha256(byte[] unhashedBytes) { <END> return Hashing.sha256().hashBytes(unhashedBytes).toString(); }</code><technical_language>method static</technical_language>

Target:
private static String sha256(byte[] unhashedBytes) { return Hashing.sha256().hashBytes(unhashedBytes).toString(); }
Source:
<code>public SQLMetadataStorageActionHandler( final SQLMetadataConnector connector, final ObjectMapper jsonMapper, final MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> types, final String entryTypeName, final String entryTable, final String logTable, final String lockTable ) { this.connector = connector; <START> this.jsonMapper = new DefaultObjectMapper((DefaultObjectMapper) jsonMapper).addMixIn(org.apache.druid.metadata.PasswordProvider.class, org.apache.druid.metadata.PasswordProviderRedactionMixIn.class); <END> this.entryType = types.getEntryType(); this.statusType = types.getStatusType(); this.logType = types.getLogType(); this.lockType = types.getLockType(); this.entryTypeName = entryTypeName; this.entryTable = entryTable; this.logTable = logTable; this.lockTable = lockTable; this.taskInfoMapper = new TaskInfoMapper<>(jsonMapper, entryType, statusType); }</code><technical_language>here. please explain this change is needed? KinesisIndexTask is PasswordProvider, work this change</technical_language>

Target:
public SQLMetadataStorageActionHandler( final SQLMetadataConnector connector, final ObjectMapper jsonMapper, final MetadataStorageActionHandlerTypes<EntryType, StatusType, LogType, LockType> types, final String entryTypeName, final String entryTable, final String logTable, final String lockTable ) { this.connector = connector; this.jsonMapper = jsonMapper.copy().addMixIn(org.apache.druid.metadata.PasswordProvider.class, org.apache.druid.metadata.PasswordProviderRedactionMixIn.class); this.entryType = types.getEntryType(); this.statusType = types.getStatusType(); this.logType = types.getLogType(); this.lockType = types.getLockType(); this.entryTypeName = entryTypeName; this.entryTable = entryTable; this.logTable = logTable; this.lockTable = lockTable; this.taskInfoMapper = new TaskInfoMapper<>(jsonMapper, entryType, statusType); }
Source:
<code>public void emptySentence() { <START> Pangram pangram = new Pangram(""); <END> assertFalse(pangram.isPangram()); }</code><technical_language>other tracks like, I odd return object of type Pangram is .. a pangram. In terms of Java, recommend instead java @Test(expected = IllegalArgumentException.class) public void itRejectsEmptySentence() { Pangram p = Pangram.of(""); } if want stick isPangram method, stick a static method a Pangrams helper class. java @Test public void itRejectsEmptySentence() { { assertFalse(Pangrams.isPangram("")); }</technical_language>

Target:
public void emptySentence() { assertFalse(Pangrams.isPangram("")); }
Source:
<code>protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); <START> massUpdate.select("select kee from permission_templates where " + lengthFunction + "(kee) > " + VarcharColumnDef.UUID_SIZE); <END> massUpdate.update("update permission_templates set kee=? where kee=?"); massUpdate.rowPluralName("permission templates"); massUpdate.execute((row, update) -> { String oldKey = row.getString(1); String newKey = uuidFactory.create(); update.setString(1, newKey); update.setString(2, oldKey); return true; }); }</code><technical_language>select return a SqlStatement call setLong safely set size compare</technical_language>

Target:
protected void execute(Context context) throws SQLException { MassUpdate massUpdate = context.prepareMassUpdate(); massUpdate.select("select kee from permission_templates where " + lengthFunction + "(kee) > ?").setInt(1, VarcharColumnDef.UUID_SIZE); massUpdate.update("update permission_templates set kee=? where kee=?"); massUpdate.rowPluralName("permission templates"); massUpdate.execute((row, update) -> { String oldKey = row.getString(1); String newKey = uuidFactory.create(); update.setString(1, newKey); update.setString(2, oldKey); return true; }); }
Source:
<code>protected Collection<String> defaultSuppressionAnnotations() { <START> Collection defaultValues = new ArrayList<String>(); <END> defaultValues.addAll(super.defaultSuppressionAnnotations()); defaultValues.add("java.lang.Deprecated"); defaultValues.add("javafx.fxml.FXML"); return defaultValues; }</code><technical_language>This is a raw type, please a parameterized type (Collection<String>)</technical_language>

Target:
protected Collection<String> defaultSuppressionAnnotations() { Collection<String> defaultValues = new ArrayList<>(); defaultValues.addAll(super.defaultSuppressionAnnotations()); defaultValues.add("java.lang.Deprecated"); defaultValues.add("javafx.fxml.FXML"); return defaultValues; }
Source:
<code>public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getCreateBrickCommand())) { showCreateBrickDialog(); <START> } else if (command.getName().equals("OnCreateBrick")) { END> createBrick(); } else if (command.getName().equals("Cancel")) { setWindow(null); } else if (command.equals(getSyncStorageDevicesCommand())) { syncStorageDevices(); } }</code><technical_language>case</technical_language>

Target:
public void executeCommand(UICommand command) { super.executeCommand(command); if (command.equals(getCreateBrickCommand())) { showCreateBrickDialog(); } else if (command.getName().equals("onCreateBrick")) { createBrick(); } else if (command.getName().equals("closeWindow")) { setWindow(null); } else if (command.equals(getSyncStorageDevicesCommand())) { syncStorageDevices(); } }
Source:
<code>public EquivalentHashMap( int initialCapacity, float loadFactor, Equivalence<K> keyEq, Equivalence<V> valueEq) { int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; <START> threshold = (int)(capacity * DEFAULT_LOAD_FACTOR); <END> table = new Node[capacity]; this.keyEq = keyEq; this.valueEq = valueEq; }</code><technical_language>capacity * loadFactor maybe</technical_language>

Target:
public EquivalentHashMap( int initialCapacity, float loadFactor, Equivalence<K> keyEq, Equivalence<V> valueEq) { int capacity = 1; while (capacity < initialCapacity) capacity <<= 1; this.loadFactor = loadFactor; threshold = (int)(capacity * loadFactor); table = new Node[capacity]; this.keyEq = keyEq; this.valueEq = valueEq; }
Source:
<code>public AppendTask( @JsonProperty("id") String id, @JsonProperty("dataSource") String dataSource, @JsonProperty("segments") List<DataSegment> segments, <START> @JsonProperty("aggregations") List<AggregatorFactory> aggregators, <END> @JsonProperty("indexSpec") IndexSpec indexSpec, @JsonProperty("context") Map<String, Object> context ) { super(id, dataSource, segments, context); this.indexSpec = indexSpec == null ? new IndexSpec() : indexSpec; this.aggregators = aggregators == null ? null : aggregators.toArray(new AggregatorFactory[aggregators.size()]); }</code><technical_language>a JsonProperty getter for this</technical_language>

Target:
public AppendTask( @JsonProperty("id") String id, @JsonProperty("dataSource") String dataSource, @JsonProperty("segments") List<DataSegment> segments, @JsonProperty("aggregations") List<AggregatorFactory> aggregators, @JsonProperty("indexSpec") IndexSpec indexSpec, @JsonProperty("context") Map<String, Object> context ) { super(id, dataSource, segments, context); this.indexSpec = indexSpec == null ? new IndexSpec() : indexSpec; this.aggregators = aggregators; }
Source:
<code>public void waitForLayoutNotification(String layoutId) { synchronized (mLock) { while (!Objects.equal(getCurrentLayoutId(), layoutId)) { LOG.info("Waiting for layout notification with ID {}, current layout ID is {}.", layoutId, mCurrentLayoutId); try { mLock.wait(); } catch (InterruptedException ie) { <START> throw new RuntimeInterruptedException(ie); <END> } } } }</code><technical_language>This a minimum restore thread's interrupted status Thread.currentThread().interrupt(). Throwing exception is typically poor form, depends thread's context. is a chapter in Effective Java specifics if interested</technical_language>

Target:
public void waitForLayoutNotification(String layoutId) { synchronized (mLock) { while (!Objects.equal(getCurrentLayoutId(), layoutId)) { LOG.info("Waiting for layout notification with ID {}, current layout ID is {}.", layoutId, mCurrentLayoutId); try { mLock.wait(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } } }
Source:
<code>private void setRowsCount(TableName tableName, TableStatistics tableStatistics, Table table) throws TException { Map<String, String> tableParameters = table.getParameters(); tableParameters.put("numRows", Long.toString(tableStatistics.getRowCount())); String dataSize = Long.toString(tableStatistics.getRowCount() * table.getSd().getCols().size() * 42); tableParameters.put("rawDataSize", dataSize); tableParameters.put("totalSize", dataSize); <START> tableParameters.put("numFiles", "3"); <END> tableParameters.put("STATS_GENERATED_VIA_STATS_TASK", "true"); client.alter_table(getSchema(tableName), tableName.getSchemalessNameInDatabase(), table); }</code><technical_language>1</technical_language>

Target:
private void setRowsCount(TableName tableName, TableStatistics tableStatistics, Table table) throws TException { Map<String, String> tableParameters = table.getParameters(); tableParameters.put("numRows", Long.toString(tableStatistics.getRowCount())); String dataSize = Long.toString(tableStatistics.getRowCount() * table.getSd().getCols().size() * 42); tableParameters.put("rawDataSize", dataSize); tableParameters.put("totalSize", dataSize); tableParameters.put("numFiles", "1"); tableParameters.put("STATS_GENERATED_VIA_STATS_TASK", "true"); client.alter_table(getSchema(tableName), tableName.getSchemalessNameInDatabase(), table); }
Source:
<code>public void testRequestInAreaWithNoGranulesBecomesTransparent() throws Exception { final AbstractGridFormat format = TestUtils.getFormat(rgbURL); final ImageMosaicReader reader = TestUtils.getReader(rgbURL, format); assertNotNull(reader); final ParameterValue<GridGeometry2D> ggp = AbstractGridFormat.READ_GRIDGEOMETRY2D.createValue(); Envelope2D env = new Envelope2D(reader.getCoordinateReferenceSystem(), 19, 45, 1, 1); GridGeometry2D gg = new GridGeometry2D(new GridEnvelope2D(0, 0, 50, 50), (Envelope) env); ggp.setValue(gg); final ParameterValue<Color> transparent = ImageMosaicFormat.INPUT_TRANSPARENT_COLOR.createValue(); transparent.setValue(new Color(0, 0, 0)); GridCoverage2D coverage = reader.read(new GeneralParameterValue[] {ggp, transparent}); assertNotNull(coverage); <START> new GeoTiffWriter(TestData.temp(this, "test.tiff")).write(coverage, null); <END> assertTrue(coverage.getEnvelope2D().contains((Rectangle2D) env)); int[] pixel = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE }; coverage.evaluate(new Point2D.Double(20, 45), pixel); assertEquals(0, pixel[0]); assertEquals(0, pixel[1]); assertEquals(0, pixel[2]); assertEquals(0, pixel[3]); }</code><technical_language>I add a call dispose end</technical_language>

Target:
public void testRequestInAreaWithNoGranulesBecomesTransparent() throws Exception { final AbstractGridFormat format = TestUtils.getFormat(rgbURL); final ImageMosaicReader reader = TestUtils.getReader(rgbURL, format); try { assertNotNull(reader); final ParameterValue<GridGeometry2D> ggp = AbstractGridFormat.READ_GRIDGEOMETRY2D.createValue(); Envelope2D env = new Envelope2D(reader.getCoordinateReferenceSystem(), 19, 45, 1, 1); GridGeometry2D gg = new GridGeometry2D(new GridEnvelope2D(0, 0, 50, 50), (Envelope) env); ggp.setValue(gg); final ParameterValue<Color> transparent = ImageMosaicFormat.INPUT_TRANSPARENT_COLOR.createValue(); transparent.setValue(new Color(0, 0, 0)); GridCoverage2D coverage = reader.read(new GeneralParameterValue[] {ggp, transparent}); assertNotNull(coverage); assertTrue(coverage.getEnvelope2D().contains((Rectangle2D) env)); int[] pixel = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE }; coverage.evaluate(new Point2D.Double(20, 45), pixel); assertEquals(0, pixel[0]); assertEquals(0, pixel[1]); assertEquals(0, pixel[2]); assertEquals(0, pixel[3]); } finally { reader.dispose(); } }
Source:
<code>Get(L row, boolean findLast) { if (!findLast) <START> assert row != null; <END> this.row = row; this.findLast = findLast; }</code><technical_language>assert findLast ^ row != null</technical_language>

Target:
Get(L row, boolean findLast) { assert findLast ^ row != null; this.row = row; this.findLast = findLast; }
Source:
<code>public int read(byte[] bs, int off, int len) throws IOException { if (len == 0) { return 0; } int bsIndex = 0; for (; bsIndex < len;) { <START> final int readNow = is.read(BUFFER, 0, Math.min(len - bsIndex, BUFFER.length)); <END> if (readNow == -1) { break; } for (int bufIndex = 0; bufIndex < readNow; bufIndex++) { byte b = BUFFER[bufIndex]; if (b == '\r') { if (bufIndex < readNow - 1) { final byte future = BUFFER[bufIndex + 1]; if (future == '\n') { continue; } } else { final int future = is.read(); is.unread(future); if (future == '\n') { continue; } } } bs[off + bsIndex++] = b; } } return bsIndex == 0 ? -1 : bsIndex; }</code><technical_language>Instead of reading amount fit in caller's buffer, fill entire local buffer. worst need 1 byte of lookahead. worst find a '\r' local buffer is empty need slide '\r' beginning of local buffer, fill rest, continue scan. I main loop for read this: private final byte[] buf = new byte[8192]; private final InputStream in; private int cnt; private int ptr; public int read(byte[] bs, int off, int len) throws IOException { if (len == 0) return 0; final int startOff = off; final int end = + len; while (off < end) { if (ptr == cnt) { cnt = in.read(buf, 0, buf.length); if (cnt < 1) break; ptr = 0; } byte b = buf[ptr++]; if (b != '\r') { bs[off++] = b; continue; } if (ptr == cnt) { cnt = in.read(buf, 1, buf.length - 1); if (cnt <= 0) { bs[off++] = '\r'; break; } buf[0] = '\r'; ptr = 1; } if (buf[ptr] == '\n') { bs[off++] = '\n'; ptr++; } else bs[off++] = '\r'; } return startOff == ? -1 : - startOff; }</technical_language>

Target:
public int read(byte[] bs, int off, int len) throws IOException { if (len == 0) return 0; if (cnt == -1) return -1; final int startOff = off; final int end = off + len; while (off < end) { if (ptr == cnt && !fillBuffer()) { break; } byte b = buf[ptr++]; if (b != '\r') { bs[off++] = b; continue; } if (ptr == cnt && !fillBuffer()) { bs[off++] = '\r'; break; } if (buf[ptr] == '\n') { bs[off++] = '\n'; ptr++; } else bs[off++] = '\r'; } return startOff == off ? -1 : off - startOff; }
Source:
<code>private void switchTimelines(final Timeline activeTimeline, final Timeline nextTimeline) { LOG.info("Switching timelines from to {}", activeTimeline, nextTimeline); transactionTemplate.execute(status -> { try { timelineDbRepository.createTimeline(nextTimeline); timelineSync.startTimelineUpdate(activeTimeline.getEventType(), nakadiSettings.getTimelineWaitTimeoutMs()); nextTimeline.setSwitchedAt(new Date()); if (!activeTimeline.isFake()) { final Timeline.StoragePosition storagePosition = topicRepositoryHolder.createStoragePosition(activeTimeline); activeTimeline.setLatestPosition(storagePosition); timelineDbRepository.updateTimelime(activeTimeline); } timelineDbRepository.updateTimelime(nextTimeline); return null; } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); throw new TimelineException("Failed to switch timeline for:" + activeTimeline.getEventType()); } catch (final Exception ex) { <START> LOG.error(ex.getMessage(), ex); <END> throw new TimelineException("Failed to switch timeline for:" + activeTimeline.getEventType(), ex); } finally { finishTimelineUpdate(activeTimeline.getEventType()); } }); }</code><technical_language>I thought decided log exception in controller's exception-handler</technical_language>

Target:
private void switchTimelines(final Timeline activeTimeline, final Timeline nextTimeline) { LOG.info("Switching timelines from to {}", activeTimeline, nextTimeline); try { timelineSync.startTimelineUpdate(activeTimeline.getEventType(), nakadiSettings.getTimelineWaitTimeoutMs()); } catch (final InterruptedException ie) { Thread.currentThread().interrupt(); throw new TimelineException("Failed to switch timeline for: " + activeTimeline.getEventType()); } catch (final IllegalStateException ie) { throw new ConflictException("Timeline is already being created for: " + activeTimeline.getEventType(), ie); } try { transactionTemplate.execute(status -> { timelineDbRepository.createTimeline(nextTimeline); nextTimeline.setSwitchedAt(new Date()); if (!activeTimeline.isFake()) { final Timeline.StoragePosition storagePosition = topicRepositoryHolder.createStoragePosition(activeTimeline); activeTimeline.setLatestPosition(storagePosition); timelineDbRepository.updateTimelime(activeTimeline); } timelineDbRepository.updateTimelime(nextTimeline); return null; }); } catch (final TransactionException tx) { LOG.error(tx.getMessage(), tx); throw new TimelineException("Failed to create timeline in DB for: " + activeTimeline.getEventType(), tx); } finally { finishTimelineUpdate(activeTimeline.getEventType()); } }
Source:
<code>public void configure() { setName(this.getClass().getSimpleName()); setDescription("Batch ETL Application"); addStream(new Stream(Constants.DEFAULT_INPUT_STREAM)); createDataset(Constants.DICTIONARY_DATASET, DictionaryDataSet.class); createDataset(Constants.ETL_META_DATASET, ETLMetaDataSet.class); Configurer configurer = new Configurer(); configure(configurer); ETLMapReduce mapReduce = new ETLMapReduce(configurer.source, configurer.transformation, configurer.sink, getDatasets()); addMapReduce(mapReduce); addWorkflow(new ETLMapReduceWorkflow(ETLMapReduce.NAME)); long intervalInMinutes = 10; String cronEntry = "0/" + intervalInMinutes + " * * * *"; <START> scheduleWorkflow("FiveMinuteSchedule", cronEntry, ETLMapReduceWorkflow.NAME); <END> }</code><technical_language>5 10 minute schedule</technical_language>

Target:
public void configure() { setName(this.getClass().getSimpleName()); setDescription("Batch ETL Application"); addStream(new Stream(Constants.DEFAULT_INPUT_STREAM)); createDataset(Constants.DICTIONARY_DATASET, DictionaryDataSet.class); createDataset(Constants.ETL_META_DATASET, ETLMetaDataSet.class); Configurer configurer = new Configurer(); configure(configurer); ETLMapReduce mapReduce = new ETLMapReduce(configurer.source, configurer.transformation, configurer.sink, getDatasets()); addMapReduce(mapReduce); addWorkflow(new ETLMapReduceWorkflow(ETLMapReduce.NAME)); long intervalInMinutes = 10; String cronEntry = "0/" + intervalInMinutes + " * * * *"; scheduleWorkflow("TenMinuteSchedule", cronEntry, ETLMapReduceWorkflow.NAME); }
Source:
<code>void nonSessionCancelScheduleMessage(MessagingEntityType entityType) { setSenderAndReceiver(entityType); final Instant scheduledEnqueueTime = Instant.now().plusSeconds(20); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); long sequenceNumber = sender.scheduleMessage(message, scheduledEnqueueTime); Assertions.assertTrue(sequenceNumber > 0); <START> sender.cancelScheduledMessage(sequenceNumber); <END> }</code><technical_language>If this succeeds, want decrement messages pending</technical_language>

Target:
void nonSessionCancelScheduleMessage(MessagingEntityType entityType) { setSenderAndReceiver(entityType); final Instant scheduledEnqueueTime = Instant.now().plusSeconds(20); final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId); long sequenceNumber = sender.scheduleMessage(message, scheduledEnqueueTime); Assertions.assertTrue(sequenceNumber >= 0); sender.cancelScheduledMessage(sequenceNumber); messagesPending.incrementAndGet(); }
Source:
<code>SynchronizationResult run(CancellationTokenSource tokenSource, IProgressMonitor monitor) { GradleMarkerManager.clear(this.gradleBuild); DefaultSynchronizationResult result; try { <START> CorePlugin.operationManager().run(this, tokenSource, monitor); <END> this.failures.forEach(f -> GradleErrorMarker.create(f.getResource(), this.gradleBuild, f.getMessage(), f.getException(), 0)); result = DefaultSynchronizationResult.from(getFailures()); } catch (CoreException e) { ToolingApiStatus status = ToolingApiStatus.from("Project synchronization" , e); if (status.severityMatches(IStatus.WARNING | IStatus.ERROR)) { GradleMarkerManager.addError(this.gradleBuild, status); } result = DefaultSynchronizationResult.from(e.getStatus()); } if (result.status.matches(IStatus.WARNING | IStatus.ERROR)) { CorePlugin.getInstance().getLog().log(result.status); } return result; }</code><technical_language>a difference warning error. method name is misleading</technical_language>

Target:
SynchronizationResult run(CancellationTokenSource tokenSource, IProgressMonitor monitor) { GradleMarkerManager.clear(this.gradleBuild); DefaultSynchronizationResult result; try { CorePlugin.operationManager().run(this, tokenSource, monitor); for (SynchronizationProblem f : this.failures) { if (f.getSeverity() == IStatus.ERROR) { GradleErrorMarker.createError(f.getResource(), this.gradleBuild, f.getMessage(), f.getException(), 0); } else if (f.getSeverity() == IStatus.WARNING) { GradleErrorMarker.createWarning(f.getResource(), this.gradleBuild, f.getMessage(), f.getException(), 0); } } result = DefaultSynchronizationResult.from(getFailures()); } catch (CoreException e) { ToolingApiStatus status = ToolingApiStatus.from("Project synchronization" , e); if (status.severityMatches(IStatus.WARNING | IStatus.ERROR)) { GradleMarkerManager.addError(this.gradleBuild, status); } result = DefaultSynchronizationResult.from(e.getStatus()); } if (result.status.matches(IStatus.WARNING | IStatus.ERROR)) { CorePlugin.getInstance().getLog().log(result.status); } return result; }
Source:
<code>private synchronized ListenableFuture<?> abortInternal() { <START> Stream<ListenableFuture<?>> concat = Stream.concat( <END> functionNamespaceTransactions.values().stream() .map(transactionMetadata -> finishingExecutor.submit(() -> safeAbort(transactionMetadata))), connectorIdToMetadata.values().stream() .map(connection -> finishingExecutor.submit(() -> safeAbort(connection)))); List<ListenableFuture<?>> collect = concat .collect(toList()); return nonCancellationPropagating(Futures.allAsList(collect)); }</code><technical_language>Unrelated change</technical_language>

Target:
private synchronized ListenableFuture<?> abortInternal() { return nonCancellationPropagating(Futures.allAsList(Stream.concat( functionNamespaceTransactions.values().stream() .map(transactionMetadata -> finishingExecutor.submit(() -> safeAbort(transactionMetadata))), connectorIdToMetadata.values().stream() .map(connection -> finishingExecutor.submit(() -> safeAbort(connection)))) .collect(toList()))); }
Source:
<code>public Collection<ISymbolProvider> getSymbolProviders(ITmfTrace trace) { synchronized (fInstances) { Collection<ISymbolProvider> symbolProviders = new ArrayList<>(); Collection<WeakReference<ISymbolProvider>> references = fInstances.get(trace); <START> if (!references.isEmpty()) { <END> for (WeakReference<ISymbolProvider> reference : references) { ISymbolProvider provider = reference.get(); if (provider != null) { symbolProviders.add(provider); } } return symbolProviders; } for (SymbolProviderFactoryWrapper wrapper : fProviders) { ISymbolProviderFactory factory = wrapper.factory; ISymbolProvider provider = factory.createProvider(trace); if (provider != null) { symbolProviders.add(provider); fInstances.put(trace, new WeakReference<>(provider)); } } if (!symbolProviders.isEmpty()) { return symbolProviders; } return Collections.singleton(new DefaultSymbolProvider(trace)); } }</code><technical_language>this check [1]</technical_language>

Target:
public Collection<ISymbolProvider> getSymbolProviders(ITmfTrace trace) { synchronized (fInstances) { Collection<ISymbolProvider> symbolProviders = new ArrayList<>(); for (WeakReference<ISymbolProvider> reference : fInstances.get(trace)) { ISymbolProvider provider = reference.get(); if (provider != null) { symbolProviders.add(provider); } } if (symbolProviders.isEmpty()) { for (SymbolProviderFactoryWrapper wrapper : fProviders) { ISymbolProviderFactory factory = wrapper.factory; ISymbolProvider provider = factory.createProvider(trace); if (provider != null) { symbolProviders.add(provider); fInstances.put(trace, new WeakReference<>(provider)); } } } return !symbolProviders.isEmpty() ? symbolProviders : Collections.singleton(new DefaultSymbolProvider(trace)); } }
Source:
<code>protected void run(JsonNode jsonNode) { for (int i = 0; i < jsonNode.get("caches_number").asInt(); i++) { log.info("Creating cache" + i + "..."); IgniteCache<Integer, Integer> cache = ignite.createCache(jsonNode.get("cacheName").asText()); log.info("Destroying cache..."); ignite.destroyCache(jsonNode.get("cacheName").asText()); <START> <END> } markFinished(); }</code><technical_language>newline is required</technical_language>

Target:
@Override protected void run(JsonNode jsonNode) { markInitialized(); for (int i = 0; i < jsonNode.get("cacheNumber").asInt(); i++) { log.info("Creating cache " + i + "..."); ignite.createCache(jsonNode.get("cacheName").asText()); log.info("Destroying cache " + i + "..."); ignite.destroyCache(jsonNode.get("cacheName").asText()); } markFinished(); }
Source:
<code>static String getFontSize(String inputStyle) { int theSize = 1; String theReturn; <START> int thePointStart = inputStyle.indexOf(' '), thePointEnd = inputStyle.lastIndexOf("pt"); <END> if (thePointStart == -1) { thePointStart = 0; } while ((inputStyle.charAt(thePointStart) == ' ') && (thePointStart < inputStyle.length())) { thePointStart++; } if (thePointStart > thePointEnd) { theReturn = MEDIUM_FONT; } else { theSize = Integer.valueOf(inputStyle.substring(thePointStart, thePointEnd)); theReturn = getFontSize(theSize, false); } return theReturn; }</code><technical_language>I wrong, based logic in this method, lastIndexOf more useful for thePointStart I add 1 result</technical_language>

Target:
private String getFontSize(String inputStyle) { int theSize = 1; String theReturn; int thePointStart = inputStyle.indexOf(' '), thePointEnd = inputStyle.lastIndexOf("pt"); if (thePointStart == -1) { thePointStart = 0; } while ((inputStyle.charAt(thePointStart) == ' ') && (thePointStart < inputStyle.length())) { thePointStart++; } if (thePointStart > thePointEnd) { theReturn = MEDIUM_FONT; } else { theSize = Integer.valueOf(inputStyle.substring(thePointStart, thePointEnd)); theReturn = getFontSize(theSize, false); } return theReturn; }
Source:
<code>protected View onCreateViewHelper(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, int fragmentResource) { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(fragmentResource, container, false); listView = (RecyclerView) root.findViewById(android.R.id.list); layoutManager = new LinearLayoutManager(getActivity()); <START> listView.setLayoutManager(layoutManager); <END> progLoading = (ProgressBar) root.findViewById(R.id.progLoading); if (!itemsLoaded) { progLoading.setVisibility(View.VISIBLE); } viewsCreated = true; if (itemsLoaded && activity.get() != null) { onFragmentLoaded(); } return root; }</code><technical_language>listView.setHasFixedSize(true); listView -> recyclerView? Also, <LINK_0> RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), null); listView.addItemDecoration(itemDecoration);</technical_language>

Target:
protected View onCreateViewHelper(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, int fragmentResource) { super.onCreateView(inflater, container, savedInstanceState); View root = inflater.inflate(fragmentResource, container, false); recyclerView = (RecyclerView) root.findViewById(android.R.id.list); layoutManager = new LinearLayoutManager(getActivity()); recyclerView.setLayoutManager(layoutManager); recyclerView.setHasFixedSize(true); RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), null); recyclerView.addItemDecoration(itemDecoration); progLoading = (ProgressBar) root.findViewById(R.id.progLoading); if (!itemsLoaded) { progLoading.setVisibility(View.VISIBLE); } viewsCreated = true; if (itemsLoaded && activity.get() != null) { onFragmentLoaded(); } return root; }
Source:
<code>public void shouldHandleRemoveNodeFromExplicitIndexTwice() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { <START> IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, "this is it" ); <END> assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }</code><technical_language>Magic string, static</technical_language>

Target:
public void shouldHandleRemoveNodeFromExplicitIndexTwice() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, VALUE ); assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }
Source:
<code>public BulkStatus getStatus(UUID bulkOperationId) { String commandAsString = ""; <START> try { <END> BulkStatus status = new BulkStatus(); status.setUUID(bulkOperationId); String state = kvStore.getString(bulkOperationId + STATE); status.setState(State.valueOf(state)); String creationDate = kvStore.getString(bulkOperationId + CREATION_DATE); status.setCreationDate(ZonedDateTime.parse(creationDate)); commandAsString = kvStore.getString(bulkOperationId + COMMAND); BulkCommand command = OBJECT_MAPPER.readValue(commandAsString, BulkCommand.class); status.setCommand(command); Long scrolledDocumentCount = kvStore.getLong(bulkOperationId + SCROLLED_DOCUMENT_COUNT); status.setScrolledDocumentCount(scrolledDocumentCount); return status; } catch (IOException e) { throw new NuxeoException("Unable to deserialize the bulk command=" + commandAsString, e); } }</code><technical_language>Yuck... If want in error message nested try</technical_language>

Target:
public BulkStatus getStatus(UUID bulkOperationId) { String commandAsString = ""; try { BulkStatus status = new BulkStatus(); status.setUUID(bulkOperationId); KeyValueStore keyValueStore = getKvStore(); String state = keyValueStore.getString(bulkOperationId + STATE); status.setState(State.valueOf(state)); String creationDate = keyValueStore.getString(bulkOperationId + CREATION_DATE); status.setCreationDate(ZonedDateTime.parse(creationDate)); commandAsString = keyValueStore.getString(bulkOperationId + COMMAND); BulkCommand command = OBJECT_MAPPER.readValue(commandAsString, BulkCommand.class); status.setCommand(command); Long scrolledDocumentCount = keyValueStore.getLong(bulkOperationId + SCROLLED_DOCUMENT_COUNT); status.setScrolledDocumentCount(scrolledDocumentCount); return status; } catch (IOException e) { throw new NuxeoException("Unable to deserialize the bulk command=" + commandAsString, e); } }
Source:
<code>private String makeUrl(ContainerPort port, ServerConfig cfg, String hostname) throws InternalInfrastructureException { LOG.debug( <START> "ContainerPort: " <END> + port.toString() + "\n ServerConfig: " + cfg.toString() + "\n Hostname: " + hostname); LOG.debug("URL result: \t" + makeUrl(port, cfg.getProtocol(), cfg.getPath(), hostname)); return makeUrl(port, cfg.getProtocol(), cfg.getPath(), hostname); }</code><technical_language>variables instead if string concatenating</technical_language>

Target:
private String makeUrl(ContainerPort port, ServerConfig cfg, String hostname) throws InternalInfrastructureException { LOG.debug( "ContainerPort: {}\n ServerConfig: {}\n Hostname: {}", port.toString(), cfg.toString(), hostname); return makeUrl(port, cfg.getProtocol(), cfg.getPath(), hostname); }
Source:
<code>public boolean isAdapter(final SAMRecord record) { if (!record.getReadUnmappedFlag() && record.getMappingQuality() != 0) { return false; } final byte[] readBases = record.getReadBases(); final boolean revComp = !record.getReadUnmappedFlag() && record.getMappingQuality() == 0 && record.getReadNegativeStrandFlag(); if (!(record instanceof BAMRecord)) { <START> StringUtil.toUpperCase(readBases); <END> } return isAdapterSequence(readBases, revComp); }</code><technical_language>This modifies data record (vs modifying a local copy of data). Is want do here? unsafe modify data in another object, especially a side effect of calling isAdapter()</technical_language>

Target:
public boolean isAdapter(final SAMRecord record) { if (!record.getReadUnmappedFlag() && record.getMappingQuality() != 0) { return false; } final boolean revComp = !record.getReadUnmappedFlag() && record.getReadNegativeStrandFlag(); final byte[] readBases = record.getReadBases(); return isAdapterSequence(readBases, revComp); }
Source:
<code>public static File ensureDirectoryWriteable(File logDir) throws IOException { FileUtils.forceMkdir(logDir); if(!logDir.canWrite()) { <START> log.warn("Init param log dir cannot be used!"); <END> logDir = null; } return logDir; }</code><technical_language>This exception, a message identifies problem directory issue. A java.security.AccessControlException good for this. throw new AccessControlException("No write permission directory "+logDir.getCanonicalPath());</technical_language>

Target:
public static File ensureDirectoryWriteable(File logDir) throws FileNotFoundException { try { FileUtils.forceMkdir(logDir); } catch(IOException e){ log.debug("Failed to create directory " + logDir, e); throw new FileNotFoundException("Failed to create directory: " + logDir + " IOException: " + e.getMessage()); } if(!logDir.canWrite()) { log.debug("Init param log dir cannot be used!"); throw new FileNotFoundException("Directory is not writable: " + logDir); } return logDir; }
Source:
<code>public MessageHandler mockHandler() { return mockMessageHandler(hasHeader("bar", "BAR")) .thenReply() <START> .assertNext(hasHeader("baz", "BAZ")) <END> .thenReply() .assertNext(hasPayload("foo")) .thenReply("foo"); }</code><technical_language>expressed this chain more readable. Thank you</technical_language>

Target:
public MessageHandler mockHandler() { return mockMessageHandler(messageArgumentCaptor()) .handleNextAndReply(m -> m) .handleNextAndReply(m -> m) .handleNextAndReply(m -> "foo"); }
Source:
<code><START> default <T> T getClaim(String claim) { <END> return (T) this.getClaims().get(claim); }</code><technical_language>Please move this method getClaims()</technical_language>

Target:
default <T> T getClaim(String claim) { return !containsClaim(claim) ? null : (T) this.getClaims().get(claim); }