auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); VDSReturnValue vdsReturnValue = null; try { vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); } catch (EngineException e) { log.error("Failed to delete image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get(), e); if (!getParameters().isLiveMerge()) { throw e; } } if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); log.info("Successfully started task to remove orphaned volumes resulting from live merge"); } else { log.info("Retrying deleting image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, new HashSet<>(getParameters().getImageList())); getReturnValue().setActionReturnValue(returnValue); ((RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters()). setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); } setSucceeded(true); setCommandStatus(CommandStatus.SUCCEEDED); }

Target:
protected void executeCommand() { getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupId())); VDSReturnValue vdsReturnValue = null; try { vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); } catch (EngineException e) { log.error("Failed to delete image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get(), e); if (!getParameters().isLiveMerge()) { throw e; } } if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Storage, getParameters().getStorageDomainId()); getTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); log.info("Successfully started task to remove orphaned volumes resulting from live merge"); } else if (ActionType.RemoveSnapshotSingleDisk == getParentParameters().getParentCommand()) { log.info("Retrying deleting image {}/{}", getParameters().getImageGroupId(), getParameters().getImageList().stream().findFirst().get()); MergeStatusReturnValue returnValue = new MergeStatusReturnValue(VmBlockJobType.COMMIT, new HashSet<>(getParameters().getImageList())); getReturnValue().setActionReturnValue(returnValue); ((RemoveSnapshotSingleDiskParameters) getParameters().getParentParameters()). setNextCommandStep(RemoveSnapshotSingleDiskStep.DESTROY_IMAGE); } setSucceeded(true); setCommandStatus(CommandStatus.SUCCEEDED); }
Source:
public void startNext() { changeNumber(1); resetTime(); start(); }

Target:
public void startNext() { requestBatchStart(); changeNumber(1); resetTime(); start(); requestBatchEnd(); }
Source:
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)) { if (n instanceof LivingEntity && n.isValid() && !n.getUniqueId().equals(p.getUniqueId()) && ((LivingEntity) n).isCollidable() && n.hasGravity() ) { 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()); } }

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:
public void initialize(File configurationDirectory) { try { googleConfig = parseConfigFromClasspath("google.conf"); } catch (Exception e) { throw new RuntimeException(e); } }

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:
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(); storeEventQueue.reduceSizeByOne(); } } } finally { deletingEvent.setEvent(storeEventPosition, null); } } }

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:
static public Record of(String key, byte[] data) { return new Record(key, data, 0, DEFAULT_FLAG); }

Target:
public static Record of(String key, byte[] data) { return new Record(key, data, 0, DEFAULT_FLAG); }
Source:
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) { b = cache.getOrLoad(this, position, ctx, () -> rc); } 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; } }

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:
public String toString() { return "Integration bus of BoundedContext ID = " + boundedContextId.getValue(); }

Target:
public String toString() { return "Integration Bus of BoundedContext Name = " + boundedContextName.getValue(); }
Source:
private void updateAlarm(String reductionKey, OnmsAlarm alarm) { if (suppressIncrementalAlarms && isIncrementalAlarm(reductionKey, alarm)) { 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(); }); }

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:
public void writeUserData(UserData userData) throws IOException { getLock(); if (!deviceFile.exists()) { deviceFile.createNewFile(); } HashMap deviceVariableMap = readMapFromJson(); if (deviceVariableMap == null) { deviceVariableMap = new HashMap<>(); } deviceVariableMap.put(userData.getDeviceKey(), userData.getValue()); writeMapToJson(deviceVariableMap); }

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:
private void setCacheHeaders(boolean isPrivate, RestResponseChannel restResponseChannel) throws RestServiceException { 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); } }

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:
public void 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; } 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() ) ); }

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:
public 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.getColumns()[i]; if (column.equals(widget)) { break; } else { bounds.x += column.getWidth(); } } return bounds; } }); }

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:
private RowFilter adaptBinaryComparator( CompareOp compareOp, BinaryComparator comparator) throws IOException { ByteString value = ByteString.copyFrom(comparator.getValue()); switch (compareOp) { case LESS: return RowFilter.newBuilder() .setValueRangeFilter( ValueRange.newBuilder() .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)); } }

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:
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) { _sendFailureTopicPartitionExceptionMap.put(srcTopicPartition, exception); } } else { _consumerMetrics.updateBytesProcessedRate(numBytes); } if (sendCallback != null) { sendCallback.onCompletion(metadata, exception); } })); }

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:
public TouchAction swipe(int startX, int startY, int endX, int endY, int duration) { int xOffset = endX - startX; int yOffset = endY - startX; return press(startX, startY).waitAction(duration).moveTo(xOffset, yOffset).release(); }

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:
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) { if (scheme.equals("Basic")) { scheme = "Basic realm=\"ENGINE\""; } res.setHeader("WWW-Authenticate", scheme); } res.sendError(HttpServletResponse.SC_UNAUTHORIZED); } else { chain.doFilter(request, response); } }

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:
public void testAsserts() { JmhRunner.runAndReport(CLASSES, 0, 1, 1, 1, VerboseMode.SILENT, Assertions.Enable); }

Target:
public void testAsserts() { JmhRunner.runDebugWithAsserts(CLASSES); }
Source:
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]); } finally { secretProvider.destroy(); } }

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:
public List<StandardPreset> getAllStandardPresets() throws MiddlewareQueryException { return this.workbenchDataManager.getStandardPresetDAO().getAll(); }

Target:
public List<StandardPreset> getAllStandardPresets() { return this.workbenchDataManager.getStandardPresetDAO().getAll(); }
Source:
public GeometryWithPosition(OGCGeometry ogcGeometry, int partition, int position) { this.ogcGeometry = ogcGeometry; this.partition = partition; this.position = position; }

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

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:
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)); 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)); screenWriter = screen.newTextGraphics(); }

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:
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; } }

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:
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); } LOG.trace(operationType + " REST operation complete." ); }

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:
public double max() { double max = Double.NEGATIVE_INFINITY; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { if (get(i, j) > max) { max = get(i, j); } } } return max; }

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:
protected RexNode vInt(int arg) { assertArgValue(arg); return rexBuilder.makeFieldAccess(getDynamicParam(nullableInt, "int"), arg); }

Target:
protected RexNode vInt(int arg) { assertArgValue(arg); return rexBuilder.makeFieldAccess(getDynamicParam(nonNullableInt, "int"), arg); }
Source:
public long next() { long result = (long) (random.nextGaussian() * standardDeviation + mean); while (result < 0 || result >= numEntries) { result = (long) (random.nextGaussian() * standardDeviation + mean); } return result; }

Target:
public long next() { long result; do { result = (long) (random.nextGaussian() * standardDeviation + mean); } while (result < 0 || result >= numEntries); return result; }
Source:
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(); return ByteBuffer.allocate(5 + dimensionBytes.length + valueBytes.length + extractionFnBytes.length) .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(); }

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:
public boolean isDone() { for (Future<RecordMetadata> future: futures) { if (!future.isDone()) { return false; } } return true; }

Target:
public boolean isDone() { return futures.stream().allMatch(Future::isDone); }
Source:
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()); super.deleteAllData(); }

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:
protected Builder addComputations(Builder builder, int size, int threshold) { return builder.addComputation(() -> new CSVProjection(size, threshold), Arrays.asList("i1:" + ACTION_NAME, "o1:" + org.nuxeo.ecm.core.bulk.actions.computation.MakeBlob.NAME)) .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)); }

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:
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 "-"; }

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:
private 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; }

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:
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; try { 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); } }

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:
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))); 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; }

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:
public Class<?> createExceptionClass(Class<?> bean) { String newClassName = bean.getName() + "_Exception"; try { return ClassLoaderUtils.loadClass(newClassName, ExceptionClassLoader.class); } catch (ClassNotFoundException e) { } return null; }

Target:
public Class<?> createExceptionClass(Class<?> bean) { String newClassName = bean.getName() + "_Exception"; return findClass(newClassName, bean); }
Source:
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 throw new NullPointerException(); return result; }

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:
public synchronized IObjectDescriptor[] getDependentObjects() { if (objectDescriptors == null) { objectDescriptors = descriptorCache.computeIfAbsent(location, l -> { IObjectDescriptor[] descriptors = calcDependentObjects(); return descriptors.length > 0 ? descriptors : EMPTY_DESCRIPTORS; }); } return objectDescriptors; }

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:
public void ransomUnit(int i) { TestUnit ransomUnit = potentialSalvage.get(i); getRansomedSalvage().add(ransomUnit); }

Target:
public void ransomUnit(int i) { if (i < getPotentialSalvage().size()) { TestUnit ransomUnit = getPotentialSalvage().get(i); getRansomedSalvage().add(ransomUnit); } }
Source:
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) { throw e; } return action.call(); } }

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:
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()); }

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:
public void testGetType() { assertEquals(null, report1.getType("path/to/diff1", 20, StashDiffReport.VICINITY_RANGE_NONE)); 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)); }

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:
protected void finalizeAndWriteMetrics(final LibraryIdGenerator libraryIdGenerator) { final Map<String, DuplicationMetrics> metricsByLibrary = libraryIdGenerator.getMetricsByLibraryMap(); final Histogram<Short> opticalDuplicatesByLibraryId = libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap(); final Histogram<Double> duplicateCountHist = libraryIdGenerator.getDuplicateCountHist(); final Histogram<Double> opticalDuplicateCountHist = libraryIdGenerator.getOpticalDuplicateCountHist(); final Histogram<Double> nonOpticalDuplicateCountHist = libraryIdGenerator.getNonOpticalDuplicateCountHist(); final Map<String, Short> libraryIds = libraryIdGenerator.getLibraryIdsMap(); final MetricsFile<DuplicationMetrics, Double> file = getMetricsFile(); for (final Map.Entry<String, DuplicationMetrics> entry : metricsByLibrary.entrySet()) { final String libraryName = entry.getKey(); final DuplicationMetrics metrics = entry.getValue(); metrics.READ_PAIRS_EXAMINED = metrics.READ_PAIRS_EXAMINED / 2; metrics.READ_PAIR_DUPLICATES = metrics.READ_PAIR_DUPLICATES / 2; final Short libraryId = libraryIds.get(libraryName); if (libraryId != null) { final Histogram.Bin<Short> bin = opticalDuplicatesByLibraryId.get(libraryId); if (bin != null) { metrics.READ_PAIR_OPTICAL_DUPLICATES = (long) bin.getValue(); } } metrics.calculateDerivedFields(); file.addMetric(metrics); } if (metricsByLibrary.size() == 1) { file.setHistogram(metricsByLibrary.values().iterator().next().calculateRoiHistogram()); } file.addHistogram(duplicateCountHist); file.addHistogram(nonOpticalDuplicateCountHist); file.addHistogram(opticalDuplicateCountHist); file.write(METRICS_FILE); }

Target:
protected void finalizeAndWriteMetrics(final LibraryIdGenerator libraryIdGenerator) { final Map<String, DuplicationMetrics> metricsByLibrary = libraryIdGenerator.getMetricsByLibraryMap(); final Histogram<Short> opticalDuplicatesByLibraryId = libraryIdGenerator.getOpticalDuplicatesByLibraryIdMap(); final Map<String, Short> libraryIds = libraryIdGenerator.getLibraryIdsMap(); final MetricsFile<DuplicationMetrics, Double> file = getMetricsFile(); for (final Map.Entry<String, DuplicationMetrics> entry : metricsByLibrary.entrySet()) { final String libraryName = entry.getKey(); final DuplicationMetrics metrics = entry.getValue(); metrics.READ_PAIRS_EXAMINED = metrics.READ_PAIRS_EXAMINED / 2; metrics.READ_PAIR_DUPLICATES = metrics.READ_PAIR_DUPLICATES / 2; final Short libraryId = libraryIds.get(libraryName); if (libraryId != null) { final Histogram.Bin<Short> bin = opticalDuplicatesByLibraryId.get(libraryId); if (bin != null) { metrics.READ_PAIR_OPTICAL_DUPLICATES = (long) bin.getValue(); } } metrics.calculateDerivedFields(); file.addMetric(metrics); } if (metricsByLibrary.size() == 1) { file.setHistogram(metricsByLibrary.values().iterator().next().calculateRoiHistogram()); } file.addHistogram(libraryIdGenerator.getDuplicateCountHist()); file.addHistogram(libraryIdGenerator.getOpticalDuplicateCountHist()); file.addHistogram(libraryIdGenerator.getNonOpticalDuplicateCountHist()); file.write(METRICS_FILE); }
Source:
public void testLongAsStringOverflowDeserialization() { BigInteger large = BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE); assertThatThrownBy(() -> MAPPER.readValue("\"" + large + "\"", Long.TYPE)) .isInstanceOf(NumberFormatException.class); }

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"); }