auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private CircuitBreakerMetrics(Seq<CircuitBreaker> circuitBreakers){ circuitBreakers.forEach(circuitBreaker -> { metricRegistry.register(name("resilience4j.circuitbreaker", circuitBreaker.getName(), "successful"), (Gauge<Integer>) () -> circuitBreaker.getMetrics().getNumberOfSuccessfulCalls()); metricRegistry.register(name("resilience4j.circuitbreaker", circuitBreaker.getName(), "failed"), (Gauge<Integer>) () -> circuitBreaker.getMetrics().getNumberOfFailedCalls()); metricRegistry.register(name("resilience4j.circuitbreaker", circuitBreaker.getName(), "not_permitted"), (Gauge<Long>) () -> circuitBreaker.getMetrics().getNumberOfNotPermittedCalls()); metricRegistry.register(name("resilience4j.circuitbreaker", circuitBreaker.getName(), "buffered"), (Gauge<Integer>) () -> circuitBreaker.getMetrics().getNumberOfBufferedCalls()); metricRegistry.register(name("resilience4j.circuitbreaker", circuitBreaker.getName(), "buffered_max"), (Gauge<Integer>) () -> circuitBreaker.getMetrics().getMaxNumberOfBufferedCalls()); } ); }

Target:
private CircuitBreakerMetrics(Seq<CircuitBreaker> circuitBreakers){ circuitBreakers.forEach(circuitBreaker -> { String name = circuitBreaker.getName(); CircuitBreaker.Metrics metrics = circuitBreaker.getMetrics(); metricRegistry.register(name("resilience4j.circuitbreaker", name, "successful"), (Gauge<Integer>) metrics::getNumberOfSuccessfulCalls); metricRegistry.register(name("resilience4j.circuitbreaker", name, "failed"), (Gauge<Integer>) metrics::getNumberOfFailedCalls); metricRegistry.register(name("resilience4j.circuitbreaker", name, "not_permitted"), (Gauge<Long>) metrics::getNumberOfNotPermittedCalls); metricRegistry.register(name("resilience4j.circuitbreaker", name, "buffered"), (Gauge<Integer>) metrics::getNumberOfBufferedCalls); metricRegistry.register(name("resilience4j.circuitbreaker", name, "buffered_max"), (Gauge<Integer>) metrics::getMaxNumberOfBufferedCalls); } ); }
Source:
private void gtk_swt_set_border_color (GdkColor color) { GdkRGBA rgba = null; if (color != null) { rgba = new GdkRGBA (); rgba = display.toGdkRGBA (color); } String css_string = "* {\n"; if (rgba != null) { String css_color = gtk_rgba_to_css_string (rgba); css_string += "border-color: " + css_color + ";\n"; } css_string += "}\n"; long context = OS.gtk_widget_get_style_context (handle); gtk_css_provider_load_from_css (context, css_string); }

Target:
private void gtk_swt_set_border_color (GdkColor color) { GdkRGBA rgba = null; if (color != null) { rgba = display.toGdkRGBA (color); } String css_string = "* {\n"; if (rgba != null) { String css_color = gtk_rgba_to_css_string (rgba); css_string += "border-color: " + css_color + ";\n"; } css_string += "}\n"; long context = OS.gtk_widget_get_style_context (handle); gtk_css_provider_load_from_css (context, css_string); }
Source:
protected Optional<UserVO> checkPassword(UserVO user, String password) { boolean validPassword = passwordService.checkPassword(password, user.getPasswordSalt(), user.getPasswordHash()); long loginTimeout = configurationService.getLong(Constants.LAST_LOGIN_TIMEOUT, Constants.LAST_LOGIN_TIMEOUT_DEFAULT); boolean mustUpdateLoginStatistic = user.getLoginAttempts() != 0 || user.getLastLogin() == null || timestampService.getTimestamp() - user.getLastLogin().getTime() > loginTimeout; if (validPassword && mustUpdateLoginStatistic) { UserVO user1 = updateStatisticOnSuccessfulLogin(user, loginTimeout); return of(user1); } else if (!validPassword) { user.setLoginAttempts(user.getLoginAttempts() + 1); if (user.getLoginAttempts() >= configurationService.getInt(Constants.MAX_LOGIN_ATTEMPTS, Constants.MAX_LOGIN_ATTEMPTS_DEFAULT)) { user.setStatus(UserStatus.LOCKED_OUT); logger.info("User with id has been locked out after login attempts.", user.getId(), user.getLoginAttempts()); user.setLoginAttempts(0); } userDao.merge(user); return empty(); } return of(user); }

Target:
protected Optional<UserVO> checkPassword(UserVO user, String password) { boolean validPassword = passwordService.checkPassword(password, user.getPasswordSalt(), user.getPasswordHash()); long loginTimeout = configurationService.getLong(Constants.LAST_LOGIN_TIMEOUT, Constants.LAST_LOGIN_TIMEOUT_DEFAULT); boolean mustUpdateLoginStatistic = user.getLoginAttempts() != 0 || user.getLastLogin() == null || timestampService.getTimestamp() - user.getLastLogin().getTime() > loginTimeout; if (validPassword && mustUpdateLoginStatistic) { UserVO user1 = updateStatisticOnSuccessfulLogin(user, loginTimeout); return of(user1); } else if (!validPassword) { user.setLoginAttempts(user.getLoginAttempts() + 1); if (user.getLoginAttempts() >= configurationService.getInt(Constants.MAX_LOGIN_ATTEMPTS, Constants.MAX_LOGIN_ATTEMPTS_DEFAULT)) { user.setStatus(UserStatus.LOCKED_OUT); logger.info("User with login has been locked out after login attempts.", user.getLogin(), user.getLoginAttempts()); user.setLoginAttempts(0); } userDao.merge(user); return empty(); } return of(user); }
Source:
public T proceed() throws Throwable { InterruptTask interruptTask = new InterruptTask(Thread.currentThread()); ScheduledFuture<?> future = executor.schedule(interruptTask, timeout.getValue(), timeout.getUnit()); Throwable failure = null; T result = null; try { result = delegate.proceed(); } catch (Throwable t) { failure = t; } finally { future.cancel(true); if (interruptTask.executed) { Thread.interrupted(); failure = createTimeoutException(failure); } } if (failure != null) { throw failure; } return result; }

Target:
public T proceed() throws Throwable { InterruptTask interruptTask = new InterruptTask(Thread.currentThread()); ScheduledFuture<?> future = executor.schedule(interruptTask, timeout.getValue(), timeout.getUnit()); Throwable failure = null; T result = null; try { result = delegate.proceed(); } catch (Throwable t) { BlacklistedExceptions.rethrowIfBlacklisted(t); failure = t; } finally { boolean cancelled = future.cancel(false); if (!cancelled) { future.get(); } if (interruptTask.executed) { Thread.interrupted(); failure = createTimeoutException(failure); } } if (failure != null) { throw failure; } return result; }
Source:
public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { logger.debug("Selected Nodes: " + selectedNodes); logger.debug("Analysing task: " + ((EligibleTaskDescriptorImpl) task).getInternal().getName()); final String requiredLicenses = ((EligibleTaskDescriptorImpl) task).getInternal() .getRuntimeGenericInformation() .get(REQUIRED_LICENSES); if (requiredLicenses != null) { if (eligibleTasksDescriptorsLicenses == null) eligibleTasksDescriptorsLicenses = new HashMap<String, FixedSizeArrayList>(); final Properties properties = LicenseConfiguration.getConfiguration().getProperties(); logger.debug("Need to check licenses with " + properties.toString()); final String[] requiredLicensesArray = requiredLicenses.split(","); for (int i = 0; i < requiredLicensesArray.length; i++) { final String currentRequiredLicense = requiredLicensesArray[i]; final int numberOfLicenses = Integer.parseInt(properties.getProperty(currentRequiredLicense)); if (!eligibleTasksDescriptorsLicenses.containsKey(currentRequiredLicense)) { eligibleTasksDescriptorsLicenses.put(currentRequiredLicense, new FixedSizeArrayList(numberOfLicenses)); } if (!canGetLicense(task, currentRequiredLicense, numberOfLicenses)) { logger.debug("License for " + currentRequiredLicense + " not available, returning false"); return false; } } for (int i = 0; i < requiredLicensesArray.length; i++) { eligibleTasksDescriptorsLicenses.get(requiredLicensesArray[i]).add(task); } logger.debug("All licenses are available, returning true"); return true; } else { return true; } }

Target:
public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { logger.debug("Selected Nodes: " + selectedNodes); logger.debug("Analysing task: " + ((EligibleTaskDescriptorImpl) task).getInternal().getName()); final String requiredLicenses = ((EligibleTaskDescriptorImpl) task).getInternal() .getRuntimeGenericInformation() .get(REQUIRED_LICENSES); if (requiredLicenses != null) { initialize(); logger.debug("Need to check licenses with " + properties.toString()); final String[] requiredLicensesArray = requiredLicenses.split(","); for (int i = 0; i < requiredLicensesArray.length; i++) { final String currentRequiredLicense = requiredLicensesArray[i]; if (!canGetLicense(currentRequiredLicense)) { logger.debug("License for " + currentRequiredLicense + " not available, keep task pending"); return false; } } for (int i = 0; i < requiredLicensesArray.length; i++) { eligibleTasksDescriptorsLicenses.get(requiredLicensesArray[i]).add(task); } logger.debug("All licenses are available, executing task"); return true; } else { return true; } }
Source:
public ReadCache(ByteBufAllocator allocator, long maxCacheSize, int maxSegmentSize) { this.allocator = allocator; int segmentsCount = Math.max(2, (int) (maxCacheSize / maxSegmentSize)); segmentSize = (int) (maxCacheSize / segmentsCount); cacheSegments = new ArrayList<>(); cacheIndexes = new ArrayList<>(); for (int i = 0; i < segmentsCount; i++) { cacheSegments.add(Unpooled.buffer(segmentSize, segmentSize)); cacheIndexes.add(new ConcurrentLongLongPairHashMap(4096, 2 * Runtime.getRuntime().availableProcessors())); } }

Target:
public ReadCache(ByteBufAllocator allocator, long maxCacheSize, int maxSegmentSize) { this.allocator = allocator; int segmentsCount = Math.max(2, (int) (maxCacheSize / maxSegmentSize)); segmentSize = (int) (maxCacheSize / segmentsCount); cacheSegments = new ArrayList<>(); cacheIndexes = new ArrayList<>(); for (int i = 0; i < segmentsCount; i++) { cacheSegments.add(allocator.buffer(segmentSize, segmentSize)); cacheIndexes.add(new ConcurrentLongLongPairHashMap(4096, 2 * Runtime.getRuntime().availableProcessors())); } }
Source:
public RAFLock lockOpen() throws IOException { RAFLock lock = new RAFLock() { @Override protected void innerUnlock() { PooledRandomAccessFileWrapper.this.unlock(); } }; synchronized(closables) { if(closed) throw new IOException("Already closed"); if(lockLevel > 0) { lockLevel++; return lock; } else { while(true) { if(OPEN_FDS < MAX_OPEN_FDS) break; PooledRandomAccessFileWrapper closable = closables.pollFirst(); if(closable != null) { closable.closeRAF(); continue; } try { closables.wait(); } catch (InterruptedException e) { } } OPEN_FDS++; lockLevel++; } if(raf != null) return lock; try { raf = new RandomAccessFile(file, mode); } catch (IOException e) { unlock(); throw e; } return lock; } }

Target:
public RAFLock lockOpen() throws IOException { RAFLock lock = new RAFLock() { @Override protected void innerUnlock() { PooledRandomAccessFileWrapper.this.unlock(); } }; synchronized(closables) { while(true) { if(closed) throw new IOException("Already closed"); if(raf != null) { lockLevel++; return lock; } else if(OPEN_FDS < MAX_OPEN_FDS) { lockLevel++; OPEN_FDS++; try { raf = new RandomAccessFile(file, mode); } catch (IOException e) { lockLevel--; OPEN_FDS--; throw e; } return lock; } else { PooledRandomAccessFileWrapper closable = pollFirstClosable(); if(closable != null) { closable.closeRAF(); continue; } try { closables.wait(); } catch (InterruptedException e) { } } } } }
Source:
private void saveProperty(String type, String name, String value) { String payload = "UPDATE PROPERTIES SET TYPE='" + name + "', VALUE='" + type + "' WHERE NAME = '" + value + "'"; Statement sta; try { sta = conn.createStatement(); int count = sta.executeUpdate(payload); if (count == 0) { payload = "INSERT INTO PROPERTIES VALUES ('" + name + "', '" + type + "', '" + value + "')"; Statement insert = conn.createStatement(); count = insert.executeUpdate(payload); } } catch (SQLException e) { log.warn("Unable to save property " + name + "!"); log.warn(e.toString()); e.printStackTrace(); } }

Target:
private void saveProperty(String type, String name, String value) { try { PreparedStatement sta = conn.prepareStatement("UPDATE PROPERTIES SET TYPE= ?, VALUE= ? WHERE NAME = ?"); sta.setString(1, type); sta.setString(2, value); sta.setString(3, name); int count = sta.executeUpdate(); if (count == 0) { PreparedStatement insert = conn.prepareStatement("INSERT INTO PROPERTIES VALUES (?, ?, ?)"); insert.setString(1, name); insert.setString(2, value); insert.setString(3, value); count = insert.executeUpdate(); } } catch (SQLException e) { log.warn("Unable to save property " + name + "!"); log.warn(e.toString()); e.printStackTrace(); } }
Source:
public int add(ComplexEventChunk<StreamEvent> addingEventChunk) { addingEventChunk.reset(); while (addingEventChunk.hasNext()) { ComplexEvent complexEvent = addingEventChunk.next(); StreamEvent streamEvent = tableStreamEventFactory.newInstance(); eventConverter.convertComplexEvent(complexEvent, streamEvent); this.add(streamEvent); } return findEventChunkSize(addingEventChunk.getFirst()); }

Target:
public void add(ComplexEventChunk<StreamEvent> addingEventChunk) { addingEventChunk.reset(); while (addingEventChunk.hasNext()) { size++; ComplexEvent complexEvent = addingEventChunk.next(); StreamEvent streamEvent = tableStreamEventFactory.newInstance(); eventConverter.convertComplexEvent(complexEvent, streamEvent); this.add(streamEvent); } }
Source:
public static Map<String, String> buildUserMetadata(byte[] userMetadata) throws RestServiceException { Map<String, String> toReturn = null; if (userMetadata.length > 0) { try { ByteBuffer userMetadataBuffer = ByteBuffer.wrap(userMetadata); short version = userMetadataBuffer.getShort(); switch (version) { case UserMetadata_Version_V1: int sizeToRead = userMetadataBuffer.getInt(); if (sizeToRead != (userMetadataBuffer.remaining() - 8)) { logger.trace("Size didn't match. Returning as old format"); } else { int entryCount = userMetadataBuffer.getInt(); int counter = 0; while (counter++ < entryCount) { String key = Utils.deserializeString(userMetadataBuffer, StandardCharsets.US_ASCII); String value = Utils.deserializeString(userMetadataBuffer, StandardCharsets.US_ASCII); if (toReturn == null) { toReturn = new HashMap<>(); } toReturn.put(Headers.USER_META_DATA_HEADER_PREFIX + key, value); } long actualCRC = userMetadataBuffer.getLong(); Crc32 crc32 = new Crc32(); crc32.update(userMetadata, 0, userMetadata.length - Crc_Size); long expectedCRC = crc32.getValue(); if (actualCRC != expectedCRC) { logger.trace("corrupt data while parsing user metadata Expected CRC " + expectedCRC + " Actual CRC " + actualCRC); toReturn = null; } } break; default: logger.trace("Failed to parse version in new format. Returning as old format"); } } catch (RuntimeException e) { logger.trace("Runtime Exception on parsing user metadata. Returning as old format"); toReturn = null; } } return toReturn; }

Target:
public static Map<String, String> buildUserMetadata(byte[] userMetadata) throws RestServiceException { Map<String, String> toReturn = null; if (userMetadata.length > 0) { try { ByteBuffer userMetadataBuffer = ByteBuffer.wrap(userMetadata); short version = userMetadataBuffer.getShort(); switch (version) { case UserMetadata_Version_V1: int sizeToRead = userMetadataBuffer.getInt(); if (sizeToRead != (userMetadataBuffer.remaining() - 8)) { logger.trace("Size didn't match. Returning null"); } else { int entryCount = userMetadataBuffer.getInt(); int counter = 0; if (entryCount > 0) { toReturn = new HashMap<>(); } while (counter++ < entryCount) { String key = Utils.deserializeString(userMetadataBuffer, StandardCharsets.US_ASCII); String value = Utils.deserializeString(userMetadataBuffer, StandardCharsets.US_ASCII); toReturn.put(Headers.USER_META_DATA_HEADER_PREFIX + key, value); } long actualCRC = userMetadataBuffer.getLong(); Crc32 crc32 = new Crc32(); crc32.update(userMetadata, 0, userMetadata.length - Crc_Size); long expectedCRC = crc32.getValue(); if (actualCRC != expectedCRC) { logger.trace("corrupt data while parsing user metadata Expected CRC " + expectedCRC + " Actual CRC " + actualCRC); toReturn = null; } } break; default: logger.trace("Failed to parse version in new format. Returning null"); } } catch (RuntimeException e) { logger.trace("Runtime Exception on parsing user metadata. Returning null"); toReturn = null; } } return toReturn; }
Source:
public Future<GetBlobResult> getBlob(String blobId, GetBlobOptions options, Callback<GetBlobResult> callback) { options = options == null ? GetBlobOptions.DEFAULT_OPTIONS : options; currentOperationsCount.incrementAndGet(); if (options.getOperationType() == GetBlobOptions.OperationType.BlobInfo) { routerMetrics.getBlobInfoOperationRate.mark(); } else { routerMetrics.getBlobOperationRate.mark(); } if (options.getRange() != null) { routerMetrics.getBlobWithRangeOperationRate.mark(); } routerMetrics.operationQueuingRate.mark(); FutureResult<GetBlobResult> futureResult = new FutureResult<>(); if (isOpen.get()) { getOperationController().getBlob(blobId, options, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onGetBlobError(routerException, options); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }

Target:
public Future<GetBlobResult> getBlob(String blobId, GetBlobOptions options, Callback<GetBlobResult> callback) { if (blobId == null || options == null) { throw new IllegalArgumentException("blobId or options must not be null"); } currentOperationsCount.incrementAndGet(); if (options.getOperationType() == GetBlobOptions.OperationType.BlobInfo) { routerMetrics.getBlobInfoOperationRate.mark(); } else { routerMetrics.getBlobOperationRate.mark(); } if (options.getRange() != null) { routerMetrics.getBlobWithRangeOperationRate.mark(); } routerMetrics.operationQueuingRate.mark(); FutureResult<GetBlobResult> futureResult = new FutureResult<>(); if (isOpen.get()) { getOperationController().getBlob(blobId, options, futureResult, callback); } else { RouterException routerException = new RouterException("Cannot accept operation because Router is closed", RouterErrorCode.RouterClosed); routerMetrics.operationDequeuingRate.mark(); routerMetrics.onGetBlobError(routerException, options); operationCompleteCallback.completeOperation(futureResult, callback, null, routerException); } return futureResult; }
Source:
private static String sliceHostname(String assignment) { String[] tokens = assignment.split("(\\p{javaSpaceChar}+|\t+)+"); if (tokens.length < 2) { throw new RuntimeException("Could not find hostname"); } return tokens[1]; }

Target:
private static String sliceHostname(String assignment) { String[] tokens = assignment.split("(\\p{javaSpaceChar}+|\t+)+"); if (tokens.length < 2) { throw new RuntimeException("Could not find hostname in " + assignment); } return tokens[1]; }
Source:
private void configureLockFileActions(File sandboxDir) { Task runIdeTask = project.getTasks().findByPath("runIde"); if (runIdeTask == null) throwGradleException("Unable to find the task 'runIde' of the intellij plugin."); runIdeTask.doFirst( (Task t) -> { try { if (!sandboxDir.exists() && !sandboxDir.mkdirs()) { throwGradleException( "Unable to create the sandbox directory: " + sandboxDir.getAbsolutePath()); } File lockFile = getLockFile(sandboxDir); boolean createdNewFile = lockFile.createNewFile(); if (!createdNewFile) throwGradleException("Lock file " + lockFile.getAbsolutePath() + " already exists!"); } catch (IOException e) { throw new GradleException( "Unable to lock sandbox: " + sandboxDir.getAbsolutePath() + RACE_CONDITION_WARNING, e); } }); runIdeTask.doLast( (Task t) -> { File lockFile = getLockFile(sandboxDir); if (!lockFile.delete()) throwGradleException("Failed to delete lock file: " + lockFile.getAbsolutePath()); }); }

Target:
private void configureLockFileActions(File sandboxDir) { Task runIdeTask = project.getTasks().findByPath("runIde"); if (runIdeTask == null) throwGradleException("Unable to find the task 'runIde' of the intellij plugin.", null); runIdeTask.doFirst( (Task t) -> { try { if (!sandboxDir.exists() && !sandboxDir.mkdirs()) { throwGradleException( "Unable to create the sandbox directory: " + sandboxDir.getAbsolutePath(), null); } File lockFile = getLockFile(sandboxDir); boolean createdNewFile = lockFile.createNewFile(); if (!createdNewFile) throwGradleException( "Lock file " + lockFile.getAbsolutePath() + " already exists!", null); } catch (IOException e) { throwGradleException("Unable to lock sandbox: " + sandboxDir.getAbsolutePath(), e); } }); runIdeTask.doLast( (Task t) -> { File lockFile = getLockFile(sandboxDir); if (!lockFile.delete()) throwGradleException("Failed to delete lock file: " + lockFile.getAbsolutePath(), null); }); }
Source:
public void leaveToken(DetailAST token) { switch (token.getType()) { case TokenTypes.CLASS_DEF: if (!classNameStack.isEmpty()) { classNameStack.pop(); } break; case TokenTypes.METHOD_DEF: if (!methodDefStack.isEmpty()) { methodDefStack.pop(); } break; default: break; } }

Target:
public void leaveToken(DetailAST token) { if (token.getType() == TokenTypes.CLASS_DEF && !classNameStack.isEmpty()) { classNameStack.pop(); } }
Source:
protected void assertSameCommands(Command expected, Command actual) { Gson gson = new Gson(); Assert.assertEquals(gson.toJson(expected), gson.toJson(actual)); Assert.assertTrue(Arrays.equals( expected.getAliasActions().toArray(), actual.getAliasActions().toArray())); Assert.assertFalse( expected.getAliasActionResults() != null ^ actual.getAliasActionResults() != null ); if (expected.getAliasActionResults() != null && actual.getAliasActionResults() != null) { Assert.assertTrue(Arrays.equals( expected.getAliasActionResults().toArray(), actual.getAliasActionResults().toArray())); } }

Target:
protected void assertSameCommands(Command expected, Command actual) { Gson gson = new Gson(); Assert.assertEquals(gson.toJson(expected), gson.toJson(actual)); Assert.assertTrue(Arrays.equals( expected.getAliasActions().toArray(), actual.getAliasActions().toArray())); Assert.assertTrue( expected.getAliasActionResults() != null && actual.getAliasActionResults() != null || expected.getAliasActionResults() == null && actual.getAliasActionResults() == null); if (expected.getAliasActionResults() != null && actual.getAliasActionResults() != null) { Assert.assertTrue(Arrays.equals( expected.getAliasActionResults().toArray(), actual.getAliasActionResults().toArray())); } }
Source:
private List<String> gatherUnsupportedTests(TypeElement connector, Class<?> test) { return Arrays.stream(test.getMethods()) .filter(method -> method.getAnnotation(ConnectorTest.class) != null) .filter(method -> !connectorSupportsTestMethod(connector, test, method)) .map(method -> method.getName()) .collect(toImmutableList()); }

Target:
private List<String> gatherUnsupportedTests(TypeElement connector, Class<?> test) { return Arrays.stream(test.getMethods()) .filter(method -> method.getAnnotation(ConnectorTest.class) != null) .filter(method -> !connectorSupportsTestMethod(connector, test, method)) .map(Method::getName) .collect(toImmutableList()); }
Source:
private Object[][] testMultipleLibraryUmiMetricsDataProvider() { final double effectiveLength2_1 = -(2./3.)*Math.log(2./3.)/Math.log(4.) -(1./3.)*Math.log(1./3.)/Math.log(4.); final double effectiveLength1_1_1 = -3*(1./3.)*Math.log(1./3.)/Math.log(4.); final double estimatedBaseQuality1_12 = QualityUtil.getPhredScoreFromErrorProbability(1./12.); return new Object[][] {{ Arrays.asList("A", "B", "A", "B", "A"), Arrays.asList("AAAA", "AAAA", "ATTA", "AAAA", "AAAT"), Arrays.asList("AAAA", "AAAA", "ATTA", "AAAA", "AAAA"), Arrays.asList(false, false, false, true, true), 1, Arrays.asList( new UmiMetrics("A", 4.0, 3, 2, 2, 2, 4, effectiveLength2_1, effectiveLength1_1_1, estimatedBaseQuality1_12, 0), new UmiMetrics("B", 4.0, 1, 1, 0, 2, 2, 0.0, 0.0, -1, 0) ) }}; }

Target:
private Object[][] testMultipleLibraryUmiMetricsDataProvider() { final double effectiveLength2_1 = -(2. / 3.) * Math.log(2. / 3.) / Math.log(4.) - (1. / 3.) * Math.log(1. / 3.) / Math.log(4.); final double effectiveLength1_1_1 = -3 * (1. / 3.) * Math.log(1. / 3.) / Math.log(4.); final double estimatedBaseQuality1_12 = QualityUtil.getPhredScoreFromErrorProbability(1. / 12.); final double estimatedBaseQuality1_9 = QualityUtil.getPhredScoreFromErrorProbability(1. / 9.); return new Object[][]{{ Arrays.asList("A", "B", "A", "B", "A"), Arrays.asList("AAAA", "AAAA", "ATTA", "AAAA", "AAAT"), Arrays.asList("AAAA", "AAAA", "ATTA", "AAAA", "AAAA"), Arrays.asList(false, false, false, true, true), 1, Arrays.asList( new UmiMetrics("A", 4.0, 3, 2, 2, 2, 4, effectiveLength2_1, effectiveLength1_1_1, estimatedBaseQuality1_12, 0), new UmiMetrics("B", 4.0, 1, 1, 0, 2, 2, 0.0, 0.0, -1, 0) ) }, { Arrays.asList("A", "B", "C", "C", "C"), Arrays.asList("AAA", "AAA", "TTA", "AAA", "AAT"), Arrays.asList("AAA", "AAA", "TTA", "AAA", "AAA"), Arrays.asList(false, false, false, false, true), 1, Arrays.asList( new UmiMetrics("A", 3.0, 1, 1, 0, 2, 2, 0.0, 0.0, -1, 0), new UmiMetrics("B", 3.0, 1, 1, 0, 2, 2, 0.0, 0.0, -1, 0), new UmiMetrics("C", 3.0, 3, 2, 2, 2, 4, effectiveLength2_1, effectiveLength1_1_1, estimatedBaseQuality1_9, 0)) }}; }
Source:
public boolean awaitServerSuspend(Set<String> waitForServers, int timeoutInSeconds) { long end = System.currentTimeMillis() + timeoutInSeconds * 1000; Set<BlockingQueueOperationListener<?>> listeners= new HashSet<>(); for (String serverName : waitForServers) { final ManagedServer server = servers.get(serverName); if (server != null) { try { BlockingQueueOperationListener<?> listener = server.suspend(timeoutInSeconds); listeners.add(listener); } catch (IOException ignore) { } } } for (BlockingQueueOperationListener<?> listener : listeners) { try { final TransactionalProtocolClient.PreparedOperation<?> prepared = listener.retrievePreparedOperation(); if (prepared.isFailed()) { continue; } prepared.commit(); prepared.getFinalResult().get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); continue; } catch (ExecutionException e) { e.printStackTrace(); } } return System.currentTimeMillis() < end; }

Target:
public boolean awaitServerSuspend(Set<String> waitForServers, int timeoutInSeconds) { long end = System.currentTimeMillis() + timeoutInSeconds * 1000; Map<String, BlockingQueueOperationListener<?>> listeners = new HashMap<>(); for (String serverName : waitForServers) { final ManagedServer server = servers.get(serverName); if (server != null) { try { BlockingQueueOperationListener<?> listener = server.suspend(timeoutInSeconds); listeners.put(serverName, listener); } catch (IOException e) { HostControllerLogger.ROOT_LOGGER.suspendExecutionFailed(e, serverName); } } } for (Map.Entry<String, BlockingQueueOperationListener<?>> listenerEntry : listeners.entrySet()) { try { final TransactionalProtocolClient.PreparedOperation<?> prepared = listenerEntry.getValue().retrievePreparedOperation(); if (prepared.isFailed()) { continue; } prepared.commit(); prepared.getFinalResult().get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); continue; } catch (ExecutionException e) { HostControllerLogger.ROOT_LOGGER.suspendListenerFailed(e, listenerEntry.getKey()); } } return System.currentTimeMillis() < end; }
Source:
protected boolean doIsDebuggerAttachSupported() { if (fBackend.getSessionType() == SessionType.CORE) { return false; } IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class); if (runControl != null && runControl.getRunMode() == MIRunMode.ALL_STOP) { return getNumConnected() == 0; } if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) { try { return getLaunchConfiguration().getAttribute( IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REMOTE_MULTI, IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_MULTI_DEFAULT); } catch(CoreException e) { GdbPlugin.getDefault().getLog().log(e.getStatus()); return false; } } return true; }

Target:
protected boolean doIsDebuggerAttachSupported() { if (fBackend.getSessionType() == SessionType.CORE) { return false; } if (fBackend.getSessionType() == SessionType.REMOTE && !fBackend.getIsAttachSession()) { return false; } IMIRunControl runControl = getServicesTracker().getService(IMIRunControl.class); if (runControl != null && runControl.getRunMode() == MIRunMode.ALL_STOP) { return getNumConnected() == 0; } return true; }
Source:
public Sampling setSampling(Sampling sampling) { Sampling prev = fSampling; fSampling = sampling; return prev; }

Target:
public void setSampling(Sampling sampling) { fSampling = sampling; }
Source:
public boolean processParentCoverage(CodeCoverageMetrics parentCoverage, String baseCommit, String branchName) { boolean passCoverage = true; if (parentCoverage == null) { logger.info(UBERALLS_TAG, "unable to find coverage for parent commit"); return passCoverage; } Float lineCoveragePercent = currentCoverage.getLineCoveragePercent(); logger.info(UBERALLS_TAG, "line coverage: " + lineCoveragePercent); logger.info(UBERALLS_TAG, "found parent coverage as " + parentCoverage.getLineCoveragePercent()); float coverageDelta = lineCoveragePercent - parentCoverage.getLineCoveragePercent(); String coverageDeltaDisplay = String.format("%.3f", coverageDelta); String lineCoverageDisplay = String.format("%.3f", lineCoveragePercent); if (coverageDelta > 0) { passCoverage = false; comment.append("Coverage increased (+" + coverageDeltaDisplay + "%) to " + lineCoverageDisplay + "%"); } else if (coverageDelta < 0) { comment.append("Coverage decreased (" + coverageDeltaDisplay + "%) to " + lineCoverageDisplay + "%"); } else { comment.append("Coverage remained the same (" + lineCoverageDisplay + "%)"); } comment.append(" when pulling **" + branchName + "** into "); comment.append(baseCommit.substring(0, 7)); comment.append("."); return passCoverage; }

Target:
public boolean processParentCoverage(CodeCoverageMetrics parentCoverage, String baseCommit, String branchName) { boolean passCoverage = true; if (parentCoverage == null) { logger.info(UBERALLS_TAG, "unable to find coverage for parent commit"); return passCoverage; } Float lineCoveragePercent = currentCoverage.getLineCoveragePercent(); logger.info(UBERALLS_TAG, "line coverage: " + lineCoveragePercent); logger.info(UBERALLS_TAG, "found parent coverage as " + parentCoverage.getLineCoveragePercent()); double coverageDelta = lineCoveragePercent - parentCoverage.getLineCoveragePercent(); String coverageDeltaDisplay = String.format("%.3f", coverageDelta); String lineCoverageDisplay = String.format("%.3f", lineCoveragePercent); if (coverageDelta > 0) { comment.append("Coverage increased (+" + coverageDeltaDisplay + "%) to " + lineCoverageDisplay + "%"); } else if (coverageDelta < 0) { comment.append("Coverage decreased (" + coverageDeltaDisplay + "%) to " + lineCoverageDisplay + "%"); } else { comment.append("Coverage remained the same (" + lineCoverageDisplay + "%)"); } if (coverageDelta < 0 && Math.abs(coverageDelta) > Math.abs(maximumCoverageDecreaseInPercent)) { passCoverage = false; } comment.append(" when pulling **" + branchName + "** into "); comment.append(baseCommit.substring(0, 7)); comment.append("."); return passCoverage; }
Source:
public static double calculateROCAUC(PriorityQueue<Pair<Double, Double>> queue, long pos, long neg, double positiveClsLb) { double[] lb = new double[queue.size()]; double[] prediction = new double[queue.size()]; int cnt = 0; while (!queue.isEmpty()) { Pair<Double, Double> elem = queue.poll(); System.out.println(elem.getKey() + " " + elem.getValue()); lb[cnt] = elem.getValue(); prediction[cnt] = elem.getKey(); cnt++; } double[] rank = new double[lb.length]; for (int i = 0; i < prediction.length; i++) { if (i == prediction.length - 1 || prediction[i] != prediction[i + 1]) rank[i] = i + 1; else { int j = i + 1; for (; j < prediction.length && prediction[j] == prediction[i]; j++); double r = (i + 1 + j) / 2.0; for (int k = i; k < j; k++) rank[k] = r; i = j - 1; } } double auc = 0.0; for (int i = 0; i < lb.length; i++) { if (lb[i] == positiveClsLb) auc += rank[i]; } if (pos == 0L) return Double.NaN; else if (neg == 0L) return Double.NaN; auc = (auc - (pos * (pos + 1) / 2.0)) / (pos * neg); return auc; }

Target:
public static double calculateROCAUC(PriorityQueue<Pair<Double, Double>> queue, long pos, long neg, double positiveClsLb) { double[] lb = new double[queue.size()]; double[] prediction = new double[queue.size()]; int cnt = 0; while (!queue.isEmpty()) { Pair<Double, Double> elem = queue.poll(); lb[cnt] = elem.getValue(); prediction[cnt] = elem.getKey(); cnt++; } double[] rank = new double[lb.length]; for (int i = 0; i < prediction.length; i++) { if (i == prediction.length - 1 || prediction[i] != prediction[i + 1]) rank[i] = i + 1; else { int j = i + 1; for (; j < prediction.length && prediction[j] == prediction[i]; j++); double r = (i + 1 + j) / 2.0; for (int k = i; k < j; k++) rank[k] = r; i = j - 1; } } double auc = 0.0; for (int i = 0; i < lb.length; i++) { if (lb[i] == positiveClsLb) auc += rank[i]; } if (pos == 0L) return Double.NaN; else if (neg == 0L) return Double.NaN; auc = (auc - (pos * (pos + 1) / 2.0)) / (pos * neg); return auc; }
Source:
public long getMaxResultSize() { return super.getMaxResultSize(); }

Target:
public long getMaxResultSize() { return this.delegateScan.getMaxResultSize(); }
Source:
public static BloomKFilter deserialize(ByteBuffer in, int position) throws IOException { if (in == null) { throw new IOException("Input stream is null"); } try { ByteBuffer dataBuffer = in.duplicate().order(ByteOrder.BIG_ENDIAN); dataBuffer.position(position); int numHashFunc = dataBuffer.get(); int bitsetArrayLen = dataBuffer.getInt(); long[] data = new long[bitsetArrayLen]; for (int i = 0; i < bitsetArrayLen; i++) { data[i] = dataBuffer.getLong(); } return new BloomKFilter(data, numHashFunc); } catch (RuntimeException e) { IOException io = new IOException("Unable to deserialize BloomKFilter"); io.initCause(e); throw io; } }

Target:
public static BloomKFilter deserialize(ByteBuffer in, int position) throws IOException { if (in == null) { throw new IOException("Input stream is null"); } try { ByteBuffer dataBuffer = in.duplicate().order(ByteOrder.BIG_ENDIAN); dataBuffer.position(position); int numHashFunc = dataBuffer.get(); int bitsetArrayLen = dataBuffer.getInt(); long[] data = new long[bitsetArrayLen]; for (int i = 0; i < bitsetArrayLen; i++) { data[i] = dataBuffer.getLong(); } return new BloomKFilter(data, numHashFunc); } catch (RuntimeException e) { throw new IOException("Unable to deserialize BloomKFilter", e); } }
Source:
protected OsRegistrationReadingJob() { super("Retrieving Link Handlers registration status from Operating System"); }

Target:
private OsRegistrationReadingJob() { super("Retrieving Link Handlers registration status from Operating System"); }
Source:
public void testNonStreamApplicationWordcount() throws Exception { StreamFactory.fromFolder("./src/test/resources/data") .flatMap(new Function.FlatMapFunction<String, String>() { @Override public Iterable<String> f(String input) { return Arrays.asList(input.split(" ")); } }) .countByKey().print().runEmbedded(5000); }

Target:
public void testNonStreamApplicationWordcount() throws Exception { TupleCollector<Map<Object, Integer>> collector = new TupleCollector<>(); collector.id = "testNonStreamApplicationWordcount"; final Map<Object, Integer> expected = new HashMap<>(); expected.put("error", 2); expected.put("word1", 4); expected.put("word2", 8); expected.put("word3", 4); expected.put("word4", 4); expected.put("word5", 4); expected.put("word7", 4); expected.put("word9", 6); Callable<Boolean> exitCondition = new Callable<Boolean>() { @Override public Boolean call() throws Exception { List<Map<Object, Integer>> data = (List<Map<Object, Integer>>)TupleCollector.results.get("testNonStreamApplicationWordcount"); return (data != null) && data.size() >= 1 && expected.equals(data.get(data.size() - 1)); } }; StreamFactory.fromFolder("./src/test/resources/data") .flatMap(new Function.FlatMapFunction<String, String>() { @Override public Iterable<String> f(String input) { return Arrays.asList(input.split(" ")); } }) .countByKey().addOperator(collector, collector.inputPort, collector.outputPort).print().runEmbedded(false, 30000, exitCondition); List<Map<Object, Integer>> data = (List<Map<Object, Integer>>)TupleCollector.results.get("testNonStreamApplicationWordcount"); Assert.assertNotNull(data); Assert.assertTrue(data.size() > 1); Assert.assertEquals(expected, data.get(data.size() - 1)); }
Source:
Connections(List<Connection> connections, List<EObject> selectedObjects) { this.connections = connections; origin = selectedObjects.get(0); allObjects = new LinkedHashSet<>(); allObjects.addAll(selectedObjects); connections.forEach(c -> allObjects.addAll(c.getTargets())); object2Id = new LinkedHashMap<>(); int i = 0; for (EObject o : allObjects) { object2Id.put(o, "o" + i++); } id2Label = new LinkedHashMap<>(); allObjects.forEach(o -> { String id = object2Id.get(o); id2Label.put(id, getArtifactLabel(o)); }); id2Link = new LinkedHashMap<>(); allObjects.forEach(o -> { String id = object2Id.get(o); id2Link.put(id, getArtifactLink(o)); }); }

Target:
Connections(List<Connection> connections, List<EObject> selectedObjects) { this.connections = connections; origin = selectedObjects.get(0); allObjects = new LinkedHashSet<>(); allObjects.addAll(selectedObjects); connections.forEach(c -> allObjects.addAll(c.getTargets())); object2Id = new LinkedHashMap<>(); int i = 0; for (EObject o : allObjects) { object2Id.put(o, "o" + i++); } id2Label = new LinkedHashMap<>(); allObjects.forEach(o -> { String id = object2Id.get(o); id2Label.put(id, getArtifactLabel(o)); }); id2Location = new LinkedHashMap<>(); allObjects.forEach(o -> { String id = object2Id.get(o); id2Location.put(id, getArtifactLocation(o)); }); }
Source:
public static void main(String[] args) throws Exception { VoterConfig config = new VoterConfig(); config.parse(AsyncBenchmark.class.getName(), args); SSLContext sslContext; try { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new FileInputStream("/Users/mteixeira/keystore.jks"), "myk5yst15r5".toCharArray()); KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); kmf.init(ks, "myk5yst15r5".toCharArray()); sslContext = SSLContext.getInstance("TLS"); sslContext.init(createKeyManagers("/Users/mteixeira/keystore.jks", "myk5yst15r5", "myk5yst15r5"), createTrustManagers("/Users/mteixeira/keystore.jks", "myk5yst15r5"), new SecureRandom()); } catch (Exception e) { return; } AsyncBenchmark benchmark = new AsyncBenchmark(config); benchmark.runBenchmark(); }

Target:
public static void main(String[] args) throws Exception { VoterConfig config = new VoterConfig(); config.parse(AsyncBenchmark.class.getName(), args); AsyncBenchmark benchmark = new AsyncBenchmark(config); benchmark.runBenchmark(); }
Source:
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { View content = View.inflate(ctx, R.layout.share_episode_dialog, null); AlertDialog.Builder builder = new AlertDialog.Builder(ctx); builder.setTitle(R.string.share_label); builder.setView(content); radioGroup = content.findViewById(R.id.share_dialog_radio_group); radioEpisodeWebsite = content.findViewById(R.id.share_episode_website_radio); radioMediaFile = content.findViewById(R.id.share_media_file_radio); switchStartAt = content.findViewById(R.id.share_start_at_timer_dialog); setupOptions(); builder .setPositiveButton(R.string.share_label, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { if (radioEpisodeWebsite.isChecked()) { ShareUtils.shareFeedItemLink(ctx, item, switchStartAt.isChecked()); prefs.edit().putBoolean(PREF_SHARE_EPISODE_START_AT, switchStartAt.isChecked()).apply(); prefs.edit().putBoolean(PREF_SHARE_EPISODE_WEBSITE, true).apply(); prefs.edit().putBoolean(PREF_SHARE_EPISODE_MEDIA, false).apply(); } else { ShareUtils.shareFeedItemLink(ctx, item, switchStartAt.isChecked()); prefs.edit().putBoolean(PREF_SHARE_EPISODE_START_AT, switchStartAt.isChecked()).apply(); prefs.edit().putBoolean(PREF_SHARE_EPISODE_WEBSITE, false).apply(); prefs.edit().putBoolean(PREF_SHARE_EPISODE_MEDIA, true).apply(); } } }) .setNegativeButton(R.string.cancel_label, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); return builder.create(); }

Target:
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { if (getArguments() != null) { ctx = getActivity(); item = (FeedItem) getArguments().getSerializable(ARGUMENT_FEED_ITEM); prefs = getActivity().getSharedPreferences("ShareDialog", Context.MODE_PRIVATE); } View content = View.inflate(ctx, R.layout.share_episode_dialog, null); AlertDialog.Builder builder = new AlertDialog.Builder(ctx); builder.setTitle(R.string.share_label); builder.setView(content); radioGroup = content.findViewById(R.id.share_dialog_radio_group); radioEpisodeWebsite = content.findViewById(R.id.share_episode_website_radio); radioMediaFile = content.findViewById(R.id.share_media_file_radio); checkBoxStartAt = content.findViewById(R.id.share_start_at_timer_dialog); setupOptions(); builder.setPositiveButton(R.string.share_label, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { boolean includePlaybackPosition = checkBoxStartAt.isChecked(); if (radioEpisodeWebsite.isChecked()) { ShareUtils.shareFeedItemLink(ctx, item, includePlaybackPosition); prefs.edit().putString(PREF_SHARE_DIALOG_OPTION, "website").apply(); } else { ShareUtils.shareFeedItemDownloadLink(ctx, item, includePlaybackPosition); prefs.edit().putString(PREF_SHARE_DIALOG_OPTION, "media").apply(); } prefs.edit().putBoolean(PREF_SHARE_EPISODE_START_AT, includePlaybackPosition).apply(); } }).setNegativeButton(R.string.cancel_label, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.dismiss(); } }); return builder.create(); }
Source:
public static NERDocument readFile(String path, String format, String documentName) throws Exception { NERDocument res = null; if (format.equals("-c")) { res = (new ColumnFileReader(path)).read(documentName); } else { if (format.equals("-r")) { res = BracketFileReader.read(path, documentName); } else { logger.info("Fatal error: unrecognized file format: " + format); System.exit(0); } } connectSentenceBoundaries(res.sentences); return res; }

Target:
public static NERDocument readFile(String path, String format, String documentName) throws Exception { NERDocument res = null; if (format.equals("-c")) { res = (new ColumnFileReader(path)).read(documentName); } else { if (format.equals("-r")) { res = BracketFileReader.read(path, documentName); } else { System.err.println("Fatal error: unrecognized file format: " + format); System.exit(0); } } connectSentenceBoundaries(res.sentences); return res; }
Source:
Ref(DfsStreamKey key, long position, int size, T v) { this.key = key; this.position = position; this.size = size; this.value = v; this.hot = true; }

Target:
Ref(DfsStreamKey key, long position, int size, T v) { this.key = key; this.position = position; this.size = size; this.value = v; }
Source:
private int parseRank(String card) { if (card.substring(0, 2).equals("10")) { return 10; } String s = "..23456789TJQKA"; return s.indexOf(card.charAt(0)); }

Target:
private int parseRank(String card) { if (card.substring(0, 2).equals("10")) { return 10; } return "..23456789TJQKA".indexOf(card.charAt(0)); }
Source:
private void testDescriptionUpdate(String oldDescription, String newDescription, boolean changeExpected, String expectedMessage) { Task task = new TaskFluent() .setDescription(oldDescription) .setAdminUser("Administrator") .getTask(); taskService.addTask(task, new HashMap<String, Object>()); long taskId = task.getId(); List<I18NText> descriptions = new ArrayList<I18NText>(); descriptions.add(new I18NTextImpl("", newDescription)); taskService.setDescriptions(taskId, descriptions); task = taskService.getTaskById(taskId); Assertions.assertThat(task.getDescription()).isEqualTo(newDescription); List<AuditTask> auditTasks = taskAuditService.getAllAuditTasks(new QueryFilter()); Assertions.assertThat(auditTasks).hasSize(1); Assertions.assertThat(auditTasks.get(0).getDescription()).isEqualTo(newDescription); List<TaskEvent> taskEvents = taskAuditService.getAllTaskEvents(taskId, new QueryFilter()); if (changeExpected) { Assertions.assertThat(taskEvents).hasSize(2); assertEquals(expectedMessage, taskEvents.get(1).getMessage()); } else { Assertions.assertThat(taskEvents).hasSize(1); } }

Target:
private void testDescriptionUpdate(String oldDescription, String newDescription, boolean changeExpected, String expectedMessage) { Task task = new TaskFluent() .setDescription(oldDescription) .setAdminUser("Administrator") .getTask(); taskService.addTask(task, new HashMap<String, Object>()); long taskId = task.getId(); List<I18NText> descriptions = new ArrayList<I18NText>(); descriptions.add(new I18NTextImpl("", newDescription)); taskService.setDescriptions(taskId, descriptions); task = taskService.getTaskById(taskId); Assertions.assertThat(task.getDescription()).isEqualTo(newDescription); List<AuditTask> auditTasks = taskAuditService.getAllAuditTasks(new QueryFilter()); Assertions.assertThat(auditTasks).hasSize(1); Assertions.assertThat(auditTasks.get(0).getDescription()).isEqualTo(newDescription); List<TaskEvent> taskEvents = taskAuditService.getAllTaskEvents(taskId, new QueryFilter()); if (changeExpected) { Assertions.assertThat(taskEvents).hasSize(2); Assertions.assertThat(taskEvents.get(1).getMessage()).isEqualTo(expectedMessage); } else { Assertions.assertThat(taskEvents).hasSize(1); } }
Source:
public MethodResultCode execute(final DlmsConnection conn, final DlmsDevice device, final Void v) throws ProtocolAdapterException { LOGGER.info("ACTIVATING PASSIVE CALENDAR"); final MethodParameter method = new MethodParameter(CLASS_ID, OBIS_CODE, METHOD_ID_ACTIVATE_PASSIVE_CALENDAR); MethodResult methodResultCode = null; try { methodResultCode = conn.action(method); } catch (final IOException e) { throw new ConnectionException(e); } if (!MethodResultCode.SUCCESS.equals(methodResultCode)) { throw new ProtocolAdapterException("Activating the activity calendar failed. MethodResult is: " + methodResultCode.getResultCode() + " ClassId: " + CLASS_ID + " obisCode: " + OBIS_CODE + " method id: " + METHOD_ID_ACTIVATE_PASSIVE_CALENDAR); } return MethodResultCode.SUCCESS; }

Target:
public MethodResultCode execute(final DlmsConnection conn, final DlmsDevice device, final Void v) throws ProtocolAdapterException { LOGGER.info("ACTIVATING PASSIVE CALENDAR"); final MethodParameter method = new MethodParameter(CLASS_ID, OBIS_CODE, METHOD_ID_ACTIVATE_PASSIVE_CALENDAR); MethodResult methodResultCode = null; try { methodResultCode = conn.action(method); } catch (final IOException e) { throw new ConnectionException(e); } if (!MethodResultCode.SUCCESS.equals(methodResultCode.getResultCode())) { throw new ProtocolAdapterException("Activating the activity calendar failed. MethodResult is: " + methodResultCode.getResultCode() + " ClassId: " + CLASS_ID + " obisCode: " + OBIS_CODE + " method id: " + METHOD_ID_ACTIVATE_PASSIVE_CALENDAR); } return MethodResultCode.SUCCESS; }
Source:
private LocalDateTimeSqlType() { super(SqlType.DATE, new Class<?>[] { LocalDateTime.class }); }

Target:
private static final LocalDateTimeSqlType singleton = isJavaTimeSupported() ? new LocalDateTimeSqlType() : null; public static LocalDateTimeSqlType getSingleton() { return singleton; }
Source:
private static Integer stratifySoftClippedBases(final SAMRecord sam) { final Cigar cigar = sam.getCigar(); if (cigar == null) { return -1; } return cigar.getCigarElements().stream() .filter(e->e.getOperator()== CigarOperator.S) .mapToInt(CigarElement::getLength).sum(); }

Target:
private static Integer stratifySoftClippedBases(final SAMRecord sam) { final Cigar cigar = sam.getCigar(); if (cigar == null) { return NOT_ALIGNED_ERROR; } return cigar.getCigarElements().stream() .filter(e -> e.getOperator() == CigarOperator.S) .mapToInt(CigarElement::getLength).sum(); }