auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void stomp(EntityDamageEvent fallDamageEvent) { Player p = (Player) fallDamageEvent.getEntity(); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 2F); p.setVelocity(new Vector(0, 0.7, 0)); for (Entity n : p.getNearbyEntities(4, 4, 4)) { <START> if (n instanceof LivingEntity && n.isValid() && !n.getUniqueId().equals(p.getUniqueId()) && ((LivingEntity) n).isCollidable() && n.hasGravity() ) { <END> Vector velocity = getShockwave(p.getLocation(), n.getLocation()); n.setVelocity(velocity); if (!(n instanceof Player) || (p.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(p, n.getLocation(), ProtectableAction.ATTACK_PLAYER))) { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(p, n, DamageCause.ENTITY_ATTACK, fallDamageEvent.getDamage() / 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { ((LivingEntity) n).damage(event.getDamage()); } } } } for (BlockFace face : BlockFace.values()) { Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN).getRelative(face); p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType()); } }</code><technical_language>I this unholy abomination of new lines justifies dedicated method</technical_language>

Target:
public void stomp(EntityDamageEvent fallDamageEvent) { Player player = (Player) fallDamageEvent.getEntity(); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 2F); player.setVelocity(new Vector(0, 0.7, 0)); for (Entity entity : player.getNearbyEntities(4, 4, 4)) { if (entity instanceof LivingEntity && canPush(player, (LivingEntity) entity)) { Vector velocity = getShockwave(player.getLocation(), entity.getLocation()); entity.setVelocity(velocity); if (!(entity instanceof Player) || (player.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(player, entity.getLocation(), ProtectableAction.ATTACK_PLAYER))) { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(player, entity, DamageCause.ENTITY_ATTACK, fallDamageEvent.getDamage() / 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { ((LivingEntity) entity).damage(event.getDamage()); } } } } for (BlockFace face : BlockFace.values()) { Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getRelative(face); player.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); } }
Source:
<code><START> public void initialize(File configurationDirectory) { <END> try { googleConfig = parseConfigFromClasspath("google.conf"); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>This method check folder for a file override internal defaults</technical_language>

Target:
public void initialize(File configurationDirectory) { try { googleConfig = parseConfigFromClasspath(GOOGLE_CONFIG_FILENAME); } catch (Exception e) { throw new RuntimeException(e); } File configFile = new File(configurationDirectory, GOOGLE_CONFIG_FILENAME); if (configFile.canRead()) { try { Config configFromFile = parseConfigFromFile(configFile); googleConfig = configFromFile.withFallback(googleConfig); } catch (Exception e) { throw new RuntimeException(e); } } }
Source:
<code>public void delete(ComplexEventChunk<StateEvent> deletingEventChunk, Object storeEvents) { SnapshotableStreamEventQueue storeEventQueue = (SnapshotableStreamEventQueue) storeEvents; deletingEventChunk.reset(); while (deletingEventChunk.hasNext()) { StateEvent deletingEvent = deletingEventChunk.next(); try { storeEventQueue.reset(); while (storeEventQueue.hasNext()) { StreamEvent storeEvent = storeEventQueue.next(); deletingEvent.setEvent(storeEventPosition, storeEvent); if ((Boolean) expressionExecutor.execute(deletingEvent)) { storeEventQueue.remove(); <START> storeEventQueue.reduceSizeByOne(); <END> } } } finally { deletingEvent.setEvent(storeEventPosition, null); } } }</code><technical_language>Move this storeEventQueue.remove();</technical_language>

Target:
public void delete(ComplexEventChunk<StateEvent> deletingEventChunk, Object storeEvents) { SnapshotableStreamEventQueue storeEventQueue = (SnapshotableStreamEventQueue) storeEvents; deletingEventChunk.reset(); while (deletingEventChunk.hasNext()) { StateEvent deletingEvent = deletingEventChunk.next(); try { storeEventQueue.reset(); while (storeEventQueue.hasNext()) { StreamEvent storeEvent = storeEventQueue.next(); deletingEvent.setEvent(storeEventPosition, storeEvent); if ((Boolean) expressionExecutor.execute(deletingEvent)) { storeEventQueue.remove(); } } } finally { deletingEvent.setEvent(storeEventPosition, null); } } }
Source:
<code><START> static public Record of(String key, byte[] data) { <END> return new Record(key, data, 0, DEFAULT_FLAG); }</code><technical_language>Correct keyword order</technical_language>

Target:
public static Record of(String key, byte[] data) { return new Record(key, data, 0, DEFAULT_FLAG); }
Source:
<code>private void copyPackThroughCache(PackOutputStream out, DfsReader ctx, ReadableChannel rc) throws IOException { long position = 12; long remaining = length - (12 + 20); boolean miss = false; while (0 < remaining) { DfsBlock b; if (miss) { <START> b = cache.getOrLoad(this, position, ctx, () -> rc); <END> } else { b = cache.get(key, alignToBlock(position)); if (b == null) { miss = true; b = cache.getOrLoad(this, position, ctx, () -> rc); } } int ptr = (int) (position - b.start); int n = (int) Math.min(b.size() - ptr, remaining); b.write(out, position, n); position += n; remaining -= n; } }</code><technical_language>rc is open channel, avoid this complexity 'miss' do DfsBlock b = cache.getOrLoad(this, position, ctx, () -> rc); ? In other words, I code avoid open file block is in cache. Also, if blocks in cache, able avoid opening file; can't. that</technical_language>

Target:
private void copyPackThroughCache(PackOutputStream out, DfsReader ctx, ReadableChannel rc) throws IOException { long position = 12; long remaining = length - (12 + 20); while (0 < remaining) { DfsBlock b = cache.getOrLoad(this, position, ctx, () -> rc); int ptr = (int) (position - b.start); int n = (int) Math.min(b.size() - ptr, remaining); b.write(out, position, n); position += n; remaining -= n; } }
Source:
<code>public String toString() { <START> return "Integration bus of BoundedContext ID = " + boundedContextId.getValue(); <END> }</code><technical_language>Please capitalize Bus</technical_language>

Target:
public String toString() { return "Integration Bus of BoundedContext Name = " + boundedContextName.getValue(); }
Source:
<code>private void updateAlarm(String reductionKey, OnmsAlarm alarm) { <START> if (suppressIncrementalAlarms && isIncrementalAlarm(reductionKey, alarm)) { <END> suppressedAlarm.countDown(); return; } if (alarm == null) { sendRecord(() -> { LOG.debug("Deleting alarm with reduction key: {}", reductionKey); return new ProducerRecord<>(alarmTopic, reductionKey, null); }, recordMetadata -> { forwardedAlarm.countDown(); }); return; } if (!shouldForwardAlarm(alarm)) { return; } if (forwardNodes && alarm.getNodeId() != null) { maybeUpdateNode(alarm.getNodeId()); } sendRecord(() -> { final OpennmsModelProtos.Alarm mappedAlarm = protobufMapper.toAlarm(alarm).build(); LOG.debug("Sending alarm with reduction key: {}", reductionKey); if (suppressIncrementalAlarms) { recordIncrementalAlarm(reductionKey, alarm); } return new ProducerRecord<>(alarmTopic, reductionKey, mappedAlarm.toByteArray()); }, recordMetadata -> { forwardedAlarm.countDown(); }); }</code><technical_language>alarm null here. defer this check filtering call shouldForwardAlarm</technical_language>

Target:
private void updateAlarm(String reductionKey, OnmsAlarm alarm) { if (alarm == null) { outstandingAlarms.remove(reductionKey); sendRecord(() -> { LOG.debug("Deleting alarm with reduction key: {}", reductionKey); return new ProducerRecord<>(alarmTopic, reductionKey, null); }, recordMetadata -> { forwardedAlarm.countDown(); }); return; } if (!shouldForwardAlarm(alarm)) { return; } if (suppressIncrementalAlarms && isIncrementalAlarm(reductionKey, alarm)) { return; } if (forwardNodes && alarm.getNodeId() != null) { maybeUpdateNode(alarm.getNodeId()); } sendRecord(() -> { final OpennmsModelProtos.Alarm mappedAlarm = protobufMapper.toAlarm(alarm).build(); LOG.debug("Sending alarm with reduction key: {}", reductionKey); if (suppressIncrementalAlarms) { recordIncrementalAlarm(reductionKey, alarm); } return new ProducerRecord<>(alarmTopic, reductionKey, mappedAlarm.toByteArray()); }, recordMetadata -> { forwardedAlarm.countDown(); }); }
Source:
<code>public void writeUserData(UserData userData) throws IOException { <START> getLock(); <END> if (!deviceFile.exists()) { deviceFile.createNewFile(); } HashMap deviceVariableMap = readMapFromJson(); if (deviceVariableMap == null) { deviceVariableMap = new HashMap<>(); } deviceVariableMap.put(userData.getDeviceKey(), userData.getValue()); writeMapToJson(deviceVariableMap); }</code><technical_language>missed synchronized keyword here. calling method lock -> synchronized keyword in Java allows thread execute statements synchronizes. if put keyword in front of a method as: synchronized void someMethod() method invoked object simultaneously. meaning for object of class thread call it. alternatively keyword a code block, as: sychronized(someObject) { doStuffHere } note in this version object synchronize -> e.g. object this, other object. a static object means block is synchronized objects of class (this is want do here, I guess)</technical_language>

Target:
public void writeUserData(UserData userData) throws IOException { synchronized (getLock()) { if (!deviceFile.exists() && !deviceFile.createNewFile()) { throw new IOException("Cannot create " + deviceFile.getAbsolutePath()); } Map deviceVariableMap = readMapFromJson(); if (deviceVariableMap == null) { deviceVariableMap = new HashMap<>(); } deviceVariableMap.put(userData.getDeviceKey(), userData.getValue()); writeMapToJson(deviceVariableMap); } }
Source:
<code><START> private void setCacheHeaders(boolean isPrivate, RestResponseChannel restResponseChannel) throws RestServiceException { <END> if (isPrivate) { restResponseChannel.setHeader(RestUtils.Headers.EXPIRES, new Date(0)); restResponseChannel.setHeader(RestUtils.Headers.CACHE_CONTROL, "private, no-cache, no-store, proxy-revalidate"); restResponseChannel.setHeader(RestUtils.Headers.PRAGMA, "no-cache"); } else { restResponseChannel.setHeader(RestUtils.Headers.EXPIRES, new Date(System.currentTimeMillis() + frontendConfig.frontendCacheValiditySeconds * Time.MsPerSec)); restResponseChannel.setHeader(RestUtils.Headers.CACHE_CONTROL, "max-age=" + frontendConfig.frontendCacheValiditySeconds); } }</code><technical_language>Cache headers set for sub-resources, right</technical_language>

Target:
private void setCacheHeaders(boolean isPrivate, RestResponseChannel restResponseChannel) throws RestServiceException { if (isPrivate) { restResponseChannel.setHeader(RestUtils.Headers.EXPIRES, restResponseChannel.getHeader(RestUtils.Headers.DATE)); restResponseChannel.setHeader(RestUtils.Headers.CACHE_CONTROL, "private, no-cache, no-store, proxy-revalidate"); restResponseChannel.setHeader(RestUtils.Headers.PRAGMA, "no-cache"); } else { restResponseChannel.setHeader(RestUtils.Headers.EXPIRES, new Date(System.currentTimeMillis() + frontendConfig.frontendCacheValiditySeconds * Time.MsPerSec)); restResponseChannel.setHeader(RestUtils.Headers.CACHE_CONTROL, "max-age=" + frontendConfig.frontendCacheValiditySeconds); } }
Source:
<code><START> public void copy( String fromFileSystem, String fromPath, String toFileSystem, String toPath ) <END> { PathMap pathMap = getPathMap( fromFileSystem, fromPath ); if ( pathMap == null ) { logger.warn( "Source not found, {}:{}", fromFileSystem, fromPath ); return; } PathMap target = getPathMap( toFileSystem, toPath ); if ( target != null ) { logger.info( "Target already exists, delete it. {}:{}", toFileSystem, toPath ); delete( toFileSystem, toPath ); } String fromParentPath = getParentPath( fromPath ); String toParentPath = getParentPath( toPath ); if ( !fromParentPath.equals( toParentPath ) ) { makeDirs( toFileSystem, toParentPath ); } String toFilename = getFilename( toPath ); pathMapMapper.save( new DtxPathMap( toFileSystem, toParentPath, toFilename, pathMap.getFileId(), pathMap.getCreation(), pathMap.getSize(), pathMap.getFileStorage() ) ); }</code><technical_language>thinking if copy method return boolean if is a successful copy</technical_language>

Target:
public boolean copy( String fromFileSystem, String fromPath, String toFileSystem, String toPath ) { PathMap pathMap = getPathMap( fromFileSystem, fromPath ); if ( pathMap == null ) { logger.warn( "Source not found, {}:{}", fromFileSystem, fromPath ); return false; } PathMap target = getPathMap( toFileSystem, toPath ); if ( target != null ) { logger.info( "Target already exists, delete it. {}:{}", toFileSystem, toPath ); delete( toFileSystem, toPath ); } String fromParentPath = getParentPath( fromPath ); String toParentPath = getParentPath( toPath ); if ( !fromParentPath.equals( toParentPath ) ) { makeDirs( toFileSystem, toParentPath ); } String toFilename = getFilename( toPath ); pathMapMapper.save( new DtxPathMap( toFileSystem, toParentPath, toFilename, pathMap.getFileId(), pathMap.getCreation(), pathMap.getSize(), pathMap.getFileStorage() ) ); return true; }
Source:
<code><START> public Rectangle getHeaderBounds() { <END> return syncExec(new Result<Rectangle>() { public Rectangle run() { Point location = parent.getParent().toDisplay(parent.getLocation()); Rectangle bounds = new Rectangle(location.x, location.y, widget.getWidth(), parent.getHeaderHeight()); for (int i : parent.getColumnOrder()) { TableColumn column = parent.getColumns()[i]; if (column.equals(widget)) { break; } else { bounds.x += column.getWidth(); } } return bounds; } }); }</code><technical_language>this need public</technical_language>

Target:
private Rectangle getHeaderBounds() { return syncExec(new Result<Rectangle>() { public Rectangle run() { Point location = parent.getParent().toDisplay(parent.getLocation()); Rectangle bounds = new Rectangle(location.x, location.y, widget.getWidth(), parent.getHeaderHeight()); for (int i : parent.getColumnOrder()) { TableColumn column = parent.getColumn(i); if (column.equals(widget)) { break; } else { bounds.x += column.getWidth(); } } return bounds; } }); }
Source:
<code>private RowFilter adaptBinaryComparator( CompareOp compareOp, BinaryComparator comparator) throws IOException { ByteString value = ByteString.copyFrom(comparator.getValue()); switch (compareOp) { case LESS: return RowFilter.newBuilder() .setValueRangeFilter( <START> ValueRange.newBuilder() <END> .setEndValueExclusive(value)) .build(); case LESS_OR_EQUAL: return RowFilter.newBuilder() .setValueRangeFilter( ValueRange.newBuilder() .setEndValueInclusive(value)) .build(); case EQUAL: return RowFilter.newBuilder() .setValueRegexFilter(value) .build(); case NOT_EQUAL: return RowFilter.newBuilder() .setInterleave( Interleave.newBuilder() .addFilters( RowFilter.newBuilder() .setValueRangeFilter( ValueRange.newBuilder() .setEndValueExclusive(value))) .addFilters( RowFilter.newBuilder() .setValueRangeFilter( ValueRange.newBuilder() .setStartValueExclusive(value)))) .build(); case GREATER_OR_EQUAL: return RowFilter.newBuilder() .setValueRangeFilter( ValueRange.newBuilder() .setStartValueInclusive(value)) .build(); case GREATER: return RowFilter.newBuilder() .setValueRangeFilter( ValueRange.newBuilder() .setStartValueExclusive(value)) .build(); case NO_OP: return FilterAdapterHelper.ACCEPT_ALL_FILTER; default: throw new IllegalStateException( String.format("Cannot handle unknown compare op %s", compareOp)); } }</code><technical_language>writeQuotedRegularExpression() is escape special characters. I this is needed now. Notice writeQuotedRegularExpression() is in other places too. If this is a problem, need remove together</technical_language>

Target:
private RowFilter adaptBinaryComparator( CompareOp compareOp, BinaryComparator comparator) throws IOException { ByteString value = ByteString.copyFrom(comparator.getValue()); switch (compareOp) { case LESS: return createRowFilter(ValueRange.newBuilder().setEndValueExclusive(value)); case LESS_OR_EQUAL: return createRowFilter(ValueRange.newBuilder().setEndValueInclusive(value)); case EQUAL: byte[] quotedBytes = ReaderExpressionHelper.quoteRegularExpression(comparator.getValue()); return RowFilter.newBuilder() .setValueRegexFilter(ByteString.copyFrom(quotedBytes)) .build(); case NOT_EQUAL: return RowFilter.newBuilder() .setInterleave( Interleave.newBuilder() .addFilters( createRowFilter(ValueRange.newBuilder().setEndValueExclusive(value))) .addFilters( createRowFilter(ValueRange.newBuilder().setStartValueExclusive(value)))) .build(); case GREATER_OR_EQUAL: return createRowFilter(ValueRange.newBuilder().setStartValueInclusive(value)); case GREATER: return createRowFilter(ValueRange.newBuilder().setStartValueExclusive(value)); case NO_OP: return FilterAdapterHelper.ACCEPT_ALL_FILTER; default: throw new IllegalStateException( String.format("Cannot handle unknown compare op %s", compareOp)); } }
Source:
<code>protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes, SendCallback sendCallback) { _producer.send(datastreamProducerRecord, ((metadata, exception) -> { if (exception != null) { String msg = String.format("Detected exception being thrown from send callback for source topic-partition: %s " + "with metadata: %s, exception: ", srcTopicPartition, metadata); _logger.warn(msg, exception); synchronized (_sendFailureTopicPartitionExceptionMap) { <START> _sendFailureTopicPartitionExceptionMap.put(srcTopicPartition, exception); <END> } } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } if (sendCallback != null) { sendCallback.onCompletion(metadata, exception); } })); }</code><technical_language>extract this out another function reuse connectorTasks</technical_language>

Target:
protected void sendDatastreamProducerRecord(DatastreamProducerRecord datastreamProducerRecord, TopicPartition srcTopicPartition, int numBytes, SendCallback sendCallback) { _producer.send(datastreamProducerRecord, ((metadata, exception) -> { if (exception != null) { String msg = String.format("Detected exception being thrown from send callback for source topic-partition: %s " + "with metadata: %s, exception: ", srcTopicPartition, metadata); _logger.warn(msg, exception); updateSendFailureTopicPartitionExceptionMap(srcTopicPartition, exception); } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } if (sendCallback != null) { sendCallback.onCompletion(metadata, exception); } })); }
Source:
<code>public TouchAction swipe(int startX, int startY, int endX, int endY, int duration) { int xOffset = endX - startX; <START> int yOffset = endY - startX; <END> return press(startX, startY).waitAction(duration).moveTo(xOffset, yOffset).release(); }</code><technical_language>is bug</technical_language>

Target:
public TouchAction swipe(int startX, int startY, int endX, int endY, int duration) { int xOffset = endX - startX; int yOffset = endY - startY; return press(startX, startY).waitAction(duration).moveTo(xOffset, yOffset).release(); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest)request; HttpServletResponse res = (HttpServletResponse)response; if (!FiltersHelper.isAuthenticated(req)) { List<String> schemes = (List<String>) req.getAttribute(FiltersHelper.Constants.REQUEST_SCHEMES_KEY); if (schemes == null) { schemes = Collections.emptyList(); } Set<String> allSchemes = new HashSet<String>(schemes); if (additionalSchemes != null) { allSchemes.addAll(Arrays.asList(additionalSchemes.split(","))); } for (String scheme: allSchemes) { <START> if (scheme.equals("Basic")) { <END> scheme = "Basic realm=\"ENGINE\""; } res.setHeader("WWW-Authenticate", scheme); } res.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { chain.doFilter(request, response); } }</code><technical_language>get entire string init parameter append</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest)request; HttpServletResponse res = (HttpServletResponse)response; if (!FiltersHelper.isAuthenticated(req)) { List<String> schemes = (List<String>) req.getAttribute(FiltersHelper.Constants.REQUEST_SCHEMES_KEY); if (schemes == null) { schemes = Collections.emptyList(); } Set<String> allSchemes = new HashSet<String>(schemes); if (additionalSchemes != null) { allSchemes.addAll(additionalSchemes); } for (String scheme: allSchemes) { if (scheme.equals("Basic")) { if (realmInfo != null) { scheme += realmInfo; } } res.setHeader("WWW-Authenticate", scheme); } res.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { chain.doFilter(request, response); } }
Source:
<code>public void testAsserts() { <START> JmhRunner.runAndReport(CLASSES, 0, 1, 1, 1, VerboseMode.SILENT, Assertions.Enable); END> }</code><technical_language>Off-topic: I aware Scalaz fails in case. Do why</technical_language>

Target:
public void testAsserts() { JmhRunner.runDebugWithAsserts(CLASSES); }
Source:
<code>public void testGetAndRollSecrets() throws Exception { long rolloverFrequency = 5 * 1000; byte[] secret1 = "doctor".getBytes(); byte[] secret2 = "who".getBytes(); byte[] secret3 = "tardis".getBytes(); TRolloverSignerSecretProvider secretProvider = new TRolloverSignerSecretProvider( new byte[][]{secret1, secret2, secret3}); try { secretProvider.init(null, null, rolloverFrequency); byte[] currentSecret = secretProvider.getCurrentSecret(); byte[][] allSecrets = secretProvider.getAllSecrets(); Assert.assertArrayEquals(secret1, currentSecret); Assert.assertEquals(2, allSecrets.length); Assert.assertArrayEquals(secret1, allSecrets[0]); Assert.assertNull(allSecrets[1]); Thread.sleep(rolloverFrequency + 2000); currentSecret = secretProvider.getCurrentSecret(); allSecrets = secretProvider.getAllSecrets(); Assert.assertArrayEquals(secret2, currentSecret); Assert.assertEquals(2, allSecrets.length); Assert.assertArrayEquals(secret2, allSecrets[0]); Assert.assertArrayEquals(secret1, allSecrets[1]); Thread.sleep(rolloverFrequency + 2000); currentSecret = secretProvider.getCurrentSecret(); allSecrets = secretProvider.getAllSecrets(); Assert.assertArrayEquals(secret3, currentSecret); Assert.assertEquals(2, allSecrets.length); Assert.assertArrayEquals(secret3, allSecrets[0]); Assert.assertArrayEquals(secret2, allSecrets[1]); <START> } finally { <END> secretProvider.destroy(); } }</code><technical_language>improve this, do this test a more controlled wairFor, etc</technical_language>

Target:
public void testGetAndRollSecrets() throws Exception { byte[] secret1 = "doctor".getBytes(); byte[] secret2 = "who".getBytes(); byte[] secret3 = "tardis".getBytes(); TRolloverSignerSecretProvider secretProvider = new TRolloverSignerSecretProvider( new byte[][]{secret1, secret2, secret3}); try { secretProvider.init(null, null, TimeUnit.SECONDS.toMillis(2)); byte[] currentSecret = secretProvider.getCurrentSecret(); byte[][] allSecrets = secretProvider.getAllSecrets(); Assert.assertArrayEquals(secret1, currentSecret); Assert.assertEquals(2, allSecrets.length); Assert.assertArrayEquals(secret1, allSecrets[0]); Assert.assertNull(allSecrets[1]); secretProvider.waitUntilNewSecret(); currentSecret = secretProvider.getCurrentSecret(); allSecrets = secretProvider.getAllSecrets(); Assert.assertArrayEquals(secret2, currentSecret); Assert.assertEquals(2, allSecrets.length); Assert.assertArrayEquals(secret2, allSecrets[0]); Assert.assertArrayEquals(secret1, allSecrets[1]); secretProvider.waitUntilNewSecret(); currentSecret = secretProvider.getCurrentSecret(); allSecrets = secretProvider.getAllSecrets(); Assert.assertArrayEquals(secret3, currentSecret); Assert.assertEquals(2, allSecrets.length); Assert.assertArrayEquals(secret3, allSecrets[0]); Assert.assertArrayEquals(secret2, allSecrets[1]); } finally { secretProvider.destroy(); } }
Source:
<code><START> public List<StandardPreset> getAllStandardPresets() throws MiddlewareQueryException { <END> return this.workbenchDataManager.getStandardPresetDAO().getAll(); }</code><technical_language>Remove throws MiddlewareQueryException</technical_language>

Target:
public List<StandardPreset> getAllStandardPresets() { return this.workbenchDataManager.getStandardPresetDAO().getAll(); }
Source:
<code>public GeometryWithPosition(OGCGeometry ogcGeometry, int partition, int position) { <START> this.ogcGeometry = ogcGeometry; <END> this.partition = partition; this.position = position; }</code><technical_language>check for null</technical_language>

Target:
public GeometryWithPosition(OGCGeometry ogcGeometry, int partition, int position) { this.ogcGeometry = requireNonNull(ogcGeometry, "ogcGeometry is null"); this.partition = partition; this.position = position; }
Source:
<code>public void onStreamCreate(IMediaStream stream) { <START> if (!stream.isTranscodeResult()) { <END> PacketListener listener = new PacketListener(); WMSProperties props = stream.getProperties(); synchronized (props) { props.setProperty(STREAM_ACTION_LISTENER_PROPERTY, listener); } stream.addLivePacketListener(listener); } }</code><technical_language>do return</technical_language>

Target:
public void onStreamCreate(IMediaStream stream) { if (stream.isTranscodeResult()) { return; } PacketListener listener = new PacketListener(); WMSProperties props = stream.getProperties(); synchronized (props) { props.setProperty(STREAM_ACTION_LISTENER_PROPERTY, listener); } stream.addLivePacketListener(listener); }
Source:
<code>public LanternaTerminalWriter(String[] args) throws IOException { screen = new TestTerminalFactory(args).createScreen(); screen.startScreen(); MultiWindowTextGUI gui = new MultiWindowTextGUI(screen, new DefaultWindowManager(), new EmptySpace(TextColor.ANSI.BLACK)); <START> gui.setTheme(SimpleTheme.makeTheme(true, TextColor.ANSI.WHITE, TextColor.ANSI.BLACK, TextColor.ANSI.WHITE, TextColor.ANSI.WHITE, TextColor.ANSI.WHITE, TextColor.ANSI.WHITE, TextColor.ANSI.WHITE)); <END> screenWriter = screen.newTextGraphics(); }</code><technical_language>Yes, a Testclass for is a good thing(TM) ;-) surprised test "no-SGR" case</technical_language>

Target:
public LanternaTerminalWriter(String[] args) throws IOException { screen = new TestTerminalFactory(args).createScreen(); screen.startScreen(); MultiWindowTextGUI gui = new MultiWindowTextGUI(screen, new DefaultWindowManager(), new EmptySpace(TextColor.ANSI.BLACK)); assertNotNull(new DefaultMutableThemeStyle(TextColor.ANSI.WHITE, TextColor.ANSI.BLACK, new SGR[] {})); screenWriter = screen.newTextGraphics(); }
Source:
<code>private void handleMulti(DoorsTableRow current, RowType rt) { switch (rt) { case SINGLE: stack.peek().setRowType(RowType.MULTI_END); stack.clear(); stack.push(current); break; case MULTI_START: current.setRowType(RowType.MULTI_MID); stack.push(current); break; case MULTI_MID: case MULTI_END: break; case FIRST_ROW: <START> break; <END> } }</code><technical_language>default</technical_language>

Target:
private void handleMulti(DoorsTableRow current, RowType rt) { switch (rt) { case SINGLE: stack.peek().setRowType(RowType.MULTI_END); stack.clear(); stack.push(current); break; case MULTI_START: current.setRowType(RowType.MULTI_MID); stack.push(current); break; case MULTI_MID: case MULTI_END: break; case FIRST_ROW: break; default: throw new OseeStateException("Unhandled enumeration", current); } }
Source:
<code>void execute() throws AzureBlobFileSystemException { int retryCount = 0; while (!executeHttpOperation(retryCount++)) { try { Thread.sleep(client.getRetryPolicy().getRetryInterval(retryCount)); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } if (result.getStatusCode() >= HttpURLConnection.HTTP_BAD_REQUEST) { throw new AbfsRestOperationException(result.getStatusCode(), result.getStorageErrorCode(), result.getStorageErrorMessage(), null, result); } <START> LOG.trace(operationType + " REST operation complete." ); <END> }</code><technical_language>{}</technical_language>

Target:
void execute() throws AzureBlobFileSystemException { String latencyHeader = this.client.getAbfsPerfTracker().getClientLatency(); if (latencyHeader != null && !latencyHeader.isEmpty()) { AbfsHttpHeader httpHeader = new AbfsHttpHeader(HttpHeaderConfigurations.X_MS_ABFS_CLIENT_LATENCY, latencyHeader); requestHeaders.add(httpHeader); } int retryCount = 0; LOG.debug("First execution of REST operation - {}", operationType); while (!executeHttpOperation(retryCount++)) { try { LOG.debug("Retrying REST operation {}. RetryCount = {}", operationType, retryCount); Thread.sleep(client.getRetryPolicy().getRetryInterval(retryCount)); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } if (result.getStatusCode() >= HttpURLConnection.HTTP_BAD_REQUEST) { throw new AbfsRestOperationException(result.getStatusCode(), result.getStorageErrorCode(), result.getStorageErrorMessage(), null, result); } LOG.trace("{} REST operation complete", operationType); }
Source:
<code>public double max() { double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { <START> if (get(i, j) > max) { <END> max = get(i, j); } } } return max; }</code><technical_language>do call get twice. expensive for sparse entries. this: java double = get(i, j); if (value > max) { max = value; }</technical_language>

Target:
public double max() { double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { double value = get(i, j); if (value > max) { max = value; } } } return max; }
Source:
<code>protected RexNode vInt(int arg) { assertArgValue(arg); <START> return rexBuilder.makeFieldAccess(getDynamicParam(nullableInt, "int"), arg); <END> }</code><technical_language>is this change</technical_language>

Target:
protected RexNode vInt(int arg) { assertArgValue(arg); return rexBuilder.makeFieldAccess(getDynamicParam(nonNullableInt, "int"), arg); }
Source:
<code>public long next() { <START> long result = (long) (random.nextGaussian() * standardDeviation + mean); <END> while (result < 0 || result >= numEntries) { result = (long) (random.nextGaussian() * standardDeviation + mean); } return result; }</code><technical_language>This a good fit for do-while cycle</technical_language>

Target:
public long next() { long result; do { result = (long) (random.nextGaussian() * standardDeviation + mean); } while (result < 0 || result >= numEntries); return result; }
Source:
<code>public byte[] getCacheKey() { byte[] dimensionBytes = StringUtils.toUtf8(dimension); byte[] valueBytes = (value == null) ? new byte[]{} : StringUtils.toUtf8(value); byte[] extractionFnBytes = extractionFn == null ? new byte[0] : extractionFn.getCacheKey(); <START> return ByteBuffer.allocate(5 + dimensionBytes.length + valueBytes.length + extractionFnBytes.length) <END> .put(DimFilterUtils.SELECTOR_CACHE_ID) .put(DimFilterUtils.STRING_SEPARATOR) .put(dimensionBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(value == null ? NullHandling.IS_NULL_BYTE : NullHandling.IS_NOT_NULL_BYTE) .put(valueBytes) .put(DimFilterUtils.STRING_SEPARATOR) .put(extractionFnBytes) .array(); }</code><technical_language>nit: CacheKeyBuilder here</technical_language>

Target:
public byte[] getCacheKey() { return new CacheKeyBuilder(DimFilterUtils.SELECTOR_CACHE_ID) .appendByte(DimFilterUtils.STRING_SEPARATOR) .appendString(dimension) .appendByte(DimFilterUtils.STRING_SEPARATOR) .appendByte(value == null ? NullHandling.IS_NULL_BYTE : NullHandling.IS_NOT_NULL_BYTE) .appendString(value) .appendByte(DimFilterUtils.STRING_SEPARATOR) .appendByteArray(extractionFn == null ? new byte[0] : extractionFn.getCacheKey()) .build(); }
Source:
<code>public boolean isDone() { <START> for (Future<RecordMetadata> future: futures) { if (!future.isDone()) { return false; } } return true; <END> }</code><technical_language>suggestion return futures.stream().allMatch(Future::isDone);</technical_language>

Target:
public boolean isDone() { return futures.stream().allMatch(Future::isDone); }
Source:
<code>public void onSubmit_shouldNotRescheduleAnExecutingTask() throws Exception { Date startTime = taskHelper.getTime(Calendar.SECOND, 1); TaskDefinition task = taskHelper.getScheduledTaskDefinition(startTime); taskHelper.waitUntilTaskIsExecuting(task, MAX_WAIT_TIME_IN_MILLISECONDS); Task oldTaskInstance = task.getTaskInstance(); mockRequest.setParameter("startTime", new SimpleDateFormat(DATE_TIME_FORMAT).format(startTime)); ModelAndView mav = controller.handleRequest(mockRequest, new MockHttpServletResponse()); assertNotNull(mav); assertTrue(mav.getModel().isEmpty()); Assert.assertSame(oldTaskInstance, task.getTaskInstance()); <START> super.deleteAllData(); <END> }</code><technical_language>I calling deleteAllData() enough super is overidden in this class</technical_language>

Target:
public void onSubmit_shouldNotRescheduleAnExecutingTask() throws Exception { Date startTime = taskHelper.getTime(Calendar.SECOND, 1); TaskDefinition task = taskHelper.getScheduledTaskDefinition(startTime); taskHelper.waitUntilTaskIsExecuting(task, MAX_WAIT_TIME_IN_MILLISECONDS); Task oldTaskInstance = task.getTaskInstance(); mockRequest.setParameter("startTime", new SimpleDateFormat(DATE_TIME_FORMAT).format(startTime)); ModelAndView mav = controller.handleRequest(mockRequest, new MockHttpServletResponse()); assertNotNull(mav); assertTrue(mav.getModel().isEmpty()); Assert.assertSame(oldTaskInstance, task.getTaskInstance()); deleteAllData(); }
Source:
<code>protected Builder addComputations(Builder builder, int size, int threshold) { return builder.addComputation(() -> new CSVProjection(size, threshold), <START> Arrays.asList("i1:" + ACTION_NAME, "o1:" + org.nuxeo.ecm.core.bulk.actions.computation.MakeBlob.NAME)) <END> .addComputation(MakeBlob::new, Arrays.asList("i1:" + org.nuxeo.ecm.core.bulk.actions.computation.MakeBlob.NAME, "o1:" + SortBlob.NAME)) .addComputation(SortBlob::new, Arrays.asList("i1:" + SortBlob.NAME, "o1:" + ZipBlob.NAME)) .addComputation(ZipBlob::new, Arrays.asList("i1:" + ZipBlob.NAME, "o1:" + ExposeBlob.NAME)) .addComputation(ExposeBlob::new, Arrays.asList("i1:" + ExposeBlob.NAME, "o1:" + STATUS_STREAM)); }</code><technical_language>need full qualified name</technical_language>

Target:
protected Builder addComputations(Builder builder, int size, int threshold) { return builder.addComputation(() -> new CSVProjection(size, threshold), Arrays.asList("i1:" + ACTION_NAME, "o1:" + MakeBlob.NAME)) .addComputation(MakeBlob::new, Arrays.asList("i1:" + MakeBlob.NAME, "o1:" + SortBlob.NAME)) .addComputation(SortBlob::new, Arrays.asList("i1:" + SortBlob.NAME, "o1:" + ZipBlob.NAME)) .addComputation(ZipBlob::new, Arrays.asList("i1:" + ZipBlob.NAME, "o1:" + ExposeBlob.NAME)) .addComputation(ExposeBlob::new, Arrays.asList("i1:" + ExposeBlob.NAME, "o1:" + STATUS_STREAM)); }
Source:
<code>private String getSpecVersion(CategoryBag categoryBag) { if (categoryBag != null && categoryBag.getKeyedReference() != null && !categoryBag.getKeyedReference().isEmpty()) { for (KeyedReference kRef : categoryBag.getKeyedReference()) { if (kRef.getTModelKey() != null && kRef.getTModelKey().equals(ConnectionManagerCache.UDDI_SPEC_VERSION_KEY)) { return kRef.getKeyValue(); } } } <START> return "-"; <END> }</code><technical_language>this "--" match others, is this a special case</technical_language>

Target:
private String getSpecVersion(CategoryBag categoryBag) { if (categoryBag != null && categoryBag.getKeyedReference() != null && !categoryBag.getKeyedReference().isEmpty()) { for (KeyedReference kRef : categoryBag.getKeyedReference()) { if (kRef.getTModelKey() != null && kRef.getTModelKey().equals(ConnectionManagerCache.UDDI_SPEC_VERSION_KEY)) { return kRef.getKeyValue(); } } } return NULL_DISPLAY; }
Source:
<code><START> private Collection<PTOperator> getUnifiersInCheckpointGroup(Collection<PTOperator> operators) <END> { Set<PTOperator> unifiers = Sets.newHashSet(); for (PTOperator op : operators) { for (PTOperator.PTOutput out : op.getOutputs()) { for (PTOperator.PTInput in : out.sinks) { PTOperator target = in.target; if (target.isUnifier()) { unifiers.add(target); } } } } return unifiers; }</code><technical_language>method static</technical_language>

Target:
private static Collection<PTOperator> getUnifiersInCheckpointGroup(Collection<PTOperator> operators) { Set<PTOperator> unifiers = Sets.newHashSet(); for (PTOperator op : operators) { for (PTOperator.PTOutput out : op.getOutputs()) { for (PTOperator.PTInput in : out.sinks) { PTOperator target = in.target; if (target.isUnifier()) { unifiers.add(target); } } } } return unifiers; }
Source:
<code>public UrlConnectionHttpClient(String userAgent, String acceptedMediaType, String version, ISSLCertificateCallback callback, Integer configTimeout, String excludedSSLCipherRegex, String alias, X509Certificate cert) { this.userAgent = userAgent; this.acceptedMediaType = acceptedMediaType; this.acceptedVersion = version; this.sslAuthorizationCallback = callback; this.configTimeout = configTimeout; this.excludedSSLCipherRegex = excludedSSLCipherRegex; <START> try { <END> trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); if (alias != null && cert != null) { KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(null, null); cert.checkValidity(); ks.setCertificateEntry(alias, cert); trustManagerFactory.init(ks); } else { trustManagerFactory.init((KeyStore)null); } } catch (NoSuchAlgorithmException e) { LOGGER.warn("Could not get trust manager factory.", e); trustManagerFactoryException = e; } catch (KeyStoreException e) { LOGGER.warn("Count not get key store.", e); } catch (CertificateException e) { LOGGER.warn("An invalid certificate was provided to this connection.", e); } catch (IOException e) { LOGGER.warn("An IO exception occurred while setting up a cert with the trust store.", e); } }</code><technical_language>I refactor this a separate method 'initTrustManagerFactory'</technical_language>

Target:
public UrlConnectionHttpClient(String userAgent, String acceptedMediaType, String version, ISSLCertificateCallback callback, Integer configTimeout, String excludedSSLCipherRegex, String alias, X509Certificate cert) { this.userAgent = userAgent; this.acceptedMediaType = acceptedMediaType; this.acceptedVersion = version; this.sslAuthorizationCallback = callback; this.configTimeout = configTimeout; this.excludedSSLCipherRegex = excludedSSLCipherRegex; this.initTrustManagerFactory(alias, cert); }
Source:
<code>public Response execute() { Response response; try (DatabaseAccessor db = initDB()) { FileTuple ft = db.getFileTuple(Integer.parseInt(fileID)); if (ft != null) response = new SingleFileResponse(db.getFileTuple(Integer. parseInt(fileID))); <START> else <END> response = new ErrorResponse(HttpStatusCode.BAD_REQUEST, "Retrieval of file with file id '" + fileID + "' unsuccessful, file does not exist"); } catch (NumberFormatException e) { response = new ErrorResponse(HttpStatusCode.BAD_REQUEST, "Retrieval of file with file id '" + fileID + "' unsuccessful, the file id may not contain any " + "characters except numbers."); } catch (SQLException e) { response = new DatabaseErrorResponse("Retrieval of file with " + "file id '" + fileID + "'"); Debug.log("Reason: " + e.getMessage()); } catch (IOException e) { response = new ErrorResponse(HttpStatusCode.BAD_REQUEST, "Retrieval of file with file id '" + fileID + "' unsuccessful. " + e.getMessage()); } return response; }</code><technical_language>need query database twice, do new SingleFileResponse(ft)</technical_language>

Target:
public Response execute() { Response response; try (DatabaseAccessor db = initDB()) { FileTuple ft = db.getFileTuple(Integer.parseInt(fileID)); if (ft != null) response = new SingleFileResponse(ft); else response = new ErrorResponse(HttpStatusCode.BAD_REQUEST, "Retrieval of file with file id '" + fileID + "' unsuccessful, file does not exist"); } catch (NumberFormatException e) { response = new ErrorResponse(HttpStatusCode.BAD_REQUEST, "Retrieval of file with file id '" + fileID + "' unsuccessful, the file id may not contain any " + "characters except numbers."); } catch (SQLException e) { response = new DatabaseErrorResponse("Retrieval of file with " + "file id '" + fileID + "'"); Debug.log("Reason: " + e.getMessage()); } catch (IOException e) { response = new ErrorResponse(HttpStatusCode.BAD_REQUEST, "Retrieval of file with file id '" + fileID + "' unsuccessful. " + e.getMessage()); } return response; }
Source:
<code>public Class<?> createExceptionClass(Class<?> bean) { String newClassName = bean.getName() + "_Exception"; try { return ClassLoaderUtils.loadClass(newClassName, ExceptionClassLoader.class); <START> } catch (ClassNotFoundException e) { <END> } return null; }</code><technical_language>log exception (debug trace), troubleshooting</technical_language>

Target:
public Class<?> createExceptionClass(Class<?> bean) { String newClassName = bean.getName() + "_Exception"; return findClass(newClassName, bean); }
Source:
<code>public int compareTo(CookieKey o) { int result; if (o != null) { if ((result = this.name.compareTo(o.name)) == 0) if ((result = this.domain.compareTo(o.domain)) == 0) result = this.path.compareTo(o.path); } else <START> throw new NullPointerException(); <END> return result; }</code><technical_language>Perform Assertions.assertNotNull early</technical_language>

Target:
public int compareTo(CookieKey o) { Assertions.assertNotNull(o, "Parameter can't be null"); int result; if ((result = this.name.compareTo(o.name)) == 0) if ((result = this.domain.compareTo(o.domain)) == 0) result = this.path.compareTo(o.path); return result; }
Source:
<code>public synchronized IObjectDescriptor[] getDependentObjects() { if (objectDescriptors == null) { objectDescriptors = descriptorCache.computeIfAbsent(location, l -> { IObjectDescriptor[] descriptors = <START> calcDependentObjects(); <END> return descriptors.length > 0 ? descriptors : EMPTY_DESCRIPTORS; }); } return objectDescriptors; }</code><technical_language>This is internal abstract class I assume other parts of code in this bundle implement for calcDependentObjects() method. for implementations return EMPTY array constant instead of catching here? concerned impls return null resulting in NPE before</technical_language>

Target:
public synchronized IObjectDescriptor[] getDependentObjects() { if (objectDescriptors == null) { objectDescriptors = descriptorCache.computeIfAbsent(location, l -> { IObjectDescriptor[] descriptors = calcDependentObjects(); return descriptors != null && descriptors.length > 0 ? descriptors : EMPTY_DESCRIPTORS; }); } return objectDescriptors; }
Source:
<code>public void ransomUnit(int i) { <START> TestUnit ransomUnit = potentialSalvage.get(i); <END> getRansomedSalvage().add(ransomUnit); }</code><technical_language>public include a check i</technical_language>

Target:
public void ransomUnit(int i) { if (i < getPotentialSalvage().size()) { TestUnit ransomUnit = getPotentialSalvage().get(i); getRansomedSalvage().add(ransomUnit); } }
Source:
<code>R call() throws TException; } private <R> R doWithRetry(ClientAction<R> action) throws TException { try { return action.call(); <START> } catch (TException e) { <END> try { client.reconnect(); } catch (MetaException swallowedException) { throw e; } return action.call(); } }</code><technical_language>Is logging worthwhile? good give some indication if connection is continuously failing</technical_language>

Target:
R call() throws TException; } private <R> R doWithRetry(ClientAction<R> action) throws TException { try { return action.call(); } catch (TException e) { try { client.reconnect(); } catch (MetaException swallowedException) { log.warn("Cannot connect to Hive meta store: {}", swallowedException.getMessage()); throw e; } return action.call(); } }
Source:
<code>public void testGetProjectedSchema5() throws Exception { MessageType originalMsg = MessageTypeParser.parseMessageType( "message hive_schema {\n" + " optional group structCol {\n" + " optional int32 a;\n" + " optional group subStructCol {\n" + " optional int64 b;\n" + " optional boolean c;\n" + " }\n" + " }\n" + " optional boolean d;\n" + "}\n"); testConversion("structCol", "struct<subStructCol:struct<b:bigint,c:boolean>>", DataWritableReadSupport .getProjectedSchema(originalMsg, Arrays.asList("structCol"), Arrays.asList(0), Arrays .asList("structCol.subStructCol", "structCol.subStructCol.b", <START> "structCol" + ".subStructCol.c")).toString()); <END> }</code><technical_language>need +</technical_language>

Target:
public void testGetProjectedSchema5() throws Exception { MessageType originalMsg = MessageTypeParser.parseMessageType( "message hive_schema {\n" + " optional group structCol {\n" + " optional int32 a;\n" + " optional group subStructCol {\n" + " optional int64 b;\n" + " optional boolean c;\n" + " }\n" + " }\n" + " optional boolean d;\n" + "}\n"); testConversion("structCol", "struct<subStructCol:struct<b:bigint,c:boolean>>", DataWritableReadSupport .getProjectedSchema(originalMsg, Arrays.asList("structCol"), Arrays.asList(0), Arrays .asList("structCol.subStructCol", "structCol.subStructCol.b", "structCol.subStructCol.c")).toString()); }
Source:
<code>public void testGetType() { <START> assertEquals(null, report1.getType("path/to/diff1", 20, StashDiffReport.VICINITY_RANGE_NONE)); <END> assertEquals(IssueType.ADDED, report1.getType("path/to/diff2", 30, StashDiffReport.VICINITY_RANGE_NONE)); assertEquals(null, report1.getType("path/to/diff2", 20, StashDiffReport.VICINITY_RANGE_NONE)); assertEquals(null, report1.getType("path/to/diff1", 30, StashDiffReport.VICINITY_RANGE_NONE)); assertEquals(null, report1.getType("path/to/diff4", 60, StashDiffReport.VICINITY_RANGE_NONE)); }</code><technical_language>True. assertNull() for null assertions</technical_language>

Target:
public void testGetType() { assertNull(report1.getType("path/to/diff1", 20, StashDiffReport.VICINITY_RANGE_NONE)); assertEquals(IssueType.ADDED, report1.getType("path/to/diff2", 30, StashDiffReport.VICINITY_RANGE_NONE)); assertNull(report1.getType("path/to/diff2", 20, StashDiffReport.VICINITY_RANGE_NONE)); assertNull(report1.getType("path/to/diff1", 30, StashDiffReport.VICINITY_RANGE_NONE)); assertNull(report1.getType("path/to/diff4", 60, StashDiffReport.VICINITY_RANGE_NONE)); }
Source:
<code>public void testLongAsStringOverflowDeserialization() { BigInteger large = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE); assertThatThrownBy(() -> MAPPER.readValue("\"" + large + "\"", Long.TYPE)) <START> .isInstanceOf(NumberFormatException.class); <END> }</code><technical_language>this a JsonParseException constricted deserialization context</technical_language>

Target:
public void testLongAsStringOverflowDeserialization() { BigInteger large = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE); assertThatThrownBy(() -> MAPPER.readValue("\"" + large + "\"", Long.TYPE)) .isInstanceOf(JsonParseException.class) .hasMessageContaining("not a valid long value"); }