auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ResponseEntity<String> create(@RequestHeader final String authorization, @RequestBody String user) throws IOException, MessagingException { User parsedUser = mapper.readValue(user, User.class); Optional<String> email = RegistrationHelper.extractSendToEmail(parsedUser); if (!email.isPresent()) { LOGGER.log(Level.WARNING, "No primary email found!"); <START> return new ResponseEntity<>("{\"error\":\"No primary email found!\"}", HttpStatus.BAD_REQUEST); <END> } String activationToken = UUID.randomUUID().toString(); parsedUser = createUserForRegistration(parsedUser, activationToken); HttpClientRequestResult saveUserResponse = saveUser(parsedUser, authorization); if (saveUserResponse.getStatusCode() != HttpStatus.CREATED.value()) { LOGGER.log(Level.WARNING, "Problems creating user for registration"); return new ResponseEntity<>("{\"error\":\"Problems creating user for registration\"}", HttpStatus.valueOf(saveUserResponse.getStatusCode())); } User createdUser = mapper.readValue(saveUserResponse.getBody(), User.class); try { sendActivationMail(email.get(), createdUser, activationToken); } catch (OsiamException e) { return new ResponseEntity<>("{\"error\":\"Problems creating user for registration\"}", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<>(saveUserResponse.getBody(), HttpStatus.OK); }</code><technical_language>search for primary email anymore</technical_language>

Target:
public ResponseEntity<String> create(@RequestHeader final String authorization, @RequestBody String user) throws IOException, MessagingException { User parsedUser = mapper.readValue(user, User.class); Optional<String> email = RegistrationHelper.extractSendToEmail(parsedUser); if (!email.isPresent()) { LOGGER.log(Level.WARNING, "Could not register user. No email of user " + parsedUser.getUserName() + " found!"); return new ResponseEntity<>("{\"error\":\"Could not register user. No email of user " + parsedUser.getUserName() + " found!\"}", HttpStatus.BAD_REQUEST); } String activationToken = UUID.randomUUID().toString(); parsedUser = createUserForRegistration(parsedUser, activationToken); HttpClientRequestResult saveUserResponse = saveUser(parsedUser, authorization); if (saveUserResponse.getStatusCode() != HttpStatus.CREATED.value()) { LOGGER.log(Level.WARNING, "Problems creating user for registration"); return new ResponseEntity<>("{\"error\":\"Problems creating user for registration\"}", HttpStatus.valueOf(saveUserResponse.getStatusCode())); } User createdUser = mapper.readValue(saveUserResponse.getBody(), User.class); try { sendActivationMail(email.get(), createdUser, activationToken); } catch (OsiamException e) { return new ResponseEntity<>("{\"error\":\"Problems creating user for registration: \"" + e.getMessage() + "}", HttpStatus.INTERNAL_SERVER_ERROR); } return new ResponseEntity<>(saveUserResponse.getBody(), HttpStatus.OK); }
Source:
<code>public Tree ARRAY_ASSIGNMENT_PATTERN_ELEMENT() { return b.<Tree>nonterminal(PHPLexicalGrammar.ARRAY_ASSIGNMENT_PATTERN_ELEMENT) .is( b.firstOf( f.arrayAssignmentPatternElement( b.optional( f.newTuple6( EXPRESSION(), b.token(DOUBLEARROW))), <START> VARIABLE_IDENTIFIER()), <END> ARRAY_ASSIGNMENT_PATTERN())); }</code><technical_language>VARIABLE_IDENTIFIER is restrictive. include: * variables, ex: [$a] * indexed array, ex: [$a[$i]] * object property, ex:[$a->name] This is some valide php code SonarPHP parse: $t1 = [3, 5, 7]; $t2 = [9, 8, 6]; $i=2; [$t1[0], $t1[$i]] = $t2; // indexed array var_dump($t1); Output: [9, 5, 8] Other example: $t2 = [9, 8, 6]; class A { public $age = 12; } $a = new A(); [$a->age] = $t2; // object property var_dump($a); Output: object(A) { age => 9 }</technical_language>

Target:
public Tree ARRAY_ASSIGNMENT_PATTERN_ELEMENT() { return b.<Tree>nonterminal(PHPLexicalGrammar.ARRAY_ASSIGNMENT_PATTERN_ELEMENT) .is( b.firstOf( f.arrayAssignmentPatternElement( b.optional( f.newTuple6( EXPRESSION(), b.token(DOUBLEARROW))), MEMBER_EXPRESSION()), ARRAY_ASSIGNMENT_PATTERN())); }
Source:
<code>public void updateNodeReports(List<NodeReport> nodeReports) { for (NodeReport nr : nodeReports) { StringBuilder sb = new StringBuilder(); sb.append("rackName=").append(nr.getRackName()).append(",nodeid=").append(nr.getNodeId()).append(",numContainers=").append(nr.getNumContainers()).append(",capability=").append(nr.getCapability()).append("used=").append(nr.getUsed()).append("state=").append(nr.getNodeState()); <START> LOG.debug("Node report: " + sb); <END> nodeReportMap.put(nr.getNodeId().getHost(), nr); nodeToRack.put(nr.getNodeId().getHost(), nr.getRackName()); } }</code><technical_language>Please sl4j logging format message instead of StringBuilder</technical_language>

Target:
public void updateNodeReports(List<NodeReport> nodeReports) { for (NodeReport nr : nodeReports) { LOG.debug("Node report: rackName={}, nodeid={}, numContainers={}, capability={}, used={}, state={}", nr.getRackName(), nr.getNodeId(), nr.getNumContainers(), nr.getCapability(), nr.getUsed(), nr.getNodeState()); nodeReportMap.put(nr.getNodeId().getHost(), nr); nodeToRack.put(nr.getNodeId().getHost(), nr.getRackName()); } }
Source:
<code>public List<String> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { Map<String, Serializable> suggestProps = new HashMap<>(); suggestProps.put(SUGGESTION_REQUEST_KEY, queryString); Query suggestionQuery = new QueryImpl(filterBuilder.attribute(Core.TITLE).text(queryString)); QueryRequest suggestionRequest = new QueryRequestImpl(suggestionQuery, suggestProps); try { QueryResponse suggestionResponse = catalogFramework.query(suggestionRequest); Map<String, List<Suggestion>> suggestionMap = (Map<String, List<Suggestion>>) suggestionResponse.getPropertyValue(SUGGESTION_RESULT_KEY); if (suggestionMap != null) { List<Suggestion> suggestions = suggestionMap .values() .stream() .flatMap(List::stream) .limit(maxResults) <START> .collect(Collectors.toList()); <END> } } catch (SourceUnavailableException | FederationException | UnsupportedQueryException e) { LOGGER.debug("Suggestion query failed", e); } return Collections.emptyList(); }</code><technical_language>suggestions returned here? this method returns empty list</technical_language>

Target:
public List<String> getSuggestedNames(String queryString, int maxResults) throws GeoEntryQueryException { Map<String, Serializable> suggestProps = new HashMap<>(); suggestProps.put(SUGGESTION_QUERY_KEY, queryString); suggestProps.put(SUGGESTION_CONTEXT_KEY, GAZETTEER_METACARD_TAG); suggestProps.put(SUGGESTION_DICT_KEY, SUGGEST_PLACE_KEY); Query suggestionQuery = new QueryImpl(filterBuilder.attribute(Core.TITLE).text(queryString)); QueryRequest suggestionRequest = new QueryRequestImpl(suggestionQuery, suggestProps); try { QueryResponse suggestionResponse = catalogFramework.query(suggestionRequest); if (suggestionResponse.getPropertyValue(SUGGESTION_RESULT_KEY) instanceof List) { List<String> suggestions = (List<String>) suggestionResponse.getPropertyValue(SUGGESTION_RESULT_KEY); return suggestions.subList(0, Math.min(suggestions.size(), maxResults)); } } catch (SourceUnavailableException | FederationException | UnsupportedQueryException e) { throw new GeoEntryQueryException("Failed to execute suggestion query", e); } return Collections.emptyList(); }
Source:
<code>public void shouldAllowManyLabelsAndPropertyCursor() throws Exception { int propertyCount = 10; int labelCount = 15; GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); Node node; try ( Transaction tx = db.beginTx() ) { node = db.createNode(); for ( int i = 0; i < propertyCount; i++ ) { node.setProperty( "foo" + i, "bar" ); } for ( int i = 0; i < labelCount; i++ ) { node.addLabel( label( "label" + i ) ); } tx.success(); } Set<Integer> seenProperties = new HashSet<>(); Set<Integer> seenLabels = new HashSet<>(); try ( Transaction tx = db.beginTx() ) { DependencyResolver resolver = db.getDependencyResolver(); ThreadToStatementContextBridge bridge = resolver.resolveDependency( ThreadToStatementContextBridge.class ); KernelTransaction ktx = bridge.getKernelTransactionBoundToThisThread( true ); <START> try ( NodeCursor nodes = ktx.cursors().allocateNodeCursor(); <END> PropertyCursor propertyCursor = ktx.cursors().allocatePropertyCursor() ) { while ( nodes.next() ) { nodes.properties( propertyCursor ); while ( propertyCursor.next() ) { seenProperties.add( propertyCursor.propertyKey() ); } LabelSet labels = nodes.labels(); for ( int i = 0; i < labels.numberOfLabels(); i++ ) { seenLabels.add( labels.label( i ) ); } } } tx.success(); } assertEquals( propertyCount, seenProperties.size() ); assertEquals( labelCount, seenLabels.size() ); }</code><technical_language>This test Core API imho. if want test cursor live in kernel API</technical_language>

Target:
public void shouldAllowManyLabelsAndPropertyCursor() throws Exception { int propertyCount = 10; int labelCount = 15; GraphDatabaseAPI db = dbRule.getGraphDatabaseAPI(); Node node; try ( Transaction tx = db.beginTx() ) { node = db.createNode(); for ( int i = 0; i < propertyCount; i++ ) { node.setProperty( "foo" + i, "bar" ); } for ( int i = 0; i < labelCount; i++ ) { node.addLabel( label( "label" + i ) ); } tx.success(); } Set<Integer> seenProperties = new HashSet<>(); Set<Integer> seenLabels = new HashSet<>(); try ( Transaction tx = db.beginTx() ) { DependencyResolver resolver = db.getDependencyResolver(); ThreadToStatementContextBridge bridge = resolver.resolveDependency( ThreadToStatementContextBridge.class ); KernelTransaction ktx = bridge.getKernelTransactionBoundToThisThread( true ); try ( NodeCursor nodes = ktx.cursors().allocateNodeCursor(); PropertyCursor propertyCursor = ktx.cursors().allocatePropertyCursor() ) { ktx.dataRead().singleNode( node.getId(), nodes ); while ( nodes.next() ) { nodes.properties( propertyCursor ); while ( propertyCursor.next() ) { seenProperties.add( propertyCursor.propertyKey() ); } LabelSet labels = nodes.labels(); for ( int i = 0; i < labels.numberOfLabels(); i++ ) { seenLabels.add( labels.label( i ) ); } } } tx.success(); } assertEquals( propertyCount, seenProperties.size() ); assertEquals( labelCount, seenLabels.size() ); }
Source:
<code>public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.renderingConfig = context.get(Config.class).getRendering(); this.shaderManager = context.get(ShaderManager.class); vrProvider = OpenVRProvider.getInstance(); if (renderingConfig.isVrSupport()) { context.put(OpenVRProvider.class, vrProvider); if (vrProvider.init()) { playerCamera = new OpenVRStereoCamera(vrProvider); <START> vrProvider.getState().setGroundPlaneYOffset(-0.80f - context.get(Config.class).getPlayer().getEyeHeight()); <END> currentRenderingStage = RenderingStage.LEFT_EYE; } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera); renderQueues = renderableWorld.getRenderQueues(); initRenderingSupport(); }</code><technical_language>magic numbers: -0.80f? - want store result of getPlayer() somewhere, get context time this method is called</technical_language>

Target:
public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.renderingConfig = context.get(Config.class).getRendering(); this.shaderManager = context.get(ShaderManager.class); vrProvider = OpenVRProvider.getInstance(); if (renderingConfig.isVrSupport()) { context.put(OpenVRProvider.class, vrProvider); if (vrProvider.init()) { playerCamera = new OpenVRStereoCamera(vrProvider, worldProvider, renderingConfig); vrProvider.getState().setGroundPlaneYOffset( GROUND_PLANE_HEIGHT_DISPARITY - context.get(Config.class).getPlayer().getEyeHeight()); currentRenderingStage = RenderingStage.LEFT_EYE; } else { playerCamera = new PerspectiveCamera(worldProvider, renderingConfig); currentRenderingStage = RenderingStage.MONO; } } else { playerCamera = new PerspectiveCamera(worldProvider, renderingConfig); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera); renderQueues = renderableWorld.getRenderQueues(); initRenderingSupport(); }
Source:
<code>protected static byte[] doGetActualCek(byte[] theCek, String algoJwt) { int size = AesCbcContentEncryptionAlgorithm.getFullCekKeySize(algoJwt) / 2; byte[] actualCek = new byte[size]; <START> System.arraycopy(theCek, 0, actualCek, 0, size); <END> return actualCek; }</code><technical_language>I this change correct. spec for AES_128_CBC_HMAC_SHA_256 input key 32 bytes, test in JweJsonProducerTest.testMultipleRecipientsA128CBCHS256GivenCek is passing in a 16 byte key error: "The input key is 32 octets long." <LINK_0></technical_language>

Target:
protected static byte[] doGetActualCek(byte[] theCek, String algoJwt) { int inputKeySize = AesCbcContentEncryptionAlgorithm.getFullCekKeySize(algoJwt); if (theCek.length != inputKeySize) { LOG.warning("Length input key [" + theCek.length + "] invalid for algorithm " + algoJwt + " [" + inputKeySize + "]"); throw new JweException(Error.INVALID_CONTENT_KEY); } int secondaryKeySize = inputKeySize / 2; byte[] encKey = new byte[secondaryKeySize]; System.arraycopy(theCek, secondaryKeySize, encKey, 0, secondaryKeySize); return encKey; }
Source:
<code>private void generateGcodeMenuItemActionPerformed( java.awt.event.ActionEvent evg ) { String jobname = getJobName(); List<String> warnings = new LinkedList<String>(); final Map<LaserProfile, List<LaserProperty>> cuttingSettings = this.getPropertyMapForCurrentJob(); if (cuttingSettings == null) { return; } <START> <END> ProgressListener pl = new ProgressListener() { public void progressChanged(Object o, int i) { MainView.this.progressBar.setValue(i); MainView.this.progressBar.repaint(); } public void taskChanged(Object o, String string) { MainView.this.progressBar.setString(string); } }; try { MainView.this.visicutModel1 .saveJob(jobname, pl, cuttingSettings, warnings); } catch (IllegalJobException e1) { } catch( Exception e3 ) { } }</code><technical_language>ask user, save file. thing, consider is file extension (not driver outputs gcode). perfect, driver give file extension (e.g. a method getOutputFileExtension())... right I live ".dat" this</technical_language>

Target:
private void generateGcodeMenuItemActionPerformed( java.awt.event.ActionEvent evg ) { String jobname = getJobName(); List<String> warnings = new LinkedList<String>(); final Map<LaserProfile, List<LaserProperty>> cuttingSettings = this.getPropertyMapForCurrentJob(); if (cuttingSettings == null) { return; } ProgressListener pl = new ProgressListener() { public void progressChanged(Object o, int i) { MainView.this.progressBar.setValue(i); MainView.this.progressBar.repaint(); } public void taskChanged(Object o, String string) { MainView.this.progressBar.setString(string); } }; try { JFileChooser fileChooser = new JFileChooser(); int userreturn = fileChooser.showOpenDialog(this); if( userreturn == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); System.out.println( "selected " + selectedFile.getAbsolutePath() ); MainView.this.visicutModel1 .saveJob(jobname, selectedFile, pl, cuttingSettings, warnings); } } catch (IllegalJobException e1) { } catch( Exception e3 ) { } }
Source:
<code>protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() { from("direct:start") .to("log:edu.si.ctingest?level=DEBUG&showHeaders=true") <START> .to("extractor:extract?location=target/TestCameraTrapData") <END> .to("log:edu.si.ctingest?level=DEBUG&showHeaders=true") .to("mock:result"); } }; }</code><technical_language>pass in build directory (e.g. a system prop) a literal slash concatenate paths, especially trouble of platform-independent above. I do this sort of thing, too, good practice. Test code clean main code</technical_language>

Target:
protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() { from("direct:start") .to("log:edu.si.ctingest?level=DEBUG&showAll=true&multiline=true&maxChars=100000") .to("extractor:extract?location={{target.dir}}{{file.separator}}TestCameraTrapData") .to("log:edu.si.ctingest?level=DEBUG&showHeaders=true") .to("mock:result"); } }; }
Source:
<code>public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses) { Object expressionResult = compileAndExecute(rawExpression, Collections.emptyMap()); Class<Object> requiredClass = loadClass(className, classLoader); if (expressionResult != null && !requiredClass.isAssignableFrom(expressionResult.getClass())) { <START> throw new IllegalArgumentException("Cannot assign a '" + expressionResult.getClass().getCanonicalName() + <END> "' to '" + requiredClass.getCanonicalName()); } return expressionResult; }</code><technical_language>Minor thing, miss apostrophe in exception message</technical_language>

Target:
public Object evaluateLiteralExpression(String rawExpression, String className, List<String> genericClasses) { Object expressionResult = compileAndExecute(rawExpression, Collections.emptyMap()); Class<Object> requiredClass = loadClass(className, classLoader); if (expressionResult != null && !requiredClass.isAssignableFrom(expressionResult.getClass())) { throw new IllegalArgumentException("Cannot assign a '" + expressionResult.getClass().getCanonicalName() + "' to '" + requiredClass.getCanonicalName() + "'"); } return expressionResult; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { RepositorySearchWizard wizard = new RepositorySearchWizard( util.getConfiguredRepositories(), <START> false); <END> WizardDialog dialog = new WizardDialog(getShell(event), wizard); if (dialog.open() == Window.OK) { for (String dir : wizard.getDirectories()) { File repositoryDir = FileUtils.canonicalize(new File(dir)); addRepository(repositoryDir); } } return null; }</code><technical_language>True, now</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RepositorySearchWizard wizard = new RepositorySearchWizard( util.getConfiguredRepositories(), true); WizardDialog dialog = new WizardDialog(getShell(event), wizard); if (dialog.open() == Window.OK) { for (String dir : wizard.getDirectories()) { File repositoryDir = FileUtils.canonicalize(new File(dir)); addRepository(repositoryDir); } } return null; }
Source:
<code>public void testKnownInvalidConstructors() { try { @SuppressWarnings("unused") <START> QuantityType dt5 = new QuantityType("2°"); <END> fail(); } catch (Exception e) { } try { @SuppressWarnings("unused") QuantityType dt0 = new QuantityType("52°31′27″"); fail(); } catch (Exception e) { } }</code><technical_language>call c'tor w/o assignment. dont suppress warning</technical_language>

Target:
public void testKnownInvalidConstructors() throws Exception { new QuantityType<>("123 Hello World"); }
Source:
<code>private static boolean isLambdaParameter(DetailAST ast) { DetailAST parent; for (parent = ast.getParent(); parent != null; parent = parent.getParent()) { if (parent.getType() == TokenTypes.LAMBDA) { break; } } final boolean returnValue; if (parent == null) { returnValue = false; } else if (ast.getType() == TokenTypes.PARAMETER_DEF) { returnValue = true; } else { final DetailAST lambdaParameters = parent.findFirstToken(TokenTypes.PARAMETERS); if (lambdaParameters == null) { returnValue = parent.getFirstChild().getText().equals(ast.getText()); } else { returnValue = TokenUtils.findFirstTokenByPredicate(lambdaParameters, paramDef -> { final DetailAST param = paramDef.findFirstToken(TokenTypes.IDENT); return param != null && param.getText().equals(ast.getText()); }).isPresent(); } } <START> return returnValue; <END> }</code><technical_language>method name is isLambdaParameter, return variable is returnValue</technical_language>

Target:
private static boolean isLambdaParameter(DetailAST ast) { DetailAST parent; for (parent = ast.getParent(); parent != null; parent = parent.getParent()) { if (parent.getType() == TokenTypes.LAMBDA) { break; } } final boolean isLambdaParameter; if (parent == null) { isLambdaParameter = false; } else if (ast.getType() == TokenTypes.PARAMETER_DEF) { isLambdaParameter = true; } else { final DetailAST lambdaParameters = parent.findFirstToken(TokenTypes.PARAMETERS); if (lambdaParameters == null) { isLambdaParameter = parent.getFirstChild().getText().equals(ast.getText()); } else { isLambdaParameter = TokenUtils.findFirstTokenByPredicate(lambdaParameters, paramDef -> { final DetailAST param = paramDef.findFirstToken(TokenTypes.IDENT); return param != null && param.getText().equals(ast.getText()); }).isPresent(); } } return isLambdaParameter; }
Source:
<code>public void handle(HttpExchange t) throws IOException { if (RemoteUtil.deny(t)) { throw new IOException("Access denied"); } String id = RemoteUtil.getId("thumb/", t); LOGGER.trace("web thumb req " + id); if (id.contains("logo")) { RemoteUtil.sendLogo(t); return; } RootFolder root = parent.getRoot(RemoteUtil.userName(t), t); if (root == null) { LOGGER.debug("weird root in thumb req"); throw new IOException("Unknown root"); } final DLNAResource r = root.getDLNAResource(id, root.getDefaultRenderer()); if (r == null) { LOGGER.debug("media unknown"); throw new IOException("Bad id"); } InputStream in; if (!configuration.isShowCodeThumbs() && !r.isCodeValid(r)) { in = r.getGenericThumbnailInputStream(null); } else { r.checkThumbnail(); in = r.getThumbnailInputStream(); } in = ImagesUtil.convertImage(in, ImageFormat.JPEG); Headers hdr = t.getResponseHeaders(); <START> hdr.add("Content-Type", HTTPResource.JPEG_TYPEMIME); <END> hdr.add("Accept-Ranges", "bytes"); hdr.add("Connection", "keep-alive"); t.sendResponseHeaders(200, in.available()); OutputStream os = t.getResponseBody(); LOGGER.trace("input is output is {}", in, os); RemoteUtil.dump(in, os); }</code><technical_language>force JPEG? Webp PNG possible</technical_language>

Target:
public void handle(HttpExchange t) throws IOException { if (RemoteUtil.deny(t)) { throw new IOException("Access denied"); } String id = RemoteUtil.getId("thumb/", t); LOGGER.trace("web thumb req " + id); if (id.contains("logo")) { RemoteUtil.sendLogo(t); return; } RootFolder root = parent.getRoot(RemoteUtil.userName(t), t); if (root == null) { LOGGER.debug("weird root in thumb req"); throw new IOException("Unknown root"); } final DLNAResource r = root.getDLNAResource(id, root.getDefaultRenderer()); if (r == null) { LOGGER.debug("media unknown"); throw new IOException("Bad id"); } DLNAThumbnailInputStream in; if (!configuration.isShowCodeThumbs() && !r.isCodeValid(r)) { in = r.getGenericThumbnailInputStream(null); } else { r.checkThumbnail(); in = r.fetchThumbnailInputStream(); } if (r instanceof RealFile && FullyPlayed.isFullyPlayedThumbnail(((RealFile) r).getFile())) { in = FullyPlayed.addFullyPlayedOverlay(in); } Headers hdr = t.getResponseHeaders(); hdr.add("Content-Type", ImageFormat.PNG.equals(in.getFormat()) ? HTTPResource.PNG_TYPEMIME : HTTPResource.JPEG_TYPEMIME); hdr.add("Accept-Ranges", "bytes"); hdr.add("Connection", "keep-alive"); t.sendResponseHeaders(200, in.getSize()); OutputStream os = t.getResponseBody(); LOGGER.trace("Web thumbnail: Input is output is {}", in, os); RemoteUtil.dump(in, os); }
Source:
<code>public List<Client> find(final Clients clients, final WebContext context, final String clientNames) { final List<Client> result = new ArrayList<>(); for (final Client client : clients.findAllClients()) { if (client instanceof IndirectClient) { final IndirectClient indirectClient = (IndirectClient) client; indirectClient.init(); if (indirectClient.getCallbackUrlResolver().matches(indirectClient.getName(), context)) { result.add(indirectClient); } } } <START> if (result.size() == 0 && CommonHelper.isNotBlank(clientNames)) { <END> result.add(clients.findClient(clientNames)); } return result; }</code><technical_language>prefer isEmpty test emptyness :)</technical_language>

Target:
public List<Client> find(final Clients clients, final WebContext context, final String clientNames) { final List<Client> result = new ArrayList<>(); for (final Client client : clients.findAllClients()) { if (client instanceof IndirectClient) { final IndirectClient indirectClient = (IndirectClient) client; indirectClient.init(); if (indirectClient.getCallbackUrlResolver().matches(indirectClient.getName(), context)) { result.add(indirectClient); } } } if (result.isEmpty() && CommonHelper.isNotBlank(clientNames)) { result.add(clients.findClient(clientNames)); } return result; }
Source:
<code>public Map<String, Integer> getDevices() throws CoreException { if (sdkLocation == null) { sdkLocation = WPCore.getSDKLocation(); if (sdkLocation == null) { return null; } } File deployCmd = getDeployCommand(); StringBuilder cmdLine = new StringBuilder(); <START> cmdLine.append(deployCmd.getAbsolutePath()); <END> cmdLine.append(" /EnumerateDevices"); ExternalProcessUtility processUtility = new ExternalProcessUtility(); DeviceListParser parser = new DeviceListParser(); processUtility.execSync(cmdLine.toString(), null, parser, parser, monitor, null, null); return parser.parseDevices(); }</code><technical_language>Needs quotes added deployCmd.getAbsolutePath() fails find executable</technical_language>

Target:
public Map<String, Integer> getDevices() throws CoreException { if (sdkLocation == null) { sdkLocation = WPCore.getSDKLocation(); if (sdkLocation == null) { return null; } } File deployCmd = getDeployCommand(); StringBuilder cmdLine = new StringBuilder(); cmdLine.append(addQuotes(deployCmd.getAbsolutePath())); cmdLine.append(" /EnumerateDevices"); ExternalProcessUtility processUtility = new ExternalProcessUtility(); DeviceListParser parser = new DeviceListParser(); processUtility.execSync(cmdLine.toString(), null, parser, parser, monitor, null, null); return parser.parseDevices(); }
Source:
<code>public void shouldRunIndexPopulationJobAtShutdown() throws Throwable { IndexPopulator populator = mock( IndexPopulator.class ); SchemaIndexProvider provider = mock( SchemaIndexProvider.class ); when( provider.getProviderDescriptor() ).thenReturn( InMemoryIndexProviderFactory.PROVIDER_DESCRIPTOR ); when( provider.getPopulator( anyLong(), any( IndexDescriptor.class ), any( IndexConfiguration.class ), any( IndexSamplingConfig.class ) ) ).thenReturn( populator ); BatchInserter inserter = newBatchInserterWithSchemaIndexProvider( singleInstanceSchemaIndexProviderFactory( InMemoryIndexProviderFactory.KEY, provider ) ); inserter.createDeferredSchemaIndex( label( "Hacker" ) ).on( "handle" ).create(); long nodeId = inserter.createNode( map( "handle", "Jakewins" ), label( "Hacker" ) ); inserter.shutdown(); verify( provider ).init(); verify( provider ).start(); verify( provider ).getPopulator( anyLong(), any( IndexDescriptor.class ), any( IndexConfiguration.class ), any( IndexSamplingConfig.class ) ); verify( populator ).create(); <START> verify( populator ).add( singletonList( IndexEntryUpdate.add( nodeId, any(), "Jakewins" ) ) ); <END> verify( populator ).verifyDeferredConstraints( any( PropertyAccessor.class ) ); verify( populator ).close( true ); verify( provider ).stop(); verify( provider ).shutdown(); verifyNoMoreInteractions( populator ); }</code><technical_language>any() calls means</technical_language>

Target:
public void shouldRunIndexPopulationJobAtShutdown() throws Throwable { IndexPopulator populator = mock( IndexPopulator.class ); SchemaIndexProvider provider = mock( SchemaIndexProvider.class ); when( provider.getProviderDescriptor() ).thenReturn( InMemoryIndexProviderFactory.PROVIDER_DESCRIPTOR ); when( provider.getPopulator( anyLong(), any( IndexDescriptor.class ), any( IndexConfiguration.class ), any( IndexSamplingConfig.class ) ) ).thenReturn( populator ); BatchInserter inserter = newBatchInserterWithSchemaIndexProvider( singleInstanceSchemaIndexProviderFactory( InMemoryIndexProviderFactory.KEY, provider ) ); inserter.createDeferredSchemaIndex( label( "Hacker" ) ).on( "handle" ).create(); long nodeId = inserter.createNode( map( "handle", "Jakewins" ), label( "Hacker" ) ); inserter.shutdown(); verify( provider ).init(); verify( provider ).start(); verify( provider ).getPopulator( anyLong(), any( IndexDescriptor.class ), any( IndexConfiguration.class ), any( IndexSamplingConfig.class ) ); verify( populator ).create(); verify( populator ).add( singletonList( IndexEntryUpdate.add( nodeId, internalIndex, "Jakewins" ) ) ); verify( populator ).verifyDeferredConstraints( any( PropertyAccessor.class ) ); verify( populator ).close( true ); verify( provider ).stop(); verify( provider ).shutdown(); verifyNoMoreInteractions( populator ); }
Source:
<code>private void deleteBeforeRebuild(Connection conn) throws SQLException, IOException { if (MetaDataUtil.isViewIndex(pIndexTable.getPhysicalName().getString())) { throw new IllegalArgumentException(String.format( <START> " %s is a view index table. Delete all before rebuild is not supported for view indexes", <END> indexTable)); } if (isLocalIndexBuild) { throw new IllegalArgumentException(String.format( " %s is a local index. Delete all before rebuild is not supported for local indexes", indexTable)); } else { Admin admin = null; ConnectionQueryServices queryServices = conn.unwrap(PhoenixConnection.class).getQueryServices(); try { admin = queryServices.getAdmin(); TableName tableName = TableName.valueOf(qIndexTable); admin.disableTable(tableName); admin.truncateTable(tableName, false); } finally { if (admin != null) { admin.close(); } } } }</code><technical_language>Nits: 1: Space %s 2: 'view index table' 'view index'? 3: deleteall instead of 'Delete all' match option name 4: Do indexes indices</technical_language>

Target:
private void deleteBeforeRebuild(Connection conn) throws SQLException, IOException { if (MetaDataUtil.isViewIndex(pIndexTable.getPhysicalName().getString())) { throw new IllegalArgumentException(String.format( "%s is a view index. delete-all-and-rebuild is not supported for view indexes", indexTable)); } if (isLocalIndexBuild) { throw new IllegalArgumentException(String.format( "%s is a local index. delete-all-and-rebuild is not supported for local indexes", indexTable)); } else { ConnectionQueryServices queryServices = conn.unwrap(PhoenixConnection.class).getQueryServices(); try (Admin admin = queryServices.getAdmin()){ TableName tableName = TableName.valueOf(qIndexTable); admin.disableTable(tableName); admin.truncateTable(tableName, true); } } }
Source:
<code>public void junit_rule_error_collector() { <START> errorCollector.checkThat("123", equalTo("123")); <END> }</code><technical_language>unwanted change</technical_language>

Target:
public void junit_rule_error_collector() { errorCollector.checkThat("123", org.hamcrest.CoreMatchers.equalTo("123")); }
Source:
<code>public Set<ConnectorPlanOptimizer> getLogicalPlanOptimizers() { <START> return ImmutableSet.of(filterPushdownOptimizer); <END> }</code><technical_language>need new set object time; change variable type Set</technical_language>

Target:
public Set<ConnectorPlanOptimizer> getLogicalPlanOptimizers() { return planOptimizers; }
Source:
<code>private String processTransformation(String transformation, String response) { String transformedResponse = response; if (transformation == null) { return transformedResponse; } try { String[] parts = splitTransformationConfig(transformation); String transformationType = parts[0]; String transformationFunction = parts[1]; TransformationService transformationService = TransformationHelper .getTransformationService(SmarthomaticActivator.getContext(), transformationType); if (transformationService != null) { transformedResponse = transformationService.transform(transformationFunction, response); } else { transformedResponse = response; logger.warn("couldn't transform response because transformationService of type '{}' is unavailable", transformationType); } } catch (TransformationException te) { <START> logger.error("transformation throws exception [transformation=" + transformation + ", response=" + response <END> + "]", te); transformedResponse = response; } logger.debug("transformed response is '{}'", transformedResponse); return transformedResponse; }</code><technical_language>Please slf4j parametrization instead of string concatenation</technical_language>

Target:
private String processTransformation(String transformation, String response) { String transformedResponse = response; if (transformation == null) { return transformedResponse; } try { String[] parts = splitTransformationConfig(transformation); String transformationType = parts[0]; String transformationFunction = parts[1]; TransformationService transformationService = TransformationHelper .getTransformationService(SmarthomaticActivator.getContext(), transformationType); if (transformationService != null) { transformedResponse = transformationService.transform(transformationFunction, response); } else { transformedResponse = response; logger.warn("couldn't transform response because transformationService of type '{}' is unavailable", transformationType); } } catch (TransformationException te) { logger.error("transformation throws exception [transformation= {}, response= {}]", transformation, response); logger.error("received transformation exception", te); transformedResponse = response; } logger.debug("transformed response is '{}'", transformedResponse); return transformedResponse; }
Source:
<code>private WritableMap serializeEventData() { WritableArray barcodesList = Arguments.createArray(); for (int i = 0; i < mBarcodes.size(); i++) { Barcode barcode = mBarcodes.valueAt(i); WritableMap serializedBarcode = Arguments.createMap(); serializedBarcode.putString("data", barcode.displayValue); <START> serializedBarcode.putString("rawValue", barcode.rawValue); <END> serializedBarcode.putString("type", BarcodeFormatUtils.get(barcode.format)); barcodesList.pushMap(serializedBarcode); } WritableMap event = Arguments.createMap(); event.putString("type", "barcode"); event.putArray("barcodes", barcodesList); event.putInt("target", getViewTag()); return event; }</code><technical_language>This is implemented iOS. Check out: <LINK_0> Please name rawData instead of rawValue. if barcode a raw value? putString result in rawData null application crash</technical_language>

Target:
private WritableMap serializeEventData() { WritableArray barcodesList = Arguments.createArray(); for (int i = 0; i < mBarcodes.size(); i++) { Barcode barcode = mBarcodes.valueAt(i); WritableMap serializedBarcode = Arguments.createMap(); serializedBarcode.putString("data", barcode.displayValue); serializedBarcode.putString("rawData", barcode.rawValue); serializedBarcode.putString("type", BarcodeFormatUtils.get(barcode.format)); barcodesList.pushMap(serializedBarcode); } WritableMap event = Arguments.createMap(); event.putString("type", "barcode"); event.putArray("barcodes", barcodesList); event.putInt("target", getViewTag()); return event; }
Source:
<code>public TeamInviteToken inviteMember(Long teamId, String username) { User user = userService.getUserByUsername(username).orElseThrow(() -> new UsernameNotFoundException(username)); Team team = getTeamById(teamId); List<TeamInviteToken> currentTeamInvites = teamInviteTokenRepository.findByUserUsername(username).stream() <START> .filter(token -> token.getTeam().equals(team)).collect(Collectors.toList()); <END> if (!team.getMembers().contains(user) && currentTeamInvites.isEmpty()) { String token = UUID.randomUUID().toString(); TeamInviteToken inviteToken = new TeamInviteToken(token, user, team); teamInviteTokenRepository.save(inviteToken); try { mailService.sendTeamInviteMail(user, team.getTeamName(), team.getCaptain()); } catch (MessagingException e) { e.printStackTrace(); } return inviteToken; } else { throw new IllegalArgumentException("User is already a member of this team or already invited"); } }</code><technical_language>A bit more optimized Stream::findFirst. For large sets, stops immediately finds item, instead of iterating set. This solution of works too, optimization</technical_language>

Target:
public TeamInviteToken inviteMember(Long teamId, String username) { User user = userService.getUserByUsername(username).orElseThrow(() -> new UsernameNotFoundException(username)); Team team = getTeamById(teamId); Optional<TeamInviteToken> optionalInvite = teamInviteTokenRepository.findByUserUsername(username).stream(). filter(token -> token.getTeam().equals(team)).findFirst(); if (!team.getMembers().contains(user) && !optionalInvite.isPresent()) { String token = UUID.randomUUID().toString(); TeamInviteToken inviteToken = new TeamInviteToken(token, user, team); teamInviteTokenRepository.save(inviteToken); try { mailService.sendTeamInviteMail(user, team.getTeamName(), team.getCaptain()); } catch (MessagingException e) { e.printStackTrace(); } return inviteToken; } else { throw new IllegalArgumentException("User is already a member of this team or already invited"); } }
Source:
<code>public static synchronized void addToCache(AttestationValue value){ <START> if (!attestationValues.containsKey(value.getHostName())) <END> attestationValues.putIfAbsent(value.getHostName(), value); }</code><technical_language>This "if" is needed, "putIfAbsent" method performs check, doees in a atomic way, "synchronized" modifier is required</technical_language>

Target:
public void addToCache(AttestationValue value) { attestationValues.putIfAbsent(value.getHostName(), value); }
Source:
<code>String extractDate(final String value) { <START> return value.substring(0, 10); <END> }</code><technical_language>please introduce a constant DATE_PORTION_LENGTH DATE_PORTION_LENGTH + 1 in extractTime? Feel free name of constant I code easier understand</technical_language>

Target:
String extractDate(final String value) { return value.substring(0, DATE_LENGTH); }
Source:
<code>BufferedLogChannel getCurrentLogForLedgerForAddEntry(long ledgerId, int entrySize, boolean rollLog) throws IOException { Lock lock = getLock(ledgerId); lock.lock(); try { BufferedLogChannelWithDirInfo logChannelWithDirInfo = getCurrentLogWithDirInfoForLedger(ledgerId); BufferedLogChannel logChannel = null; if (logChannelWithDirInfo != null) { logChannel = logChannelWithDirInfo.getLogChannel(); } boolean reachEntryLogLimit = rollLog ? reachEntryLogLimit(logChannel, entrySize) : readEntryLogHardLimit(logChannel, entrySize); boolean diskFull = (logChannel == null) ? false : logChannelWithDirInfo.isLedgerDirFull(); boolean allDisksFull = !ledgerDirsManager.hasWritableLedgerDirs(); if ((diskFull && (!allDisksFull)) || reachEntryLogLimit || (logChannel == null)) { if (logChannel != null) { logChannel.flushAndForceWriteIfRegularFlush(false); } createNewLog(ledgerId, ": diskFull = " + diskFull + ", allDisksFull = " + allDisksFull <START> + ", reachEntryLogLimit = " + reachEntryLogLimit); <END> } return getCurrentLogForLedger(ledgerId); } finally { lock.unlock(); } }</code><technical_language>get this block if logChannel is null. add aswell reason string</technical_language>

Target:
BufferedLogChannel getCurrentLogForLedgerForAddEntry(long ledgerId, int entrySize, boolean rollLog) throws IOException { Lock lock = getLock(ledgerId); lock.lock(); try { BufferedLogChannelWithDirInfo logChannelWithDirInfo = getCurrentLogWithDirInfoForLedger(ledgerId); BufferedLogChannel logChannel = null; if (logChannelWithDirInfo != null) { logChannel = logChannelWithDirInfo.getLogChannel(); } boolean reachEntryLogLimit = rollLog ? reachEntryLogLimit(logChannel, entrySize) : readEntryLogHardLimit(logChannel, entrySize); boolean diskFull = (logChannel == null) ? false : logChannelWithDirInfo.isLedgerDirFull(); boolean allDisksFull = !ledgerDirsManager.hasWritableLedgerDirs(); if ((diskFull && (!allDisksFull)) || reachEntryLogLimit || (logChannel == null)) { if (logChannel != null) { logChannel.flushAndForceWriteIfRegularFlush(false); } createNewLog(ledgerId, ": diskFull = " + diskFull + ", allDisksFull = " + allDisksFull + ", reachEntryLogLimit = " + reachEntryLogLimit + ", logChannel = " + logChannel); } return getCurrentLogForLedger(ledgerId); } finally { lock.unlock(); } }
Source:
<code>public static VitalMultiMap toMetric(VitalMultiMap vitalMap) { for (int dateIndex = 0; dateIndex < vitalMap.getDateListChronological().size(); dateIndex++) { String tempC = vitalMap.get("temperature", vitalMap.getDate(dateIndex)); if (tempC != null) { vitalMap.put("temperature", vitalMap.getDate(dateIndex), getCelcius(tempC)); <START> vitalMap.put("temperatureC", vitalMap.getDate(dateIndex), tempC); END> } String feetS = vitalMap.get("heightFeet", vitalMap.getDate(dateIndex)); String inchesS = vitalMap.get("heightInches", vitalMap.getDate(dateIndex)); if (feetS != null && inchesS != null) { Integer meters = getMeters(feetS, inchesS); Integer cm = getCentimetres(feetS, inchesS); vitalMap.put("heightMeters", vitalMap.getDate(dateIndex), meters); vitalMap.put("heightCm", vitalMap.getDate(dateIndex), String.format("%02d", cm)); } String lbs = vitalMap.get("weight", vitalMap.getDate(dateIndex)); if (lbs != null) { vitalMap.put("weightKgs", vitalMap.getDate(dateIndex), getKgs(lbs)); } } return vitalMap; }</code><technical_language>Is C supposed stand for Celsius this more sense "temperatureF" "temperatureFahrenheit"</technical_language>

Target:
public static VitalMultiMap toMetric(VitalMultiMap vitalMap) { for (int dateIndex = 0; dateIndex < vitalMap.getDateListChronological().size(); dateIndex++) { String tempC = vitalMap.get("temperature", vitalMap.getDate(dateIndex)); if (tempC != null) { vitalMap.put("temperatureCelsius", vitalMap.getDate(dateIndex), getCelcius(tempC)); } String feetS = vitalMap.get("heightFeet", vitalMap.getDate(dateIndex)); String inchesS = vitalMap.get("heightInches", vitalMap.getDate(dateIndex)); if (feetS != null && inchesS != null) { Integer meters = getMeters(feetS, inchesS); Integer cm = getCentimetres(feetS, inchesS); vitalMap.put("heightMeters", vitalMap.getDate(dateIndex), meters); vitalMap.put("heightCm", vitalMap.getDate(dateIndex), String.format("%02d", cm)); } String lbs = vitalMap.get("weight", vitalMap.getDate(dateIndex)); if (lbs != null) { vitalMap.put("weightKgs", vitalMap.getDate(dateIndex), getKgs(lbs)); } } return vitalMap; }
Source:
<code>protected void createContents(Composite parent) { text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); <START> Font monospace = new Font(text.getDisplay(), new FontData("Courier New", text.getFont().getFontData()[0].getHeight(), SWT.NORMAL)); <END> text.setFont(monospace); text.addDisposeListener(e -> { monospace.dispose(); }); textObservable = new TextObservableValue(text, null, SWT.FocusOut); textObservable.addChangeListener(new IChangeListener() { @Override public void handleChange(ChangeEvent event) { if (text.getText().equals(expression.getBody())) { return; } Expression oldEx = new Expression(); oldEx.setLanguage(expression.getLanguage()); oldEx.setBody(expression.getBody()); expression.setBody(text.getText()); ValueDiff<Expression> diff = Diffs.createValueDiff(oldEx, expression); fireValueChange(diff); } }); }</code><technical_language>This JFace shared text font is configurable user in preferences defaults a platform-appropriate monospaced font intended for in text/code editors. JFaceResources.getTextFont() API</technical_language>

Target:
protected void createContents(Composite parent) { text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); text.setFont(JFaceResources.getTextFont()); textObservable = new TextObservableValue(text, null, SWT.FocusOut); textObservable.addChangeListener(new IChangeListener() { @Override public void handleChange(ChangeEvent event) { if (text.getText().equals(expression.getBody())) { return; } Expression oldEx = new Expression(); oldEx.setLanguage(expression.getLanguage()); oldEx.setBody(expression.getBody()); expression.setBody(text.getText()); ValueDiff<Expression> diff = Diffs.createValueDiff(oldEx, expression); fireValueChange(diff); } }); }
Source:
<code>public MaxwellRedisProducer(MaxwellContext context) { super(context); this.channel = context.getConfig().redisKey; this.interpolateChannel = channel.contains("%{"); this.redisType = context.getConfig().redisType; <START> if (jedisPool == null) { <END> jedisPool = new JedisPool( createdRedisPoolConfig(), context.getConfig().redisHost, context.getConfig().redisPort, Protocol.DEFAULT_TIMEOUT, context.getConfig().redisAuth, context.getConfig().redisDatabase); } }</code><technical_language>I worry / support case call super mucked jedisPool (it's deprecated), in other words eliminate null check here</technical_language>

Target:
public MaxwellRedisProducer(MaxwellContext context) { super(context); this.channel = context.getConfig().redisKey; this.interpolateChannel = channel.contains("%{"); this.redisType = context.getConfig().redisType; jedisPool = new JedisPool( createRedisPoolConfig(), context.getConfig().redisHost, context.getConfig().redisPort, Protocol.DEFAULT_TIMEOUT, context.getConfig().redisAuth, context.getConfig().redisDatabase); }
Source:
<code>public void testDisableCluster() throws Exception { ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient); ClusterConfig clusterConfig = configAccessor.getClusterConfig(CLUSTER_NAME); clusterConfig.setMaxPartitionsPerInstance(10); configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig); int i = 0; for (String stateModel : TestStateModels) { String db = "Test-DB-" + i++; int replica = 3; createResourceWithDelayedRebalance(CLUSTER_NAME, db, stateModel, _PARTITIONS, replica, replica, -1); _testDBs.add(db); } Thread.sleep(100L); Assert.assertTrue(_clusterVerifier.verifyByPolling()); MaintenanceSignal maintenanceSignal = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); Assert.assertNull(maintenanceSignal); for (i = 2; i < NUM_NODE; i++) { _participants.get(i).syncStop(); } boolean result = TestHelper.verify(() -> { MaintenanceSignal ms = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); <START> return ms != null && ms.getReason() != null; <END> }, TestHelper.WAIT_DURATION); }</code><technical_language>Assert</technical_language>

Target:
public void testDisableCluster() throws Exception { ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient); ClusterConfig clusterConfig = configAccessor.getClusterConfig(CLUSTER_NAME); clusterConfig.setMaxPartitionsPerInstance(10); configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig); int i = 0; for (String stateModel : TestStateModels) { String db = "Test-DB-" + i++; int replica = 3; createResourceWithDelayedRebalance(CLUSTER_NAME, db, stateModel, _PARTITIONS, replica, replica, -1); _testDBs.add(db); } Assert.assertTrue(_clusterVerifier.verifyByPolling()); MaintenanceSignal maintenanceSignal = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); Assert.assertNull(maintenanceSignal); for (i = 2; i < NUM_NODE; i++) { _participants.get(i).syncStop(); } boolean result = TestHelper.verify(() -> { MaintenanceSignal ms = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance()); return ms != null && ms.getReason() != null; }, TestHelper.WAIT_DURATION); Assert.assertTrue(result); }