auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void transactionCompleting() { if (trace) { int done = 0, notDone = 0; for (int i = 0; i < index; ++i) { Object task = tasks[i]; if (task instanceof CompletableFuture) { if (((CompletableFuture) task).isDone()) { done++; } else { notDone++; } } } log.tracef("%d tasks done, %d tasks not done yet", done, notDone); } int count = 0; for (int i = 0; i < index; ++i) { Object task = tasks[i]; if (task instanceof CompletableFuture) { try { ((CompletableFuture) task).join(); } catch (CompletionException e) { log.failureBeforeTransactionCompletion(i, e); } tasks[i] = null; ++count; } } if (trace) { log.tracef("Finished %d tasks before completion", count); } }

Target:
public void transactionCompleting() { if (trace) { int done = 0, notDone = 0; for (int i = 0; i < index; ++i) { Object task = tasks[i]; if (task instanceof CompletableFuture) { if (((CompletableFuture) task).isDone()) { done++; } else { notDone++; } } } log.tracef("%d tasks done, %d tasks not done yet", done, notDone); } int count = 0; for (int i = 0; i < index; ++i) { Object task = tasks[i]; if (task instanceof CompletableFuture) { log.tracef("Waiting for %08x %s", System.identityHashCode(task), task); try { ((CompletableFuture) task).join(); } catch (CompletionException e) { log.failureBeforeTransactionCompletion(i, e); } tasks[i] = null; ++count; } else { log.tracef("Not waiting for %08x %s", System.identityHashCode(task), task); } } if (trace) { log.tracef("Finished %d tasks before completion", count); } }
Source:
private void executeQuery(int numInstruments) throws Exception { String queryString = "<trace> select i,p from /instrument i, /product p where i.productId = p.productId and i.types['TYPE']=$1"; Query query = ClusterStartupRule.getClientCache().getQueryService().newQuery(queryString); Collection results = (Collection) query.execute(new Object[] {"TYPE1"}); assertThat(results.size()).isEqualTo(numInstruments); }

Target:
private void executeQuery(int numInstruments) throws Exception { ClientCache cache = ClusterStartupRule.getClientCache(); Region productRegion = cache.getRegion(PRODUCT_REGION_NAME); Region instrumentRegion = cache.getRegion(INSTRUMENT_REGION_NAME); String queryString = "<trace> select i,p from " + instrumentRegion.getFullPath() + " i, " + productRegion.getFullPath() + " p where i.productId = p.productId and i.types['TYPE']=$1"; Query query = ClusterStartupRule.getClientCache().getQueryService().newQuery(queryString); Collection results = (Collection) query.execute(new Object[] {"TYPE1"}); assertThat(results.size()).isEqualTo(numInstruments); }
Source:
public void loadProjectClassloaderTest() throws Exception { CompilationResponse res = compileProjectInRepo(MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE, MavenCLIArgs.INSTALL); if (!res.isSuccessful()) { TestUtil.writeMavenOutputIntoTargetFolder(tmp, res.getMavenOutput(), "ClassLoaderProviderTest.loadProjectClassloaderTest"); } assertThat(res.isSuccessful()).isTrue(); List<String> pomList = MavenUtils.searchPoms(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_CLASSLOADER_DIR)); Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.loadDependenciesClassloaderFromProject(pomList, mavenRepo.toAbsolutePath().toString()); assertThat(clazzLoader).isNotNull(); assertThat(clazzLoader).isPresent(); LoadProjectDependencyUtil.loadLoggerFactory(clazzLoader.get()); if (tmpRoot != null) { TestUtil.rm(tmpRoot.toFile()); } }

Target:
public void loadProjectClassloaderTest() throws Exception { CompilationResponse res = compileProjectInRepo(MavenCLIArgs.CLEAN, MavenCLIArgs.COMPILE, MavenCLIArgs.INSTALL); TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName); assertThat(res.isSuccessful()).isTrue(); List<String> pomList = MavenUtils.searchPoms(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_CLASSLOADER_DIR)); Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.loadDependenciesClassloaderFromProject(pomList, mavenRepo.toAbsolutePath().toString()); assertThat(clazzLoader).isPresent(); LoadProjectDependencyUtil.loadLoggerFactory(clazzLoader.get()); }
Source:
private org.snmp4j.Snmp createSnmp3(Profile profile) { try { TransportMapping<?> transport = new DefaultUdpTransportMapping(); org.snmp4j.Snmp snmp = new org.snmp4j.Snmp(transport); SecurityProtocols securityProtocols = SecurityProtocols.getInstance(); securityProtocols.addDefaultProtocols(); securityProtocols.addPrivacyProtocol(new PrivAES192()); USM usm = new USM(securityProtocols, profile.engineId, 0); ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)) .setLocalEngineID(profile.engineId.getValue()); ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)) .getSecurityModels().addSecurityModel(usm); SecurityModels.getInstance().addSecurityModel( usm); transport.listen(); snmp.getUSM().addUser( profile.username, getUsmUser(profile)); return snmp; } catch (IOException e) { throw new NotificationServiceException("error creating version 3 snmp " + getClass().getName()); } }

Target:
private org.snmp4j.Snmp createSnmp3(Profile profile) { try { TransportMapping<?> transport = new DefaultUdpTransportMapping(); org.snmp4j.Snmp snmp = new org.snmp4j.Snmp(transport); SecurityProtocols securityProtocols = SecurityProtocols.getInstance(); securityProtocols.addDefaultProtocols(); securityProtocols.addAuthenticationProtocol(new AuthMD5()); securityProtocols.addAuthenticationProtocol(new AuthSHA()); securityProtocols.addPrivacyProtocol(new PrivAES128()); securityProtocols.addPrivacyProtocol(new PrivAES192()); securityProtocols.addPrivacyProtocol(new PrivAES256()); USM usm = new USM(securityProtocols, profile.engineId, 0); ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)) .setLocalEngineID(profile.engineId.getValue()); ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID)) .getSecurityModels().addSecurityModel(usm); SecurityModels.getInstance().addSecurityModel( usm); transport.listen(); snmp.getUSM().addUser( profile.username, getUsmUser(profile)); return snmp; } catch (IOException e) { throw new NotificationServiceException("error creating version 3 snmp " + getClass().getName()); } }
Source:
private static File getTempRoot(Properties props) { String tempRoot = props.getProperty(JBOSS_EMBEDDED_ROOT, null); if (tempRoot == null) { return null; } File root = new File(tempRoot); if (!root.exists()) { root.mkdirs(); } validateDirectory("jboss.test.clean.root", root); root = new File(root, "configs"); root.mkdir(); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS"); root = new File(root, format.format(new Date())); root.mkdir(); return root; }

Target:
private static File getTempRoot(Properties props) { String tempRoot = props.getProperty(JBOSS_EMBEDDED_ROOT, null); if (tempRoot == null) { return null; } try { File root = new File(tempRoot); if (!root.exists()) { Files.createDirectories(root.toPath()); } validateDirectory("jboss.test.clean.root", root); root = new File(root, "configs"); Files.createDirectories(root.toPath()); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmssSSS"); root = new File(root, format.format(new Date())); Files.createDirectory(root.toPath()); return root; } catch (IOException e) { throw EmbeddedLogger.ROOT_LOGGER.cannotSetupEmbeddedServer(e); } }
Source:
public void metadataSemanticallyEquivalentToItselfIfCanBeDeserializedAndSemanticsAgree() { Assume.assumeTrue(V1_BASE.underlyingData().isPresent()); assertThat(V1_BASE.knowablySemanticallyEquivalent(V1_BASE)).isTrue(); }

Target:
public void metadataSemanticallyEquivalentToItselfIfCanBeDeserializedAndSemanticsAgree() { assertThat(V1_BASE.underlyingData()).isPresent(); assertThat(V1_BASE.knowablySemanticallyEquivalent(V1_BASE)).isTrue(); }
Source:
public void addPages() { addPage(fSelectPage); addPage(fSelectDirectories); addPage(fScanPage); addPage(fImportOptions); }

Target:
public void addPages() { addPage(fSelectPage); addPage(fSelectDirectories); addPage(fScanPage); }
Source:
private InitStep loadInitStep(File jar) { try { ClassLoader pluginLoader = new URLClassLoader(new URL[] {jar.toURI().toURL()}, InitPluginStepsLoader.class.getClassLoader()); JarFile jarFile = new JarFile(jar); try { Attributes jarFileAttributes = jarFile.getManifest().getMainAttributes(); String initClassName = jarFileAttributes.getValue("Gerrit-InitStep"); if (initClassName == null) { return null; } @SuppressWarnings("unchecked") Class<? extends InitStep> initStepClass = (Class<? extends InitStep>) pluginLoader.loadClass(initClassName); return getPluginInjector(jar).getInstance(initStepClass); } finally { jarFile.close(); } } catch (ClassCastException e) { ui.message( "WARN: InitStep from plugin %s does not implement %s (Exception: %s)", jar.getName(), InitStep.class.getName(), e.getMessage()); return null; } catch (Exception e) { ui.message( "WARN: Cannot load and get plugin init step for %s (Exception: %s)", jar, e.getMessage()); return null; } }

Target:
private InitStep loadInitStep(File jar) { try { ClassLoader pluginLoader = new URLClassLoader(new URL[] {jar.toURI().toURL()}, InitPluginStepsLoader.class.getClassLoader()); try (JarFile jarFile = new JarFile(jar)) { Attributes jarFileAttributes = jarFile.getManifest().getMainAttributes(); String initClassName = jarFileAttributes.getValue("Gerrit-InitStep"); if (initClassName == null) { return null; } @SuppressWarnings("unchecked") Class<? extends InitStep> initStepClass = (Class<? extends InitStep>) pluginLoader.loadClass(initClassName); return getPluginInjector(jar).getInstance(initStepClass); } } catch (ClassCastException e) { ui.message( "WARN: InitStep from plugin %s does not implement %s (Exception: %s)", jar.getName(), InitStep.class.getName(), e.getMessage()); return null; } catch (Exception e) { ui.message( "WARN: Cannot load and get plugin init step for %s (Exception: %s)", jar, e.getMessage()); return null; } }
Source:
private void initialSetup() { mockValidators(); doNothing().when(command).updateDisksFromDb(); doReturn(mockVm()).when(command).getVm(); doReturn(true).when(command).isDiskPassPciAndIdeLimit(any(Disk.class)); doReturn(true).when(command).checkDiskUsedAsOvfStore(diskValidator); doReturn(false).when(command).isOperationPerformedOnDiskSnapshot(); doReturn(vmDeviceDAO).when(command).getVmDeviceDao(); doReturn(storageDomainDAO).when(command).getStorageDomainDAO(); doReturn(storagePoolIsoMapDAO).when(command).getStoragePoolIsoMapDao(); mockStoragePoolIsoMap(); }

Target:
public void initialSetup() { mockValidators(); doNothing().when(command).updateDisksFromDb(); doReturn(mockVm()).when(command).getVm(); doReturn(true).when(command).isDiskPassPciAndIdeLimit(any(Disk.class)); doReturn(true).when(command).checkDiskUsedAsOvfStore(diskValidator); doReturn(false).when(command).isOperationPerformedOnDiskSnapshot(); doReturn(vmDeviceDAO).when(command).getVmDeviceDao(); doReturn(storageDomainDAO).when(command).getStorageDomainDAO(); doReturn(storagePoolIsoMapDAO).when(command).getStoragePoolIsoMapDao(); mockStoragePoolIsoMap(); }
Source:
public void stateChanged(CuratorFramework client, ConnectionState newState) { stateHandlerLock.lock(); try { scheduler.setZkConnectionState(newState); ConnectionState previous = lastState.get(); if (!newState.isConnected()) { scheduler.notLeader(); lostConnectionStateChecker = new TimerTask() { @Override public void run() { stateHandlerLock.lock(); try { LOG.error("Aborting due to loss of zookeeper connection for {}ms. Current connection state {}", configuration.getZooKeeperConfiguration().getAbortAfterConnectionLostForMillis(), newState); abort.abort(AbortReason.LOST_ZK_CONNECTION, Optional.empty()); } finally { stateHandlerLock.unlock(); } } }; TIMER.schedule(lostConnectionStateChecker, configuration.getZooKeeperConfiguration().getAbortAfterConnectionLostForMillis()); } else if (previous != null && !previous.isConnected()) { if (lostConnectionStateChecker != null) { lostConnectionStateChecker.cancel(); } } } finally { stateHandlerLock.unlock(); } }

Target:
public void stateChanged(CuratorFramework client, ConnectionState newState) { LOG.info("Received update for new zk connection state {}", newState); stateHandlerLock.lock(); try { scheduler.setZkConnectionState(newState); if (!newState.isConnected()) { LOG.info("No longer connected to zk, pausing scheduler actions and waiting up to {}ms for reconnect", configuration.getZooKeeperConfiguration().getAbortAfterConnectionLostForMillis()); if (lostConnectionStateChecker != null) { LOG.warn("Already started connection state check, due in {}ms", lostConnectionStateChecker.scheduledExecutionTime() - System.currentTimeMillis()); return; } lostConnectionStateChecker = new TimerTask() { @Override public void run() { stateHandlerLock.lock(); if (scheduler.getState().getZkConnectionState().isConnected()) { LOG.debug("Reconnected to zk, will not abort"); return; } try { LOG.error("Aborting due to loss of zookeeper connection for {}ms. Current connection state {}", configuration.getZooKeeperConfiguration().getAbortAfterConnectionLostForMillis(), newState); abort.abort(AbortReason.LOST_ZK_CONNECTION, Optional.empty()); } finally { stateHandlerLock.unlock(); } } }; TIMER.schedule(lostConnectionStateChecker, configuration.getZooKeeperConfiguration().getAbortAfterConnectionLostForMillis()); } else if (lostConnectionStateChecker != null) { LOG.info("Reconnected to zk, scheduler actions resumed"); lostConnectionStateChecker.cancel(); lostConnectionStateChecker = null; } } finally { stateHandlerLock.unlock(); } }
Source:
protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslFactory != null) { InetSocketAddress peerAddress = ch.remoteAddress(); String peerHost = peerAddress.getHostName(); int peerPort = peerAddress.getPort(); SslHandler sslHandler = new SslHandler(sslFactory.createSSLEngine(peerHost, peerPort, SSLFactory.Mode.SERVER)); pipeline.addLast("SslHandler", sslHandler); } pipeline.addLast(Http2FrameCodecBuilder.forServer().initialSettings(Http2Settings.defaultSettings()).build()) .addLast("Http2MultiplexHandler", new Http2MultiplexHandler( new Http2StreamHandler(nettyMetrics, nettyConfig, performanceConfig, requestHandler))); }

Target:
protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("connectionStatsHandler", connectionStatsHandler); InetSocketAddress peerAddress = ch.remoteAddress(); String peerHost = peerAddress.getHostName(); int peerPort = peerAddress.getPort(); SslHandler sslHandler = new SslHandler(sslFactory.createSSLEngine(peerHost, peerPort, SSLFactory.Mode.SERVER)); pipeline.addLast("SslHandler", sslHandler); pipeline.addLast(Http2FrameCodecBuilder.forServer().initialSettings(Http2Settings.defaultSettings()).build()) .addLast("Http2MultiplexHandler", new Http2MultiplexHandler( new Http2StreamHandler(nettyMetrics, nettyConfig, performanceConfig, requestHandler))); }
Source:
public Response setBranchState(long branchUuid, BranchState newState) { BranchReadable branch = getBranchById(branchUuid); boolean modified = false; if (isDifferent(branch.getBranchState(), newState)) { activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format( "Branch Operation Branch State Changed {branchUUID: %s prevState: %s newState: %s accountId: %s serverId: %s clientId: %s}", branchUuid, branch.getBranchType(), newState, accountId, serverId, clientId)); Callable<?> op = getBranchOps().changeBranchState(branch, newState); executeCallable(op); modified = true; } return asResponse(modified); }

Target:
public Response setBranchState(long branchUuid, BranchState newState) { BranchReadable branch = getBranchById(branchUuid); boolean modified = false; if (isDifferent(branch.getBranchState(), newState)) { try { activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format( "Branch Operation Branch State Changed {branchUUID: %s prevState: %s newState: %s accountId: %s serverId: %s clientId: %s}", branchUuid, branch.getBranchType(), newState, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders), RestUtil.getClientId(httpHeaders))); } catch (OseeCoreException ex) { OseeLog.log(ActivityLog.class, OseeLevel.SEVERE_POPUP, ex); } Callable<?> op = getBranchOps().changeBranchState(branch, newState); executeCallable(op); modified = true; } return asResponse(modified); }
Source:
protected Optional<UniqueConstraint> getPrimaryKey(DatabaseMetaData metaData, String schema, String table) throws SQLException { ResultSet rs = metaData.getPrimaryKeys(null, schema, table); Map<Integer, String> keySeqColumnName = new HashMap<>(); String pkName = null; while (rs.next()) { String columnName = rs.getString("COLUMN_NAME"); pkName = rs.getString("PK_NAME"); int keySeq = rs.getInt("KEY_SEQ"); keySeqColumnName.put(keySeq - 1, columnName); } List<String> pkFields = Arrays.asList(new String[keySeqColumnName.size()]); keySeqColumnName.forEach(pkFields::set); if (!pkFields.isEmpty()) { if (pkName == null) { pkName = "pk_" + String.join("_", pkFields); } return Optional.of(UniqueConstraint.primaryKey(pkName, pkFields)); } else { return Optional.empty(); } }

Target:
protected Optional<UniqueConstraint> getPrimaryKey(DatabaseMetaData metaData, String schema, String table) throws SQLException { ResultSet rs = metaData.getPrimaryKeys(null, schema, table); Map<Integer, String> keySeqColumnName = new HashMap<>(); String pkName = null; while (rs.next()) { String columnName = rs.getString("COLUMN_NAME"); pkName = rs.getString("PK_NAME"); int keySeq = rs.getInt("KEY_SEQ"); keySeqColumnName.put(keySeq - 1, columnName); } List<String> pkFields = Arrays.asList(new String[keySeqColumnName.size()]); keySeqColumnName.forEach(pkFields::set); if (!pkFields.isEmpty()) { pkName = pkName != null ? pkName : "pk_" + String.join("_", pkFields); return Optional.of(UniqueConstraint.primaryKey(pkName, pkFields)); } return Optional.empty(); }
Source:
public static Collection<Object[]> runConfig() { return Arrays.asList(new Object[][] { { PARTITIONED, CacheAtomicityMode.ATOMIC, true }, { PARTITIONED, CacheAtomicityMode.ATOMIC, false }, { PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, true }, { PARTITIONED, CacheAtomicityMode.TRANSACTIONAL, false }, { REPLICATED, CacheAtomicityMode.ATOMIC, false }, { REPLICATED, CacheAtomicityMode.TRANSACTIONAL, false }, }); }

Target:
public static Collection<Object[]> runConfig() { return Arrays.asList(new Object[][] { {PARTITIONED, ATOMIC, true}, {PARTITIONED, ATOMIC, false}, {PARTITIONED, TRANSACTIONAL, true}, {PARTITIONED, TRANSACTIONAL, false}, {REPLICATED, ATOMIC, false}, {REPLICATED, TRANSACTIONAL, false}, }); }
Source:
public void testContainerSpecSerialization() { final ContainerSpec spec = new ContainerSpec(); spec.setId("id"); spec.setContainerName("name"); spec.setStatus(KieContainerStatus.STARTED); spec.setReleasedId(new ReleaseId("groupId", "artifactId", "1.0")); final ProcessConfig processConfig = new ProcessConfig("runtimeStrategy", "kBase", "kSession", "mergeMode"); spec.addConfig(Capability.PROCESS, processConfig); final RuleConfig ruleConfig = new RuleConfig(1l, KieScannerStatus.SCANNING); spec.addConfig(Capability.RULE, ruleConfig); final String specContent = client.serialize(spec); final ContainerSpec specResult = client.deserialize(specContent, ContainerSpec.class); assertNotNull(specResult); assertEquals(spec, specResult); assertEquals(spec.getId(), specResult.getId()); assertEquals(spec.getStatus(), specResult.getStatus()); assertEquals(spec.getContainerName(), specResult.getContainerName()); assertEquals(spec.getConfigs(), specResult.getConfigs()); assertEquals(spec.getReleasedId(), specResult.getReleasedId()); assertNotNull(specResult.getConfigs()); final ContainerConfig processConfigResult = specResult.getConfigs().get(Capability.PROCESS); assertNotNull(processConfigResult); assertTrue(processConfigResult instanceof ProcessConfig); assertEquals(processConfig, processConfigResult); final ContainerConfig ruleConfigResult = specResult.getConfigs().get(Capability.RULE); assertNotNull(ruleConfigResult); assertTrue(ruleConfigResult instanceof RuleConfig); assertEquals(ruleConfig, ruleConfigResult); }

Target:
public void testContainerSpecSerialization() { final ContainerSpec spec = new ContainerSpec(); spec.setId("id"); spec.setContainerName("name"); spec.setStatus(KieContainerStatus.STARTED); spec.setReleasedId(new ReleaseId("groupId", "artifactId", "1.0")); final ProcessConfig processConfig = new ProcessConfig("runtimeStrategy", "kBase", "kSession", "mergeMode"); spec.addConfig(Capability.PROCESS, processConfig); final RuleConfig ruleConfig = new RuleConfig(1L, KieScannerStatus.SCANNING); spec.addConfig(Capability.RULE, ruleConfig); final String specContent = client.serialize(spec); LOGGER.info("{} content\n{}", marshallingFormat.getType(), specContent); final ContainerSpec specResult = client.deserialize(specContent, ContainerSpec.class); assertNotNull(specResult); assertEquals(spec, specResult); assertEquals(spec.getId(), specResult.getId()); assertEquals(spec.getStatus(), specResult.getStatus()); assertEquals(spec.getContainerName(), specResult.getContainerName()); assertEquals(spec.getConfigs(), specResult.getConfigs()); assertEquals(spec.getReleasedId(), specResult.getReleasedId()); assertNotNull(specResult.getConfigs()); final ContainerConfig processConfigResult = specResult.getConfigs().get(Capability.PROCESS); assertNotNull(processConfigResult); assertTrue(processConfigResult instanceof ProcessConfig); assertEquals(processConfig, processConfigResult); final ContainerConfig ruleConfigResult = specResult.getConfigs().get(Capability.RULE); assertNotNull(ruleConfigResult); assertTrue(ruleConfigResult instanceof RuleConfig); assertEquals(ruleConfig, ruleConfigResult); }
Source:
protected synchronized long getRemoteServiceVersion() throws AlluxioStatusException { return retryRPC(() -> mVersionService.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(getRemoteServiceType()).build()) .getVersion(), LOG, "getRemoteServiceVersion", ""); }

Target:
protected long getRemoteServiceVersion() throws AlluxioStatusException { return retryRPC(() -> mVersionService.getServiceVersion( GetServiceVersionPRequest.newBuilder().setServiceType(getRemoteServiceType()).build()) .getVersion(), LOG, "getRemoteServiceVersion", ""); }
Source:
SpanHandlerImpl(final HandlerKey handlerKey, final int blockedItemsPerBatch, final Collection<SenderTask<String>> sendDataTasks, @Nonnull final ValidationConfiguration validationConfig, @Nullable final Consumer<Long> receivedRateSink, @Nullable final Logger blockedItemLogger, @Nullable final Logger validItemsLogger, @Nonnull final Supplier<Integer> dropSpansDelayedMinutes) { super(handlerKey, blockedItemsPerBatch, new SpanSerializer(), sendDataTasks, true, receivedRateSink, blockedItemLogger); this.validationConfig = validationConfig; this.validItemsLogger = validItemsLogger; this.dropSpansDelayedMinutes = dropSpansDelayedMinutes; this.spanTagCount = Metrics.defaultRegistry().newHistogram(new MetricName(handlerKey.toString(), "", "spanTagCount"), false); }

Target:
SpanHandlerImpl(final HandlerKey handlerKey, final int blockedItemsPerBatch, final Collection<SenderTask<String>> sendDataTasks, @Nonnull final ValidationConfiguration validationConfig, @Nullable final Consumer<Long> receivedRateSink, @Nullable final Logger blockedItemLogger, @Nullable final Logger validItemsLogger, @Nonnull final Supplier<Integer> dropSpansDelayedMinutes) { super(handlerKey, blockedItemsPerBatch, new SpanSerializer(), sendDataTasks, true, receivedRateSink, blockedItemLogger); this.validationConfig = validationConfig; this.validItemsLogger = validItemsLogger; this.dropSpansDelayedMinutes = dropSpansDelayedMinutes; this.receivedTagCount = Metrics.newHistogram(new MetricName(handlerKey.toString() + ".received", "", "tagCount"), false); }
Source:
public Optional<Map<String, Object>> getMetadata() { return metadata; }

Target:
public ExternalMetadata getMetadata() { return metadata; }
Source:
public NetSocket upgradeToSsl(String serverName, Handler<AsyncResult<Void>> handler) { ChannelOutboundHandler sslHandler = (ChannelOutboundHandler) chctx.pipeline().get("ssl"); if (sslHandler == null) { ChannelPromise p = chctx.newPromise(); chctx.pipeline().addFirst("handshaker", new SslHandshakeCompletionHandler(p)); p.addListener(future -> { if (handler != null) { AsyncResult<Void> res; if (future.isSuccess()) { res = Future.succeededFuture(); } else { res = Future.failedFuture(future.cause()); } context.dispatch(null, u -> handler.handle(res)); } }); if (remoteAddress != null) { sslHandler = new SslHandler(helper.createEngine(vertx, remoteAddress, serverName)); ((SslHandler) sslHandler).setHandshakeTimeout(helper.getSslHandshakeTimeout(), helper.getSslHandshakeTimeoutUnit()); } else { if (helper.isSNI()) { sslHandler = new SniHandler(helper.serverNameMapper(vertx)); } else { sslHandler = new SslHandler(helper.createEngine(vertx)); ((SslHandler) sslHandler).setHandshakeTimeout(helper.getSslHandshakeTimeout(), helper.getSslHandshakeTimeoutUnit()); } } chctx.pipeline().addFirst("ssl", sslHandler); } return this; }

Target:
public NetSocket upgradeToSsl(String serverName, Handler<AsyncResult<Void>> handler) { ChannelOutboundHandler sslHandler = (ChannelOutboundHandler) chctx.pipeline().get("ssl"); if (sslHandler == null) { ChannelPromise p = chctx.newPromise(); chctx.pipeline().addFirst("handshaker", new SslHandshakeCompletionHandler(p)); p.addListener(future -> { if (handler != null) { AsyncResult<Void> res; if (future.isSuccess()) { res = Future.succeededFuture(); } else { res = Future.failedFuture(future.cause()); } context.dispatch(res, handler); } }); if (remoteAddress != null) { sslHandler = new SslHandler(helper.createEngine(vertx, remoteAddress, serverName)); ((SslHandler) sslHandler).setHandshakeTimeout(helper.getSslHandshakeTimeout(), helper.getSslHandshakeTimeoutUnit()); } else { if (helper.isSNI()) { sslHandler = new SniHandler(helper.serverNameMapper(vertx)); } else { sslHandler = new SslHandler(helper.createEngine(vertx)); ((SslHandler) sslHandler).setHandshakeTimeout(helper.getSslHandshakeTimeout(), helper.getSslHandshakeTimeoutUnit()); } } chctx.pipeline().addFirst("ssl", sslHandler); } return this; }
Source:
public Mutation(Mutation m) { m.serialize(); this.row = m.row; this.data = m.data; this.size = new MutationSize(m.size.entries, m.size.sizeInBytes); this.values = m.values; this.replicationSources = m.replicationSources; }

Target:
public Mutation(Mutation m) { m.serialize(); this.row = m.row; this.data = m.data; this.entries = m.entries; this.values = m.values; this.replicationSources = m.replicationSources; }
Source:
private void updateConfiguration( Integer iops ) { long oldState; long newState; if ( iops == null || iops < 1 ) { do { oldState = stateUpdater.get( this ); int disabledCounter = getDisabledCounter( state ); disabledCounter |= 1; newState = composeState( disabledCounter, NO_LIMIT ); } while ( !stateUpdater.compareAndSet( this, oldState, newState ) ); } else { do { oldState = stateUpdater.get( this ); int disabledCounter = getDisabledCounter( state ); disabledCounter &= 0xFFFFFFFE; int iopq = iops / QUANTUMS_PER_SECOND; newState = composeState( disabledCounter, iopq ); } while ( !stateUpdater.compareAndSet( this, oldState, newState ) ); } }

Target:
private void updateConfiguration( Integer iops ) { long oldState; long newState; if ( iops == null || iops < 1 ) { do { oldState = stateUpdater.get( this ); int disabledCounter = getDisabledCounter( oldState ); disabledCounter |= 1; newState = composeState( disabledCounter, NO_LIMIT ); } while ( !stateUpdater.compareAndSet( this, oldState, newState ) ); } else { do { oldState = stateUpdater.get( this ); int disabledCounter = getDisabledCounter( oldState ); disabledCounter &= 0xFFFFFFFE; int iopq = iops / QUANTUMS_PER_SECOND; newState = composeState( disabledCounter, iopq ); } while ( !stateUpdater.compareAndSet( this, oldState, newState ) ); } }
Source:
public List<QualityProfile> load(String projectKey, @Nullable String profileName) { StringBuilder url = new StringBuilder(WS_URL + "?projectKey=" + encodeForUrl(projectKey)); if (profileName != null) { url.append("&profileName=").append(encodeForUrl(profileName)); } getOrganizationKey().ifPresent(k -> url.append("&organization=").append(encodeForUrl(k))); return call(url.toString()); }

Target:
public List<QualityProfile> load(String projectKey, @Nullable String profileName) { StringBuilder url = new StringBuilder(WS_URL + "?projectKey=").append(encodeForUrl(projectKey)); if (profileName != null) { url.append("&profileName=").append(encodeForUrl(profileName)); } getOrganizationKey().ifPresent(k -> url.append("&organization=").append(encodeForUrl(k))); return call(url.toString()); }
Source:
public boolean pollWhileWaitingForTaskCompletionWithDefaultTimeout(FutureVDSCall<?> task, Guid vdsId) { final long timeout = TimeUnit.MINUTES.toMillis(2); return pollWhileWaitingForTaskCompletion(task, vdsId, timeout); }

Target:
public boolean pollWhileWaitingForTaskCompletionWithDefaultTimeout(FutureVDSCall<?> task, Guid vdsId) { return pollWhileWaitingForTaskCompletion(task, vdsId, DEFAULT_TIMEOUT); }
Source:
void addSymbol(SymbolStyleSearchResult symbol) { this.symbols.add(symbol); notifyItemInserted(symbols.size() - 1); }

Target:
void addSymbol(SymbolStyleSearchResult symbol) { mSymbols.add(symbol); notifyItemInserted(mSymbols.size() - 1); }
Source:
protected final void initialize(final OrderBean bean, final Order order) { fillTotalPrice(bean, order); fillTotalItems(bean, order); fillLineItems(bean, order); fillTotalPrice(bean, order); fillSalesTax(bean, order); fillSubtotalPrice(bean, order); fillCustomerEmail(bean, order); fillShippingAddress(bean, order); fillBillingAddress(bean, order); fillShippingMethod(bean, order); fillPaymentDetails(bean, order); fillOrderDate(bean, order); fillOrderNumber(bean, order); }

Target:
protected final void initialize(final OrderBean bean, final Order order) { fillCartInfo(bean, order); fillOrderDate(bean, order); fillOrderNumber(bean, order); }
Source:
public SentryClient createSentryClient(Dsn dsn) { if (!checkPermission(Manifest.permission.INTERNET)) { Log.e(TAG, Manifest.permission.INTERNET + " is required to connect to the Sentry server," + " please add it to your AndroidManifest.xml"); } Log.d(TAG, "Sentry init with ctx='" + ctx.toString() + "' and dsn='" + dsn + "'"); String protocol = dsn.getProtocol(); if (!(protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https"))) { throw new IllegalArgumentException("Only 'http' or 'https' connections are supported in" + " Sentry Android, but received: " + protocol); } if ("false".equalsIgnoreCase(dsn.getOptions().get(DefaultSentryClientFactory.ASYNC_OPTION))) { throw new IllegalArgumentException("Sentry Android cannot use synchronous connections, remove '" + DefaultSentryClientFactory.ASYNC_OPTION + "=false' from your DSN."); } SentryClient sentryClient = super.createSentryClient(dsn); sentryClient.addBuilderHelper(new AndroidEventBuilderHelper(ctx)); SentryUncaughtExceptionHandler.setup(); return sentryClient; }

Target:
public SentryClient createSentryClient(Dsn dsn) { if (!checkPermission(Manifest.permission.INTERNET)) { Log.e(TAG, Manifest.permission.INTERNET + " is required to connect to the Sentry server," + " please add it to your AndroidManifest.xml"); } Log.d(TAG, "Sentry init with ctx='" + ctx.toString() + "' and dsn='" + dsn + "'"); String protocol = dsn.getProtocol(); if (!(protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https"))) { throw new IllegalArgumentException("Only 'http' or 'https' connections are supported in" + " Sentry Android, but received: " + protocol); } String async = dsn.getOptions().get(DefaultSentryClientFactory.ASYNC_OPTION); if (async != null && async.equalsIgnoreCase("false")) { throw new IllegalArgumentException("Sentry Android cannot use synchronous connections, remove '" + DefaultSentryClientFactory.ASYNC_OPTION + "=false' from your DSN."); } SentryClient sentryClient = super.createSentryClient(dsn); sentryClient.addBuilderHelper(new AndroidEventBuilderHelper(ctx)); SentryUncaughtExceptionHandler.setup(); return sentryClient; }
Source:
public Map<String, Serializable> getStringSerializableMap(SchedulingService service, TaskTerminationData taskToTerminate) throws IOException, ClassNotFoundException { Map<String, Serializable> variables = new HashMap<>(); RunningTaskData taskData = taskToTerminate.taskData; TaskResultImpl taskResult = taskToTerminate.taskResult; InternalJob internalJob = taskToTerminate.internalJob; if (!taskToTerminate.normalTermination || taskResult == null) { List<InternalTask> iDependences = taskData.getTask().getIDependences(); if (iDependences != null) { List<TaskId> parentIds = new ArrayList<>(iDependences.size()); for (int i = 0; i < iDependences.size(); i++) { parentIds.add(iDependences.get(i).getId()); } Map<TaskId, TaskResult> taskResults = service.getInfrastructure().getDBManager() .loadTasksResults( taskData.getTask().getJobId(), parentIds); for (TaskResult currentTaskResult : taskResults.values()) { if (currentTaskResult.getPropagatedVariables() != null) { variables.putAll(SerializationUtil.deserializeVariableMap(currentTaskResult.getPropagatedVariables())); } } } else { if(internalJob!=null) variables.putAll(internalJob.getVariables()); } variables.put(SchedulerVars.PA_TASK_SUCCESS.toString(),Boolean.toString(false)); } else if (taskResult.hadException()) { variables = SerializationUtil.deserializeVariableMap(taskResult.getPropagatedVariables()); variables.put(SchedulerVars.PA_TASK_SUCCESS.toString(),Boolean.toString(false)); } else { variables = SerializationUtil.deserializeVariableMap(taskResult.getPropagatedVariables()); variables.put(SchedulerVars.PA_TASK_SUCCESS.toString(), Boolean.toString(true)); } return variables; }

Target:
public Map<String, Serializable> getStringSerializableMap(SchedulingService service, TaskTerminationData taskToTerminate) throws Exception { Map<String, Serializable> variables = new HashMap<>(); RunningTaskData taskData = taskToTerminate.taskData; TaskResultImpl taskResult = taskToTerminate.taskResult; InternalJob internalJob = taskToTerminate.internalJob; if (!taskToTerminate.normalTermination || taskResult == null) { List<InternalTask> iDependences = taskData.getTask().getIDependences(); if (iDependences != null) { List<TaskId> parentIds = new ArrayList<>(iDependences.size()); for (int i = 0; i < iDependences.size(); i++) { parentIds.add(iDependences.get(i).getId()); } Map<TaskId, TaskResult> taskResults = service.getInfrastructure().getDBManager() .loadTasksResults( taskData.getTask().getJobId(), parentIds); getResultsFromListOfTaskResults(variables, taskResults); } else { if(internalJob!=null) variables.putAll(internalJob.getVariables()); } variables.put(SchedulerVars.PA_TASK_SUCCESS.toString(),Boolean.toString(false)); } else if (taskResult.hadException()) { variables = fillMapWithTaskResult(taskResult,false); } else { variables = fillMapWithTaskResult(taskResult,true); } return variables; }
Source:
public boolean allTypes(InputObjectState foundTypes) throws ObjectStoreException { if (tsLogger.logger.isTraceEnabled()) { tsLogger.logger.trace("SlotStore.allTypes()"); } String[] knownTypes = store.getKnownTypes(); Set<String> typeSet = new HashSet<>(); if (knownTypes == null || knownTypes.length == 0) { return true; } OutputObjectState buffer = new OutputObjectState(); try { for (String typeName : knownTypes) { if (typeName == null) { continue; } if (typeName.startsWith("/")) { typeName = typeName.substring(1); } if (typeName.contains("/")) { String value = ""; String[] parents = typeName.split("/"); for (String parent : parents) { if (parent.length() == 0) { continue; } if (value.length() > 0) { value = value + "/"; } value = value + parent; if (!typeSet.contains(value)) { typeSet.add(value); buffer.packString(value); } } } else { buffer.packString(typeName); } } buffer.packString(""); } catch (IOException e) { throw new ObjectStoreException(e); } foundTypes.setBuffer(buffer.buffer()); return true; }

Target:
public boolean allTypes(InputObjectState foundTypes) throws ObjectStoreException { if (tsLogger.logger.isTraceEnabled()) { tsLogger.logger.trace("SlotStore.allTypes()"); } String[] knownTypes = store.getKnownTypes(); Set<String> typeSet = new HashSet<>(); if (knownTypes == null || knownTypes.length == 0) { return true; } OutputObjectState buffer = new OutputObjectState(); try { for (String typeName : knownTypes) { if (typeName.startsWith("/")) { typeName = typeName.substring(1); } if (typeName.contains("/")) { String value = ""; String[] parents = typeName.split("/"); for (String parent : parents) { if (parent.length() == 0) { continue; } if (value.length() > 0) { value = value + "/"; } value = value + parent; if (!typeSet.contains(value)) { typeSet.add(value); buffer.packString(value); } } } else { buffer.packString(typeName); } } buffer.packString(""); } catch (IOException e) { throw new ObjectStoreException(e); } foundTypes.setBuffer(buffer.buffer()); return true; }
Source:
public static void getPropertyValues(Object obj, Set<String> properties, Map<String, String> values) { try { PropertyDescriptor[] pds = Introspector.getBeanInfo(obj.getClass()).getPropertyDescriptors(); int hitCount = 0; for (PropertyDescriptor pd : pds) { String propertyName = pd.getName().toLowerCase(); if (properties.contains(propertyName) && !values.containsKey(propertyName)) { Object value = null; hitCount++; try { value = pd.getReadMethod().invoke(obj); String stringValue = value != null ? value.toString() : null; values.put(propertyName, stringValue); } catch (Exception e) { log.warn("Unable to get value of property: " + pd.getDisplayName() + " for class " + obj.getClass().getName()); } if (hitCount == properties.size()) { break; } } } } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public static void getPropertyValues(Object obj, Set<String> properties, Map<String, String> values) { try { PropertyDescriptor[] pds = Introspector.getBeanInfo(obj.getClass()).getPropertyDescriptors(); int hitCount = 0; hitCount = values.size(); for (PropertyDescriptor pd : pds) { String propertyName = pd.getName().toLowerCase(); if (properties.contains(propertyName) && !values.containsKey(propertyName)) { Object value = null; hitCount++; try { value = pd.getReadMethod().invoke(obj); String stringValue = value != null ? value.toString() : null; values.put(propertyName, stringValue); } catch (Exception e) { log.warn("Unable to get value of property: " + pd.getDisplayName() + " for class " + obj.getClass().getName()); } if (hitCount == properties.size()) { break; } } } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public PagedResources<ScheduleInfoResource> list( PagedResourcesAssembler<ScheduleInfo> assembler) { List<ScheduleInfo> result = this.schedulerService.list(); Pageable pageable = new PageRequest(0, result.size()); Page<ScheduleInfo> page = new PageImpl<>(result, pageable, result.size()); return assembler.toResource(page, taskAssembler); }

Target:
public PagedResources<ScheduleInfoResource> list( PagedResourcesAssembler<ScheduleInfo> assembler) { List<ScheduleInfo> result = this.schedulerService.list(); int resultSize = result.size(); Pageable pageable = new PageRequest(0, (resultSize == 0) ? resultSize = 1 : resultSize); Page<ScheduleInfo> page = new PageImpl<>(result, pageable, result.size()); return assembler.toResource(page, taskAssembler); }
Source:
private void showPurchasesOrDeleteSiteDialog(JSONObject response, final Blog currentBlog) { try { JSONArray purchases = response.getJSONArray(PURCHASE_ORIGINAL_RESPONSE_KEY); if (hasActivePurchases(purchases)) { showPurchasesDialog(currentBlog); } else { showDeleteSiteDialog(); } } catch (JSONException e) { AppLog.e(AppLog.T.API, e.toString()); } }

Target:
private void showPurchasesOrDeleteSiteDialog(JSONObject response, final Blog currentBlog) { try { JSONArray purchases = response.getJSONArray(PURCHASE_ORIGINAL_RESPONSE_KEY); if (hasActivePurchases(purchases)) { showPurchasesDialog(currentBlog); } else { showDeleteSiteDialog(); } } catch (JSONException e) { AppLog.e(AppLog.T.API, "Error occurred while trying to delete site: " + e.toString()); } }
Source:
public static void start() { loggingDir = new File(Constants.RESOURCES_DIR + Constants.LOGGER_DIR); if (loggingDir.exists() == false) { loggingDir.mkdir(); } try { Date currentDate = new Date(); SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM.dd-hh-mm-ss"); String desiredFileName = "Session-" + simpleFormat.format(currentDate) + ".log"; loggingFile = new File(Constants.RESOURCES_DIR + Constants.LOGGER_DIR + desiredFileName); BufferedWriter buffWriter = new BufferedWriter(new FileWriter(loggingFile)); buffWriter.write("SCRUMBLEDORE LOGGING FILE"); buffWriter.close(); } catch (IOException e) { System.out.println(e); } }

Target:
public static void start() { loggingDir = new File(Constants.RESOURCES_DIR + Constants.LOGGER_DIR); if (loggingDir.exists() == false) { loggingDir.mkdir(); } try { Date currentDate = new Date(); SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM.dd-hh-mm-ss"); String desiredFileName = "Session-" + simpleFormat.format(currentDate) + ".log"; loggingFile = new File(Constants.RESOURCES_DIR + Constants.LOGGER_DIR + desiredFileName); BufferedWriter buffWriter = new BufferedWriter(new FileWriter(loggingFile)); buffWriter.write("SCRUMBLEDORE LOGGING FILE"); buffWriter.close(); } catch (IOException e) { System.out.println(e); } started = true; }
Source:
private static boolean isFixedLength(int typeID) { int varLengthBit = typeID & FLAG_UNKNOWN_SIZE; return varLengthBit == 0; }

Target:
private static boolean isFixedLength(int typeID) { return (typeID & FLAG_UNKNOWN_SIZE) == 0; }
Source:
public CheckEditPartResized(SWTBotGefEditPart editPartBot) { this.graphicalEditPart = (GraphicalEditPart) editPartBot.part(); this.initialSize = graphicalEditPart.getFigure().getBounds().getSize().getCopy(); }

Target:
public CheckEditPartResized(SWTBotGefEditPart editPartBot) { this((GraphicalEditPart) editPartBot.part()); }
Source:
public List<ObjectId> lookUp(final String partialId) { Preconditions.checkNotNull(partialId); byte[] raw = ObjectId.toRaw(partialId); List<ObjectId> baseResults = lookUpInternal(raw); if (partialId.length() % 2 != 0) { Iterator<ObjectId> listIterator = baseResults.iterator(); while (listIterator.hasNext()) { ObjectId result = listIterator.next(); if (!result.toString().contains(partialId)) { listIterator.remove(); } } } return baseResults; }

Target:
public List<ObjectId> lookUp(final String partialId) { Preconditions.checkNotNull(partialId); byte[] raw = ObjectId.toRaw(partialId); List<ObjectId> baseResults = lookUpInternal(raw); if (partialId.length() % 2 != 0) { Iterator<ObjectId> listIterator = baseResults.iterator(); while (listIterator.hasNext()) { ObjectId result = listIterator.next(); if (!result.toString().startsWith(partialId)) { listIterator.remove(); } } } return baseResults; }
Source:
public void initialize() { Map<String, String> properties = editProperties(); if (!super.configure()) { return; } if (getThing().getStatus() == ThingStatus.OFFLINE) { return; } sensors.add(new DS18x20(sensorIds.get(0), this)); if (!properties.containsKey(PROPERTY_MODELID)) { scheduler.execute(() -> { updateSensorProperties(); }); return; } else { scheduler.execute(() -> { configureThingChannels(); }); return; } }

Target:
public void initialize() { Map<String, String> properties = editProperties(); if (!super.configure()) { return; } if (getThing().getStatus() == ThingStatus.OFFLINE) { return; } sensors.add(new DS18x20(sensorIds.get(0), this)); if (!properties.containsKey(PROPERTY_MODELID)) { scheduler.execute(() -> { updateSensorProperties(); }); } else { scheduler.execute(() -> { configureThingChannels(); }); } }
Source:
SweepOutcomeMetrics() { Arrays.stream(SweepOutcome.values()).forEach(outcome -> metricsManager.registerMetric(BackgroundSweeperImpl.class, outcome.name(), () -> getCount(outcome)) ); }

Target:
SweepOutcomeMetrics() { Arrays.stream(SweepOutcome.values()).forEach(outcome -> metricsManager.registerMetric(BackgroundSweeperImpl.class, outcome.name(), () -> getOutcomeCount(outcome)) ); reservoir = new SlidingTimeWindowReservoir(60L, TimeUnit.SECONDS); }
Source:
public DigipostClientMock() { URI host = URI.create("http://localhost:" + PORT); HttpClientBuilder httpClientBuilder = DigipostHttpClientFactory.createBuilder(DigipostHttpClientSettings.DEFAULT.timeouts(DEFAULT_TIMEOUTS_MS.all(0))); apiService = new ApiServiceImpl(httpClientBuilder, PORT, null, host, null); apiService.buildApacheHttpClientBuilder(); client = new DigipostClient(newBuilder().build(), "digipostmock-url", 1, new Signer() { @Override public byte[] sign(String dataToSign) { return new byte[0]; } }, apiService); }

Target:
public DigipostClientMock() { this(UnaryOperator.identity()); }
Source:
protected void beforeInvocation() throws Exception { ActionContext.bound(invocation.getInvocationContext()); }

Target:
protected void beforeInvocation() throws Exception { ActionContext.bind(invocation.getInvocationContext()); }
Source:
public MovePath addStep(final MoveStepType type) { BulldozerMovePath mp = (BulldozerMovePath) super.addStep(type); IHex hex = mp.getGame().getBoard().getHex(mp.getFinalCoords()); int hexWaterDepth = (hex != null) && hex.containsTerrain(Terrains.WATER) ? hex.depth() : Integer.MIN_VALUE; if (!mp.isMoveLegal() && !mp.isJumping()) { int levelingCost = calculateLevelingCost(mp.getFinalCoords(), getEntity()); if(levelingCost > CANNOT_LEVEL) { coordLevelingCosts.put(mp.getFinalCoords(), levelingCost); coordsToLevel.add(mp.getFinalCoords()); } if(hexWaterDepth > 0) { MovementType mType = MovementType.getMovementType(mp.getEntity()); if(mType == MovementType.Walker || mType == MovementType.WheeledAmphi || mType == MovementType.TrackedAmphi) { additionalCosts.put(mp.getFinalCoords(), 1); } } } if (mp.isJumping()) { if ((hex != null) && !hex.containsTerrain(Terrains.BRIDGE)) { if (hexWaterDepth == 1) { additionalCosts.put(mp.getFinalCoords(), mp.getCachedEntityState().getJumpMP() - mp.getCachedEntityState().getTorsoJumpJets()); } else if (hexWaterDepth > 1) { additionalCosts.put(mp.getFinalCoords(), mp.getCachedEntityState().getJumpMP()); } } } return mp; }

Target:
public MovePath addStep(final MoveStepType type) { BulldozerMovePath mp = (BulldozerMovePath) super.addStep(type); IHex hex = mp.getGame().getBoard().getHex(mp.getFinalCoords()); int hexWaterDepth = ((hex != null) && hex.containsTerrain(Terrains.WATER)) ? hex.depth() : Integer.MIN_VALUE; if (!mp.isMoveLegal() && !mp.isJumping()) { int levelingCost = calculateLevelingCost(mp.getFinalCoords(), getEntity()); if(levelingCost > CANNOT_LEVEL) { coordLevelingCosts.put(mp.getFinalCoords(), levelingCost); coordsToLevel.add(mp.getFinalCoords()); } if(hexWaterDepth > 0) { MovementType mType = MovementType.getMovementType(mp.getEntity()); if(mType == MovementType.Walker || mType == MovementType.WheeledAmphi || mType == MovementType.TrackedAmphi) { additionalCosts.put(mp.getFinalCoords(), 1); } } } if (mp.isJumping()) { if ((hex != null) && !hex.containsTerrain(Terrains.BRIDGE)) { if (hexWaterDepth == 1) { additionalCosts.put(mp.getFinalCoords(), mp.getCachedEntityState().getJumpMP() - mp.getCachedEntityState().getTorsoJumpJets()); } else if (hexWaterDepth > 1) { additionalCosts.put(mp.getFinalCoords(), mp.getCachedEntityState().getJumpMP()); } } } return mp; }
Source:
public void testGetApiMetaDataWithTokenCredentialsAuth() { KeystoneApi api = requestsSendResponses( keystoneAuthWithTokenAndTenantName, responseWithKeystoneAccess, HttpRequest.builder().method("GET").endpoint(endpoint + "/v2.0/"). addHeader("Accept", APPLICATION_JSON).build(), HttpResponse.builder().statusCode(200). payload(payloadFromResourceWithContentType("/raxVersion.json", APPLICATION_JSON)).build()); ApiMetadata metadata = api.getApiMetadata(); assertEquals(metadata, new ParseRackspaceApiMetadataTest().expected()); }

Target:
public void testGetApiMetaDataWithTokenCredentialsAuth() { ParseRackspaceApiMetadataTest test = new ParseRackspaceApiMetadataTest(); KeystoneApi api = requestsSendResponses( keystoneAuthWithTokenAndTenantName, responseWithKeystoneAccess, HttpRequest.builder().method("GET").endpoint(endpoint + "/v2.0/"). addHeader("Accept", APPLICATION_JSON).build(), HttpResponse.builder().statusCode(200). payload(payloadFromResourceWithContentType(test.resource(), APPLICATION_JSON)).build()); ApiMetadata metadata = api.getApiMetadata(); assertEquals(metadata, test.expected()); }