auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static File extract(@NonNull String libResPath, @NonNull String targetDir) throws Exception { final File targetFile = new File(targetDir, new File(libResPath).getName()); if (targetFile.exists()) { return targetFile; } final File dir = new File(targetDir); if (!dir.mkdirs() && !dir.exists()) { throw new IOException("Cannot create target directory: " + dir.getAbsolutePath()); } InputStream in = null; FileOutputStream out = null; try { in = NativeLibrary.class.getResourceAsStream(libResPath); if (in == null) { throw new IOException("Native library not found at " + libResPath); } out = new FileOutputStream(targetFile); final byte[] buffer = new byte[1024]; int bytesRead = 0; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } if (out != null) { try { out.close(); } catch (IOException e) { } } } if (!System.getProperty("os.name").toLowerCase().contains("windows")) { Runtime.getRuntime().exec(new String[] {"chmod", "755", targetFile.getAbsolutePath()}).waitFor(); } return targetFile; }

Target:
private static File extract(@NonNull String libResPath, @NonNull String targetDir) throws IOException, InterruptedException { final File targetFile = new File(targetDir, new File(libResPath).getName()); if (targetFile.exists()) { return targetFile; } final File dir = new File(targetDir); if (!dir.mkdirs() && !dir.exists()) { throw new IOException("Cannot create target directory: " + dir.getAbsolutePath()); } InputStream in = null; FileOutputStream out = null; try { in = NativeLibrary.class.getResourceAsStream(libResPath); if (in == null) { throw new IOException("Native library not found at " + libResPath); } out = new FileOutputStream(targetFile); final byte[] buffer = new byte[1024]; int bytesRead = 0; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } if (out != null) { try { out.close(); } catch (IOException e) { } } } if (!System.getProperty("os.name").toLowerCase().contains("windows")) { Runtime.getRuntime().exec(new String[] {"chmod", "755", targetFile.getAbsolutePath()}).waitFor(); } return targetFile; }
Source:
public void enqueue(Lifespan lifespan, int partition, List<SerializedPage> pages) { requireNonNull(lifespan, "lifespan is null"); checkState(partition == 0, "Expected partition number to be zero"); checkState(lifespanCompletionCallback != null, "lifespanCompletionCallback has to be set before starting enqueue data"); enqueue(lifespan, pages); }

Target:
public void enqueue(Lifespan lifespan, int partition, List<SerializedPage> pages) { checkState(partition == 0, "Expected partition number to be zero"); enqueue(lifespan, pages); }
Source:
public void testFilePageStoreManagerShouldThrowExceptionWhenFactoryClassCannotBeLoaded() throws Exception { String instanceName = getTestIgniteInstanceName(0); ClassLoader externalClsLdr = getExternalClassLoader(); IgniteConfiguration cfg = optimize(getConfiguration(instanceName)); cfg.setCacheConfiguration(getCacheConfiguration(externalClsLdr)); cfg.setClassLoader(externalClsLdr); IgniteEx ignite = (IgniteEx)startGrid(instanceName, cfg, null); ignite.cluster().active(true); ignite.context().config().setClassLoader(U.gridClassLoader()); GridCacheSharedContext sharedCtx = ignite.context().cache().context(); FilePageStoreManager pageStore = (FilePageStoreManager)sharedCtx.pageStore(); assertNotNull(pageStore); Throwable e = GridTestUtils.assertThrowsWithCause((Callable<Void>)() -> { pageStore.readCacheConfigurations(); return null; }, ClassNotFoundException.class); assertNotNull(e); assertTrue(e.getMessage().startsWith(ERR_MESSAGE)); }

Target:
public void testFilePageStoreManagerShouldThrowExceptionWhenFactoryClassCannotBeLoaded() throws Exception { withFactory = true; IgniteEx ignite = (IgniteEx)startGrid(); ignite.cluster() .active(true); IgniteCache<Integer, String> cache = ignite.cache(TEST_CACHE); cache.put(1, "test value"); GridCacheSharedContext sharedCtx = ignite.context().cache().context(); FilePageStoreManager pageStore = (FilePageStoreManager)sharedCtx.pageStore(); assertNotNull(pageStore); File cacheData = new File( pageStore.cacheWorkDir(ignite.context().cache().cacheConfiguration(TEST_CACHE)), CACHE_DATA_FILENAME ); assertTrue(cacheData.exists()); stopGrid(); withFactory = false; GridTestUtils.assertThrowsAnyCause( new NullLogger(), this::startGrid, IgniteCheckedException.class, "An error occurred during cache configuration loading from file" ); assertTrue(cacheData.delete()); ignite = (IgniteEx)startGrid(); ignite.cluster() .active(true); cache = ignite.cache(TEST_CACHE); assertEquals("test value", cache.get(1)); }
Source:
static List<TypeName> list(Type[] types) { List<TypeName> result = new ArrayList<>(types.length); for (int i = 0; i < types.length; i++) { result.add(get(types[i])); } return result; }

Target:
static List<TypeName> list(Type[] types) { List<TypeName> result = new ArrayList<>(types.length); for (Type type : types) { result.add(get(type)); } return result; }
Source:
public static final void checkJVMVersion() { String jvmVersionRegex = System.getProperty("test.jvm.version.regex"); if (jvmVersionRegex != null) { if (!System.getProperty("java.version").matches(jvmVersionRegex)) { System.err.printf("JVM version '%s' does not match '%s'\n", System.getProperty("java.version"), jvmVersionRegex); System.exit(1); } } }

Target:
public static final void checkJVMVersion() { String jvmVersionRegex = System.getProperty("infinispan.test.jvm.version.regex"); if (jvmVersionRegex != null) { if (!System.getProperty("java.version").matches(jvmVersionRegex)) { String message = String.format("JVM version '%s' does not match '%s'\n", System.getProperty("java.version"), jvmVersionRegex); throw new RuntimeException(message); } } }
Source:
@Override public String getContext() { String contextName = String.valueOf(execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE).getValue()); if ("null".equalsIgnoreCase(String.valueOf(contextName))) { return null; } return contextName; }

Target:
@Override public String getContext() { String contextName = String.valueOf(execute(DriverCommand.GET_CURRENT_CONTEXT_HANDLE).getValue()); if ("null".equalsIgnoreCase(contextName)) { return null; } return contextName; }
Source:
public String substitute(Function<SqlNode, String> fn) { final SqlShuttle shuttle = new SqlShuttle() { @Override public SqlNode visit(SqlIdentifier id) { if (id.isStar()) { return id; } final SqlIdentifier toReplace = identifiersMap.get(id.getParserPosition()); if (toReplace != null && id.names.size() >= toReplace.names.size()) { return id; } return toReplace; } }; final SqlNode substituted = this.oriNode.accept(shuttle); return fn.apply(substituted); }

Target:
public String substitute(Function<SqlNode, String> fn) { final SqlShuttle shuttle = new SqlShuttle() { @Override public SqlNode visit(SqlCall call) { SqlOperator operator = call.getOperator(); if (operator instanceof SqlUnresolvedFunction) { final SqlUnresolvedFunction unresolvedFunction = (SqlUnresolvedFunction) operator; final SqlIdentifier functionID = unresolvedFunction.getSqlIdentifier(); if (functionID.isSimple() && funcNameToId.containsKey(functionID.getSimple())) { SqlUnresolvedFunction newFunc = new SqlUnresolvedFunction( funcNameToId.get(functionID.getSimple()), unresolvedFunction.getReturnTypeInference(), unresolvedFunction.getOperandTypeInference(), unresolvedFunction.getOperandTypeChecker(), unresolvedFunction.getParamTypes(), unresolvedFunction.getFunctionType()); return newFunc.createCall( call.getFunctionQuantifier(), call.getParserPosition(), call.getOperandList().toArray(new SqlNode[0])); } } return super.visit(call); } @Override public SqlNode visit(SqlIdentifier id) { if (id.isStar()) { return id; } final SqlIdentifier toReplace = identifiersMap.get(id.getParserPosition()); if (toReplace == null || id.names.size() >= toReplace.names.size()) { return id; } return toReplace; } }; final SqlNode substituted = this.oriNode.accept(shuttle); return fn.apply(substituted); }
Source:
public void findOneTest() throws Exception { context.turnOffAuthorisationSystem(); ePersonService.setPassword(eperson, password); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(get("/api/eperson/epersons/" + admin.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", is( EPersonMatcher.matchEPersonOnEmail(admin.getEmail() ) ))); }

Target:
public void findOneTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson ePerson = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); EPerson ePerson2 = EPersonBuilder.createEPerson(context) .withNameInMetadata("Jane", "Smith") .withEmail("janesmith@fake-email.com") .build(); String authToken = getAuthToken(admin.getEmail(), password); getClient(authToken).perform(get("/api/eperson/epersons/" + ePerson2.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", is( EPersonMatcher.matchEPersonEntry(ePerson2) ))) .andExpect(jsonPath("$", Matchers.not( is( EPersonMatcher.matchEPersonEntry(ePerson) ) ))); }
Source:
public ActionConfigurationBuilder addKeySequenceFor(Action action, String... sequences) { verifyActionExists(action); final Set<KeyStroke> keyStrokes = new LinkedHashSet<KeyStroke>(); try { for (final String sequence : sequences) { keyStrokes.add(KeyStroke.getInstance(sequence)); } } catch (final ParseException ex) { throw new IllegalArgumentException("Invalid key sequence"); } addKeyStrokeFor(action, keyStrokes.toArray(new KeyStroke[] {})); return this; }

Target:
public ActionConfigurationBuilder addKeySequenceFor(Action action, String... sequences) { verifyActionExists(action); final Set<KeyStroke> strokes = new LinkedHashSet<KeyStroke>(); try { for (final String sequence : sequences) { strokes.add(KeyStroke.getInstance(sequence)); } } catch (final ParseException ex) { throw new IllegalArgumentException("Invalid key sequence"); } addKeyStrokeFor(action.getId(), strokes.toArray(new KeyStroke[] {})); return this; }
Source:
public void completesTerminationFutureIfActorStops() { final ActorSystem actorSystem = actorSystemResource.getActorSystem(); final ActorRef supervisor = SupervisorActor.startSupervisorActor(actorSystem, actorSystem.getDispatcher()); final SupervisorActor.StartAkkaRpcActorResponse startResponse = SupervisorActor.startAkkaRpcActor( supervisor, terminationFuture -> Props.create(SimpleActor.class, terminationFuture), "foobar"); final SupervisorActor.ActorRegistration actorRegistration = startResponse.orElseThrow(cause -> new AssertionError("Expected the start to succeed.", cause)); final CompletableFuture<Void> terminationFuture = actorRegistration.getTerminationFuture(); assertThat(terminationFuture.isDone(), is(false)); actorRegistration.getActorRef().tell(TerminateWithFutureCompletion.normal(), ActorRef.noSender()); terminationFuture.join(); }

Target:
public void completesTerminationFutureIfActorStops() { final ActorSystem actorSystem = actorSystemResource.getActorSystem(); final ActorRef supervisor = SupervisorActor.startSupervisorActor(actorSystem, actorSystem.getDispatcher()); final SupervisorActor.ActorRegistration actorRegistration = startAkkaRpcActor(supervisor, "foobar"); final CompletableFuture<Void> terminationFuture = actorRegistration.getTerminationFuture(); assertThat(terminationFuture.isDone(), is(false)); actorRegistration.getActorRef().tell(TerminateWithFutureCompletion.normal(), ActorRef.noSender()); terminationFuture.join(); }
Source:
public synchronized void updateSubscription(Subscription newSubscription) { boolean endpointUpdated = !this.subscription.getEndpoint().equals(newSubscription.getEndpoint()); boolean subscriptionPolicyUpdated = !Objects.equals(this.subscription.getSerialSubscriptionPolicy(), newSubscription.getSerialSubscriptionPolicy()); if (requestTimeoutMs != newSubscription.getSerialSubscriptionPolicy().getRequestTimeout()) { requestTimeoutMs = newSubscription.getSerialSubscriptionPolicy().getRequestTimeout(); } this.subscription = newSubscription; if (endpointUpdated || subscriptionPolicyUpdated) { this.messageSender = messageSenderFactory.create(newSubscription); } }

Target:
public synchronized void updateSubscription(Subscription newSubscription) { boolean endpointUpdated = !this.subscription.getEndpoint().equals(newSubscription.getEndpoint()); boolean subscriptionPolicyUpdated = !Objects.equals(this.subscription.getSerialSubscriptionPolicy(), newSubscription.getSerialSubscriptionPolicy()); this.requestTimeoutMs = newSubscription.getSerialSubscriptionPolicy().getRequestTimeout(); this.subscription = newSubscription; if (endpointUpdated || subscriptionPolicyUpdated) { this.messageSender = messageSenderFactory.create(newSubscription); } }
Source:
public void testEmptyHostConfig() throws Exception { String line = "embed-host-controller --std-out=echo --host-config=host-empty-cli.xml --domain-config=domain-cli.xml --empty-host-config" + JBOSS_HOME; cli.sendLine(line); cli.sendLine("ls /host"); CLIOpResult result = cli.readAllAsOpResult(); ModelNode mn = result.getResponseNode(); assertNull(mn); cli.sendLine("ls /host=foo", true); final String output = cli.readOutput(); assertEquals("WFLYDC0033: Operation targets host foo but that host is not registered", output); assertTrue(cli.isConnected()); cli.sendLine(":read-children-names(child-type=host)"); result = cli.readAllAsOpResult(); mn = result.getResponseNode(); assertEquals(SUCCESS, mn.get(OUTCOME).asString()); assertEquals(0, mn.get(RESULT).asList().size()); assertTrue(cli.isConnected()); }

Target:
public void testEmptyHostConfig() throws Exception { String line = "embed-host-controller --std-out=echo --host-config=host-empty-cli.xml --domain-config=domain-cli.xml --empty-host-config" + JBOSS_HOME; cli.sendLine(line); cli.sendLine("ls /host"); CLIOpResult result = cli.readAllAsOpResult(); ModelNode mn = result.getResponseNode(); assertNull(mn); cli.sendLine("ls /host=foo", true); final String output = cli.readOutput(); assertTrue(output.startsWith("WFLYDC0033:")); assertTrue(cli.isConnected()); cli.sendLine(":read-children-names(child-type=host)"); result = cli.readAllAsOpResult(); mn = result.getResponseNode(); assertEquals(SUCCESS, mn.get(OUTCOME).asString()); assertEquals(0, mn.get(RESULT).asList().size()); assertTrue(cli.isConnected()); }
Source:
protected String signJWTWithRSA(JWTClaimsSet jwtClaimsSet, OAuthTokenReqMessageContext request) throws IdentityOAuth2Exception { try { String tenantDomain = request.getOauth2AccessTokenReqDTO().getTenantDomain(); if (tenantDomain == null) { tenantDomain = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } int tenantId = OAuth2Util.getTenantId(tenantDomain); Key privateKey; if (!(privateKeys.containsKey(tenantId))) { KeyStoreManager tenantKSM = KeyStoreManager.getInstance(tenantId); if (!tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) { String ksName = tenantDomain.trim().replace(".", "-"); String jksName = ksName + ".jks"; privateKey = tenantKSM.getPrivateKey(jksName, tenantDomain); } else { try { privateKey = tenantKSM.getDefaultPrivateKey(); } catch (Exception e) { throw new IdentityOAuth2Exception("Error while obtaining private key for super tenant", e); } } privateKeys.put(tenantId, privateKey); } else { privateKey = privateKeys.get(tenantId); } JWSSigner signer = new RSASSASigner((RSAPrivateKey) privateKey); SignedJWT signedJWT = new SignedJWT(new JWSHeader((JWSAlgorithm) signatureAlgorithm), jwtClaimsSet); signedJWT.sign(signer); return signedJWT.serialize(); } catch (JOSEException e) { throw new IdentityOAuth2Exception("Error occurred while signing JWT", e); } }

Target:
protected String signJWTWithRSA(JWTClaimsSet jwtClaimsSet, OAuthTokenReqMessageContext request) throws IdentityOAuth2Exception { try { String tenantDomain = request.getAuthorizedUser().getTenantDomain(); int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); Key privateKey; if (!(privateKeys.containsKey(tenantId))) { KeyStoreManager tenantKSM = KeyStoreManager.getInstance(tenantId); if (!tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) { String ksName = tenantDomain.trim().replace(".", "-"); String jksName = ksName + ".jks"; privateKey = tenantKSM.getPrivateKey(jksName, tenantDomain); } else { try { privateKey = tenantKSM.getDefaultPrivateKey(); } catch (Exception e) { throw new IdentityOAuth2Exception("Error while obtaining private key for super tenant", e); } } privateKeys.put(tenantId, privateKey); } else { privateKey = privateKeys.get(tenantId); } JWSSigner signer = new RSASSASigner((RSAPrivateKey) privateKey); SignedJWT signedJWT = new SignedJWT(new JWSHeader((JWSAlgorithm) signatureAlgorithm), jwtClaimsSet); signedJWT.sign(signer); return signedJWT.serialize(); } catch (JOSEException e) { throw new IdentityOAuth2Exception("Error occurred while signing JWT", e); } }
Source:
public void testUpsertOnSCNSetTxnTable() throws SQLException { String trnx = "CREATE TABLE transaction_table (METRIC_ID CHAR(15) NOT NULL,\n" + "METRIC_VALUE VARCHAR(50) \n" + "CONSTRAINT PK PRIMARY KEY(METRIC_ID)) TRANSACTION_PROVIDER='TEPHRA',TRANSACTIONAL=true"; Properties props = new Properties(); Connection conn = DriverManager.getConnection(getUrl(), props); conn.createStatement().execute(trnx); props.setProperty("CurrentSCN", Long.toString(System.currentTimeMillis())); conn = DriverManager.getConnection(getUrl(), props); conn.setAutoCommit(true); String upsert = "UPSERT INTO transaction_table(METRIC_ID, METRIC_VALUE) VALUES (?,?)"; PreparedStatement prep = conn.prepareStatement(upsert); prep.setString(1,"abc"); prep.setString(2,"This is the first comment!"); exception.expect(SQLException.class); exception.expectMessage(containsString("ERROR 1075 (44A06): Cannot use a " + "connection with SCN set for a transactional table.")); prep.executeUpdate(); }

Target:
public void testUpsertOnSCNSetTxnTable() throws SQLException { helpTestUpserWithSCNIT(false, true, false, false, false); exception.expect(SQLException.class); exception.expectMessage(containsString(String.valueOf( SQLExceptionCode .CANNOT_SPECIFY_SCN_FOR_TXN_TABLE .getErrorCode()))); prep.executeUpdate(); }
Source:
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { View view = ((View) object); container.removeView(view); view.setTag(-1); }

Target:
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) { View view = ((View) object); container.removeView(view); }
Source:
private void deleteVM(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws InvalidEntityException { try { log.info("Deleting Virtual Machines for environmetn instance " + envInstance.getBlueprintName()); envInstance.setStatus(Status.UNDEPLOYING); envInstance = environmentInstanceDao.update(envInstance); infrastructureManager.deleteEnvironment(claudiaData, envInstance); } catch (Exception e) { log.error("It is not possible to delete the environment " + envInstance.getName() + " : " + e.getMessage()); throw new InvalidEntityException(EnvironmentInstance.class, e); } }

Target:
private void deleteVM(ClaudiaData claudiaData, EnvironmentInstance envInstance) throws InvalidEntityException { try { log.info("Deleting Virtual Machines for environment instance " + envInstance.getBlueprintName()); envInstance.setStatus(Status.UNDEPLOYING); envInstance = environmentInstanceDao.update(envInstance); infrastructureManager.deleteEnvironment(claudiaData, envInstance); } catch (Exception e) { log.error("It is not possible to delete the environment " + envInstance.getName() + " : " + e.getMessage()); throw new InvalidEntityException(EnvironmentInstance.class, e); } }
Source:
public void example1Pointers() { JsonPointer pointer1 = JsonPointer.from("/hello/world"); JsonPointer pointer2 = JsonPointer.fromURI(URI.create("#/hello/world")); JsonPointer pointer3 = JsonPointer.create() .append("hello") .append("world"); }

Target:
public void example1Pointers() { JsonPointer pointer1 = JsonPointer.from("/hello/world"); JsonPointer pointer2 = JsonPointer.create() .append("hello") .append("world"); }
Source:
private boolean updateVms() { List<VM> vmList = getVmDao().getAllForCluster(getParameters().getCluster().getId()); Cluster oldCluster = getClusterDao().get(getCluster().getId()); for (VM vm : vmList) { if (!vm.isExternalVm() && !vm.isHostedEngine()) { VmManagementParametersBase updateParams = new VmManagementParametersBase(vm); if (!Objects.equals(oldCluster.getCompatibilityVersion(), getParameters().getCluster().getCompatibilityVersion())) { updateParams.setClusterLevelChangeToVersion(getParameters().getCluster().getCompatibilityVersion()); } VdcReturnValueBase result = runInternalAction( VdcActionType.UpdateVm, updateParams, cloneContextAndDetachFromParent()); if (!result.getSucceeded()) { getReturnValue().setFault(result.getFault()); return false; } } } return true; }

Target:
private boolean updateVms() { List<VM> vmList = getVmDao().getAllForCluster(getParameters().getCluster().getId()); for (VM vm : vmList) { if (!vm.isExternalVm() && !vm.isHostedEngine()) { VmManagementParametersBase updateParams = new VmManagementParametersBase(vm); if (!Objects.equals(oldCluster.getCompatibilityVersion(), getParameters().getCluster().getCompatibilityVersion())) { updateParams.setClusterLevelChangeToVersion(getParameters().getCluster().getCompatibilityVersion()); } VdcReturnValueBase result = runInternalAction( VdcActionType.UpdateVm, updateParams, cloneContextAndDetachFromParent()); if (!result.getSucceeded()) { getReturnValue().setFault(result.getFault()); return false; } } } return true; }
Source:
private void postDescription(@NonNull String editToken) { disposables.add(ServiceFactory.get(wikiData).postDescriptionEdit(languageCode, pageTitle.getWikiSite().dbName(), pageTitle.getPrefixedText(), editView.getDescription(), editToken, AccountUtil.isLoggedIn() ? "user" : null) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(response -> { if (response.getSuccessVal() > 0) { new Handler().postDelayed(successRunnable, TimeUnit.SECONDS.toMillis(4)); if (funnel != null) { funnel.logSaved(); } } else { editFailed(RetrofitException.unexpectedError(new RuntimeException( "Received unrecognized description edit response")), true); } }, caught -> { if (caught instanceof MwException) { MwServiceError error = ((MwException) caught).getError(); if (error.badLoginState() || error.badToken()) { getEditTokenThenSave(true); } else if (error.hasMessageName(ABUSEFILTER_DISALLOWED) || error.hasMessageName(ABUSEFILTER_WARNING)) { String code = error.hasMessageName(ABUSEFILTER_DISALLOWED) ? ABUSEFILTER_DISALLOWED : ABUSEFILTER_WARNING; String info = error.getMessageHtml(code); editView.setSaveState(false); if (info != null) { editView.setError(StringUtil.fromHtml(info)); } if (funnel != null) { funnel.logAbuseFilterWarning(code); } } else { editFailed(caught, true); } } else { editFailed(caught, true); } })); }

Target:
private void postDescription(@NonNull String editToken) { disposables.add(ServiceFactory.get(pageTitle.getWikiSite()).getSiteInfo() .flatMap(response -> { String languageCode = response.query().siteInfo() != null && response.query().siteInfo().lang() != null && !response.query().siteInfo().hasVariants() ? response.query().siteInfo().lang() : pageTitle.getWikiSite().languageCode(); return ServiceFactory.get(wikiData).postDescriptionEdit(languageCode, pageTitle.getWikiSite().languageCode(), pageTitle.getWikiSite().dbName(), pageTitle.getPrefixedText(), editView.getDescription(), editToken, AccountUtil.isLoggedIn() ? "user" : null); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(response -> { if (response.getSuccessVal() > 0) { new Handler().postDelayed(successRunnable, TimeUnit.SECONDS.toMillis(4)); if (funnel != null) { funnel.logSaved(); } } else { editFailed(RetrofitException.unexpectedError(new RuntimeException( "Received unrecognized description edit response")), true); } }, caught -> { if (caught instanceof MwException) { MwServiceError error = ((MwException) caught).getError(); if (error.badLoginState() || error.badToken()) { getEditTokenThenSave(true); } else if (error.hasMessageName(ABUSEFILTER_DISALLOWED) || error.hasMessageName(ABUSEFILTER_WARNING)) { String code = error.hasMessageName(ABUSEFILTER_DISALLOWED) ? ABUSEFILTER_DISALLOWED : ABUSEFILTER_WARNING; String info = error.getMessageHtml(code); editView.setSaveState(false); if (info != null) { editView.setError(StringUtil.fromHtml(info)); } if (funnel != null) { funnel.logAbuseFilterWarning(code); } } else { editFailed(caught, true); } } else { editFailed(caught, true); } })); }
Source:
private static final TypeKind toPrimitiveIntegralTypeKind(TypeMirror type) { TypeKind typeKind = NumberUtils.unboxPrimitive(type); if (isPrimitiveIntegral(typeKind)) { return typeKind; } throw new BugInCF(type.toString() + " expected to be an integral type."); }

Target:
private static TypeKind toPrimitiveIntegralTypeKind(TypeMirror type) { TypeKind typeKind = NumberUtils.unboxPrimitive(type); if (isPrimitiveIntegral(typeKind)) { return typeKind; } throw new BugInCF(type.toString() + " expected to be an integral type."); }
Source:
private void addToUnsecuredCookies(VariableTree variableTree) { ExpressionTree initializer = variableTree.initializer(); if (initializer != null && variableTree.symbol().isVariableSymbol() && variableTree.symbol().owner().isMethodSymbol()) { boolean isInitializedWithConstructor = initializer.is(Tree.Kind.NEW_CLASS); boolean isMatchedType = isCookieClass(variableTree.symbol().type()) || isCookieClass(initializer.symbolType()); if (isInitializedWithConstructor && isMatchedType && isSecureParamFalse((NewClassTree) initializer)) { unsecuredCookies.add((Symbol.VariableSymbol) variableTree.symbol()); } } }

Target:
private void addToUnsecuredCookies(VariableTree variableTree) { ExpressionTree initializer = variableTree.initializer(); Symbol variableTreeSymbol = variableTree.symbol(); if (initializer != null && variableTreeSymbol.isVariableSymbol() && variableTreeSymbol.owner().isMethodSymbol()) { boolean isInitializedWithConstructor = initializer.is(Tree.Kind.NEW_CLASS); boolean isMatchedType = isCookieClass(variableTreeSymbol.type()) || isCookieClass(initializer.symbolType()); if (isInitializedWithConstructor && isMatchedType && isSecureParamFalse((NewClassTree) initializer)) { unsecuredCookies.add((Symbol.VariableSymbol) variableTreeSymbol); } } }
Source:
public static Item getFrameFromType(FrameType type) { switch (type) { case JEWEL: return GadgetItems.jewel_item_frame.get(); case ALUMINUM_BRASS: return GadgetItems.aluminum_brass_item_frame.get(); case COBALT: return GadgetItems.cobalt_item_frame.get(); case ARDITE: return GadgetItems.ardite_item_frame.get(); case MANYULLYN: return GadgetItems.manyullyn_item_frame.get(); case GOLD: return GadgetItems.gold_item_frame.get(); case CLEAR: return GadgetItems.clear_item_frame.get(); default: return Items.ITEM_FRAME; } }

Target:
public static Item getFrameFromType(FrameType type) { return GadgetItems.item_frame.get(type); }
Source:
private void setNotificationOngoing(Bundle extras, NotificationCompat.Builder mBuilder) { String ongoingString = extras.getString(ONGOING); if (ongoingString != null) { try { Boolean ongoing = Boolean.valueOf(ongoingString); mBuilder.setOngoing(ongoing); } catch (RuntimeException e) { e.printStackTrace(); } } }

Target:
private void setNotificationOngoing(Bundle extras, NotificationCompat.Builder mBuilder) { boolean ongoing = extras.optBoolean(ONGOING, false); mBuilder.setOngoing(ongoing); }
Source:
public void should_instanciate_a_process_with_given_inputs() throws Exception { final Map<String, Serializable> expectedComplexInput = aComplexInput(); when(processAPI.startProcessWithInputs(PROCESS_DEFINITION_ID, expectedComplexInput)).thenReturn(new ProcessInstanceImpl("complexProcessInstance")); when(processAPI.getProcessContract(PROCESS_DEFINITION_ID)).thenReturn(contractDefinition); final Response response = request(URL_API_PROCESS_INSTANTIATION_TEST).post(VALID_COMPLEX_POST_BODY); assertThat(response).hasStatus(Status.SUCCESS_OK); assertThat(response.getEntityAsText()) .isEqualTo( "{\"processInstanceId\":0}"); verify(processAPI).startProcessWithInputs(PROCESS_DEFINITION_ID, expectedComplexInput); }

Target:
public void should_instanciate_a_process_with_given_inputs() throws Exception { final Map<String, Serializable> expectedComplexInput = aComplexInput(); when(processAPI.startProcessWithInputs(PROCESS_DEFINITION_ID, expectedComplexInput)).thenReturn(new ProcessInstanceImpl("complexProcessInstance")); when(processAPI.getProcessContract(PROCESS_DEFINITION_ID)).thenReturn(contractDefinition); final Response response = request(URL_API_PROCESS_INSTANTIATION_TEST).post(VALID_COMPLEX_POST_BODY); assertThat(response).hasStatus(Status.SUCCESS_OK); assertThat(response.getEntityAsText()) .isEqualTo( "{\"caseId\":0}"); verify(processAPI).startProcessWithInputs(PROCESS_DEFINITION_ID, expectedComplexInput); }
Source:
@Override protected void afterTest() throws Exception { super.afterTest(); mbSrv.clear(); for (String cacheName : grid(0).cacheNames()) if (!(EXISTING_CACHE_NAME.equals(cacheName) || DEFAULT_CACHE_NAME.equals(cacheName))) grid(0).cache(cacheName).destroy(); }

Target:
@Override protected void afterTest() throws Exception { super.afterTest(); mbSrv.clear(); for (String cacheName : grid(0).cacheNames()) { if (!(EXISTING_CACHE_NAME.equals(cacheName) || DEFAULT_CACHE_NAME.equals(cacheName))) grid(0).cache(cacheName).destroy(); } }
Source:
public static String getDatastreamUrl(BriefObjectMetadata metadata, String datastreamName) { Datastream preferredDS = getPreferredDatastream(metadata, datastreamName); if (preferredDS == null) { return ""; } StringBuilder url = new StringBuilder(); if (!isBlank(preferredDS.getExtension())) { if (INDEXABLE_EXTENSIONS.contains(preferredDS.getExtension())) { url.append("indexable"); } } url.append("content/"); if (isBlank(preferredDS.getOwner())) { url.append(metadata.getId()); } else { url.append(preferredDS.getOwner()); } if (!ORIGINAL_FILE.equals(datastreamName)) { url.append("/").append(preferredDS.getName()); } return url.toString(); }

Target:
public static String getDatastreamUrl(BriefObjectMetadata metadata, String datastreamName) { Datastream preferredDS = getPreferredDatastream(metadata, datastreamName); if (preferredDS == null) { return ""; } StringBuilder url = new StringBuilder(); if (!isBlank(preferredDS.getExtension())) { if (INDEXABLE_EXTENSIONS.contains(preferredDS.getExtension())) { url.append("indexable"); } } url.append("content/"); if (isBlank(preferredDS.getOwner())) { url.append(metadata.getId()); } else { url.append(preferredDS.getOwner()); } if (!ORIGINAL_FILE.equals(preferredDS.getName())) { url.append("/").append(preferredDS.getName()); } return url.toString(); }
Source:
public void errorReporting() throws SQLException { final int maxRetries = 2; final int retryBackoffMs = 1000; Set<SinkRecord> records = Collections.singleton(new SinkRecord("stub", 0, null, null, null, null, 0)); final JdbcDbWriter mockWriter = createMock(JdbcDbWriter.class); SinkTaskContext ctx = createMock(SinkTaskContext.class); mockWriter.write(records); SQLException chainedException = new SQLException("cause 1"); chainedException.setNextException(new SQLException("cause 2")); chainedException.setNextException(new SQLException("cause 3")); expectLastCall().andThrow(chainedException).times(1); mockWriter.write(anyObject()); expectLastCall(); JdbcSinkTask task = new JdbcSinkTask() { @Override void initWriter() { this.writer = mockWriter; } }; task.initialize(ctx); ErrantRecordReporter reporter = createMock(ErrantRecordReporter.class); expect(ctx.errantRecordReporter()).andReturn(reporter); replayAll(); Map<String, String> props = new HashMap<>(); props.put(JdbcSinkConfig.CONNECTION_URL, "stub"); props.put(JdbcSinkConfig.MAX_RETRIES, String.valueOf(maxRetries)); props.put(JdbcSinkConfig.RETRY_BACKOFF_MS, String.valueOf(retryBackoffMs)); task.start(props); task.put(records); verifyAll(); }

Target:
public void errorReporting() throws SQLException { final int maxRetries = 2; final int retryBackoffMs = 1000; Set<SinkRecord> records = Collections.singleton(new SinkRecord("stub", 0, null, null, null, null, 0)); final JdbcDbWriter mockWriter = createMock(JdbcDbWriter.class); SinkTaskContext ctx = createMock(SinkTaskContext.class); mockWriter.write(records); SQLException exception = new SQLException("cause 1"); expectLastCall().andThrow(exception); mockWriter.write(anyObject()); expectLastCall().andThrow(exception); JdbcSinkTask task = new JdbcSinkTask() { @Override void initWriter() { this.writer = mockWriter; } }; task.initialize(ctx); ErrantRecordReporter reporter = createMock(ErrantRecordReporter.class); expect(ctx.errantRecordReporter()).andReturn(reporter); expect(reporter.report(anyObject(), anyObject())).andReturn(CompletableFuture.completedFuture(null)); replayAll(); Map<String, String> props = new HashMap<>(); props.put(JdbcSinkConfig.CONNECTION_URL, "stub"); props.put(JdbcSinkConfig.MAX_RETRIES, String.valueOf(maxRetries)); props.put(JdbcSinkConfig.RETRY_BACKOFF_MS, String.valueOf(retryBackoffMs)); task.start(props); task.put(records); verifyAll(); }
Source:
public WidgetResult isValid(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef) { for (String attrStr : valueProvider.getValues()) { if (StringUtils.isNumeric(attrStr)) { return checkValid(widgetDef, Double.parseDouble(attrStr), valueProvider.getName()); } else { return new WidgetResult(WidgetStatus.Invalid_Type, widgetDef, "[%s] value [%s] is not a valid number", valueProvider.getName(), attrStr); } } return WidgetResult.Valid; }

Target:
public WidgetResult isValid(IValueProvider valueProvider, IAtsWidgetDefinition widgetDef) { for (String attrStr : valueProvider.getValues()) { if (attrStr.matches("[-+]?\\d*\\.?\\d*")) { return checkValid(widgetDef, Double.parseDouble(attrStr), valueProvider.getName()); } else { return new WidgetResult(WidgetStatus.Invalid_Type, widgetDef, "[%s] value [%s] is not a valid number", valueProvider.getName(), attrStr); } } return WidgetResult.Valid; }
Source:
private boolean isJobOverridingCancelingMethod() { Method cancelingMethod = null; try { cancelingMethod = currentJob.getClass().getDeclaredMethod("canceling"); } catch (NoSuchMethodException | SecurityException e) { return false; } return (cancelingMethod != null); }

Target:
private boolean isJobOverridingCancelingMethod() { Method cancelingMethod = null; try { cancelingMethod = currentJob.getClass().getDeclaredMethod("canceling"); } catch (NoSuchMethodException | SecurityException e) { return false; } return cancelingMethod != null; }
Source:
public static Run setMode(Run run, Mode mode) { run.set(LaunchUtils.Mode.class.getName(), mode.name()); return run; }

Target:
public static void setMode(Run run, Mode mode) { run.set(LaunchUtils.Mode.class.getName(), mode.name()); }
Source:
public static Configuration getDriverConfiguration() { return getNetworkConfigurationBuilder() .bindSetEntry(DriverStartHandler.class, NetworkDriverRegister.RegisterDriverHandler.class) .bindNamedParameter(EMMessageHandler.class, ElasticMemoryMsgHandler.class) .build(); }

Target:
public static Configuration getDriverConfiguration() { return getNetworkConfigurationBuilder() .bindSetEntry(DriverStartHandler.class, NetworkDriverRegister.RegisterDriverHandler.class) .bindNamedParameter(EMMessageHandler.class, edu.snu.cay.services.em.driver.impl.ElasticMemoryMsgHandler.class) .build(); }
Source:
public CatchEventPropertyWriter(CatchEvent event, VariableScope variableScope) { super(event, variableScope); this.event = event; event.setOutputSet(bpmn2.createOutputSet()); }

Target:
public CatchEventPropertyWriter(CatchEvent event, VariableScope variableScope) { super(event, variableScope); this.event = event; }
Source:
private boolean validateCanAmendDisk() { DiskImage disk = (DiskImage) getNewDisk(); setStoragePoolId(disk.getStoragePoolId()); if (!validate(new StoragePoolValidator(getStoragePool()).existsAndUp())) { return false; } DiskImagesValidator diskImagesValidator = new DiskImagesValidator(Collections.singletonList(disk)); return validate(diskImagesValidator.diskImagesNotIllegal()); }

Target:
private boolean validateCanAmendDisk() { DiskImage disk = (DiskImage) getNewDisk(); setStoragePoolId(disk.getStoragePoolId()); if (!validate(new StoragePoolValidator(getStoragePool()).existsAndUp())) { return false; } DiskImagesValidator diskImagesValidator = new DiskImagesValidator(List.of(disk)); return validate(diskImagesValidator.diskImagesNotIllegal()); }
Source:
public Response listTopologyWindows(@PathParam("topologyId") Long topologyId, @Context UriInfo uriInfo) { List<QueryParam> queryParams = WSUtils.buildTopologyIdAwareQueryParams(topologyId, uriInfo); try { Collection<RuleInfo> ruleInfos = catalogService.listRules(queryParams); if (ruleInfos != null) { Collection<RuleInfo> windowRules = getWindows(ruleInfos); Collection<WindowDto> windowDtos = Collections2.transform(windowRules, new Function<RuleInfo, WindowDto>() { @Nullable @Override public WindowDto apply(@Nullable RuleInfo ruleInfo) { return new WindowDto(ruleInfo); } }); return WSUtils.respond(OK, SUCCESS, windowDtos); } } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND_FOR_FILTER, queryParams.toString()); }

Target:
public Response listTopologyWindows(@PathParam("topologyId") Long topologyId, @Context UriInfo uriInfo) { List<QueryParam> queryParams = WSUtils.buildTopologyIdAwareQueryParams(topologyId, uriInfo); try { Collection<RuleInfo> ruleInfos = catalogService.listRules(queryParams); if (ruleInfos != null) { Collection<RuleInfo> windowRules = getWindows(ruleInfos); Collection<WindowDto> windowDtos = Collections2.transform(windowRules, new Function<RuleInfo, WindowDto>() { @Nullable @Override public WindowDto apply(@Nullable RuleInfo ruleInfo) { return new WindowDto(ruleInfo); } }); return WSUtils.respond(OK, SUCCESS, windowDtos); } } catch (Exception ex) { LOG.error("Got exception", ex); return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } return WSUtils.respond(NOT_FOUND, ENTITY_NOT_FOUND_FOR_FILTER, queryParams.toString()); }
Source:
private Map<String, InstanceConfig> findTimeoutOfflineInstances(String clusterName, long offlineDuration) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); if (offlineDuration == VALUE_NOT_SET) { offlineDuration = _configAccessor.getClusterConfig(clusterName).getOfflineNodeTimeOutForPurge(); if (offlineDuration == VALUE_NOT_SET) { return instanceConfigMap; } } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient)); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); instanceConfigMap = accessor.getChildValuesMap(keyBuilder.instanceConfigs(), true); List<String> liveNodes = accessor.getChildNames(keyBuilder.liveInstances()); instanceConfigMap.keySet().removeAll(liveNodes); Set<String> toRemoveInstances = new HashSet<>(); for (String instanceName : instanceConfigMap.keySet()) { ParticipantHistory participantHistory = accessor.getProperty(keyBuilder.participantHistory(instanceName)); long lastOfflineTime = participantHistory.getLastOfflineTime(); if (lastOfflineTime == VALUE_NOT_SET || System.currentTimeMillis() - lastOfflineTime < offlineDuration) { toRemoveInstances.add(instanceName); } } instanceConfigMap.keySet().removeAll(toRemoveInstances); return instanceConfigMap; }

Target:
private Map<String, InstanceConfig> findTimeoutOfflineInstances(String clusterName, long offlineDuration) { Map<String, InstanceConfig> instanceConfigMap = new HashMap<>(); if (offlineDuration == ClusterConfig.OFFLINE_DURATION_FOR_PURGE_NOT_SET) { offlineDuration = _configAccessor.getClusterConfig(clusterName).getOfflineDurationForPurge(); if (offlineDuration == ClusterConfig.OFFLINE_DURATION_FOR_PURGE_NOT_SET) { return instanceConfigMap; } } HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient)); PropertyKey.Builder keyBuilder = accessor.keyBuilder(); instanceConfigMap = accessor.getChildValuesMap(keyBuilder.instanceConfigs(), true); List<String> liveNodes = accessor.getChildNames(keyBuilder.liveInstances()); instanceConfigMap.keySet().removeAll(liveNodes); Set<String> toRemoveInstances = new HashSet<>(); for (String instanceName : instanceConfigMap.keySet()) { ParticipantHistory participantHistory = accessor.getProperty(keyBuilder.participantHistory(instanceName)); long lastOfflineTime = participantHistory.getLastOfflineTime(); if (lastOfflineTime == ClusterConfig.OFFLINE_DURATION_FOR_PURGE_NOT_SET || System.currentTimeMillis() - lastOfflineTime < offlineDuration) { toRemoveInstances.add(instanceName); } } instanceConfigMap.keySet().removeAll(toRemoveInstances); return instanceConfigMap; }
Source:
public void beforeBlockElement(ProgramState currentState, Tree element) { if (element.is(Kind.DOT_MEMBER_EXPRESSION)) { DotMemberExpressionTree memberExpression = (DotMemberExpressionTree) element; if (isArrayPropertyExecuted(currentState) && METHODS_WITH_CALLBACK.contains(memberExpression.property().name())) { checkArgumentToBeFunctionWithReturn(memberExpression, 0); } if (isArrayFromMethod(memberExpression, currentState)) { checkArgumentToBeFunctionWithReturn(memberExpression, 1); } } }

Target:
public void beforeBlockElement(ProgramState currentState, Tree element) { if (element.is(Kind.DOT_MEMBER_EXPRESSION)) { DotMemberExpressionTree memberExpression = (DotMemberExpressionTree) element; if (isArrayPropertyExecuted(currentState) && METHODS_WITH_CALLBACK.contains(memberExpression.property().name())) { checkArgumentToBeFunctionWithReturn(memberExpression, 0); } else if (isArrayFromMethod(memberExpression, currentState)) { checkArgumentToBeFunctionWithReturn(memberExpression, 1); } } }
Source:
List<DiskImage> mapDisks(Disks disks) { List<DiskImage> diskImages = null; if (disks.isSetDisks()) { diskImages = disks.getDisks().stream() .filter(Objects::nonNull) .map(d -> (DiskImage) DiskMapper.map(d, null)) .collect(Collectors.toList()); } return diskImages; }

Target:
List<DiskImage> mapDisks(Disks disks) { List<DiskImage> diskImages = null; if (disks != null && disks.isSetDisks()) { diskImages = disks.getDisks().stream() .filter(Objects::nonNull) .map(disk -> (DiskImage) DiskMapper.map(disk, null)) .collect(Collectors.toList()); } return diskImages; }
Source:
public void testCompressedFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerMessageDeflateEncoder(9, 15, false, NEVER_SKIP)); EmbeddedChannel decoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); encoderChannel.writeOutbound(frame); BinaryWebSocketFrame compressedFrame = encoderChannel.readOutbound(); assertNotNull(compressedFrame); assertNotNull(compressedFrame.content()); assertEquals(WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedFrame.rsv()); decoderChannel.writeInbound(compressedFrame.content()); decoderChannel.writeInbound(DeflateDecoder.FRAME_TAIL); ByteBuf uncompressedPayload = decoderChannel.readInbound(); assertEquals(300, uncompressedPayload.readableBytes()); byte[] finalPayload = new byte[300]; uncompressedPayload.readBytes(finalPayload); assertArrayEquals(finalPayload, payload); uncompressedPayload.release(); }

Target:
public void testCompressedFrame() { EmbeddedChannel encoderChannel = new EmbeddedChannel(new PerMessageDeflateEncoder(9, 15, false)); EmbeddedChannel decoderChannel = new EmbeddedChannel( ZlibCodecFactory.newZlibDecoder(ZlibWrapper.NONE)); byte[] payload = new byte[300]; random.nextBytes(payload); BinaryWebSocketFrame frame = new BinaryWebSocketFrame(true, WebSocketExtension.RSV3, Unpooled.wrappedBuffer(payload)); assertTrue(encoderChannel.writeOutbound(frame)); BinaryWebSocketFrame compressedFrame = encoderChannel.readOutbound(); assertNotNull(compressedFrame); assertNotNull(compressedFrame.content()); assertEquals(WebSocketExtension.RSV1 | WebSocketExtension.RSV3, compressedFrame.rsv()); assertTrue(decoderChannel.writeInbound(compressedFrame.content())); assertTrue(decoderChannel.writeInbound(Unpooled.wrappedBuffer(DeflateDecoder.FRAME_TAIL))); ByteBuf uncompressedPayload = decoderChannel.readInbound(); assertEquals(300, uncompressedPayload.readableBytes()); byte[] finalPayload = new byte[300]; uncompressedPayload.readBytes(finalPayload); assertArrayEquals(finalPayload, payload); uncompressedPayload.release(); }
Source:
public void itemStateChanged(ItemEvent e) { if (e.getSource() instanceof JComboBox) { JComboBox combo = (JComboBox) e.getSource(); if(HTTP_SAMPLER_NAMING_MODE.equals(combo.getName())) { model.setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex()); } if(HTTP_SAMPLER_NUMBERING_MODE.equals(combo.getName())) { model.setHttpSampleNumberingMode(httpSampleNumberingMode.getSelectedIndex()); if (httpSampleNumberingMode.getSelectedIndex() == 0) { JMeterUtils.setProperty("proxy.number.mode", "prefix"); JMeterUtils.setProperty("proxy.number.requests", "true"); } if (httpSampleNumberingMode.getSelectedIndex() == 1) { JMeterUtils.setProperty("proxy.number.mode", "suffix"); JMeterUtils.setProperty("proxy.number.requests", "true"); } if (httpSampleNumberingMode.getSelectedIndex() == 2) { JMeterUtils.setProperty("proxy.number.requests", "false"); } } } else { enableRestart(); } }

Target:
public void itemStateChanged(ItemEvent e) { if (e.getSource() instanceof JComboBox) { JComboBox combo = (JComboBox) e.getSource(); if(HTTP_SAMPLER_NAMING_MODE.equals(combo.getName())) { model.setHTTPSampleNamingMode(httpSampleNamingMode.getSelectedIndex()); } if(HTTP_SAMPLER_NUMBERING_MODE.equals(combo.getName())) { model.setHttpSampleNumberingMode(httpSampleNumberingMode.getSelectedIndex()); } } else { enableRestart(); } }
Source:
private boolean checkClients() { long reqBytes = 0, respMsgs = 0, txns = 0; try { ClientInterface ci = VoltDB.instance().getClientInterface(); if (ci != null) { for (Pair<String,long[]> ent : ci.getLiveClientStats().values()) { long[] val = ent.getSecond(); reqBytes += val[1]; respMsgs += val[2]; txns += val[3]; } } } catch (Exception ex) { warn("checkClients", ex); } client_reqBytes = reqBytes; client_respMsgs = respMsgs; client_txns = txns; return isActive("client interface: outstanding txns %d, request bytes %d, responses %d", txns, reqBytes, respMsgs); }

Target:
private boolean checkClients() { long reqBytes = 0, respMsgs = 0, txns = 0; try { ClientInterface ci = VoltDB.instance().getClientInterface(); if (ci != null) { for (Pair<String,long[]> ent : ci.getLiveClientStats().values()) { long[] val = ent.getSecond(); reqBytes += val[1]; respMsgs += val[2]; txns += val[3]; } } } catch (Exception ex) { warn("checkClients", ex); } clientReqBytes = reqBytes; clientRespMsgs = respMsgs; clientTxns = txns; return isActive("client interface: outstanding txns %d, request bytes %d, responses %d", txns, reqBytes, respMsgs); }