auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void cleanup(Work work, Exception exception) { try { work.cleanUp(true, exception); } catch (Exception e) { <START> log.error("Fail to cleanup work: " + work.getId()); <END> } }</code><technical_language>Add stack trace exception</technical_language>

Target:
protected void cleanup(Work work, Exception exception) { try { work.cleanUp(true, exception); } catch (Exception e) { log.error(work.getId() + ": Failure on cleanup", e); } }
Source:
<code>private Repository init(URIish u) { InitCommand command = Git.init(); command.setBare(bare); if (directory == null) directory = new File(u.getHumanishName(), Constants.DOT_GIT); <START> if (directory.exists() && directory.listFiles().length != 0) { <END> throw new JGitInternalException(MessageFormat.format( JGitText.get().cloneNonEmptyDirectory, directory.getName())); } command.setDirectory(directory); return command.call().getRepository(); }</code><technical_language>add else statement - check is necessary if directory newly created</technical_language>

Target:
private Repository init(URIish u) { InitCommand command = Git.init(); command.setBare(bare); if (directory == null) directory = new File(u.getHumanishName(), Constants.DOT_GIT); if (directory.exists() && directory.listFiles().length != 0) { throw new JGitInternalException(MessageFormat.format( JGitText.get().cloneNonEmptyDirectory, directory.getName())); } else { } command.setDirectory(directory); return command.call().getRepository(); }
Source:
<code>public SeenExchanges visitAggregation(AggregationNode node, Void context) { SeenExchanges seenExchanges = aggregatedSeenExchanges(node.getSources()); if (!node.getStep().equals(FINAL) || !node.hasEmptyGroupingSet()) { return NO_EXCHANGES_SEEN; } if (seenExchanges.remoteRepartitionExchange) { return NO_EXCHANGES_SEEN; } ActualProperties globalProperties = PropertyDerivations.derivePropertiesRecursively(node, metadata, session, types, parser); checkArgument(forceSingleNode || globalProperties.isSingleNode(), "Final aggregation with default value not separated from partial aggregation by remote hash exchange"); if (!seenExchanges.localRepartitionExchange) { StreamProperties localProperties = StreamPropertyDerivations.derivePropertiesRecursively(node, metadata, session, types, parser); checkArgument(localProperties.isSingleStream(), "Final aggregation with default value not separated from partial aggregation by local hash exchange"); <START> } <END> return NO_EXCHANGES_SEEN; }</code><technical_language>Add sth like: // interested in FINAL aggregations empty grouping set</technical_language>

Target:
public Optional<SeenExchanges> visitAggregation(AggregationNode node, Void context) { Optional<SeenExchanges> seenExchangesOptional = aggregatedSeenExchanges(node.getSources()); if (node.getStep().equals(PARTIAL)) { return Optional.of(new SeenExchanges(false, false)); } if (node.getStep().equals(INTERMEDIATE)) { return seenExchangesOptional; } if (!node.getStep().equals(FINAL) || !node.hasEmptyGroupingSet()) { return Optional.empty(); } checkState(seenExchangesOptional.isPresent(), "No partial aggregation below final aggregation"); SeenExchanges seenExchanges = seenExchangesOptional.get(); if (seenExchanges.remoteRepartitionExchange) { return Optional.empty(); } ActualProperties globalProperties = PropertyDerivations.derivePropertiesRecursively(node, metadata, session, types, parser); checkArgument(forceSingleNode || globalProperties.isSingleNode(), "Final aggregation with default value not separated from partial aggregation by remote hash exchange"); if (!seenExchanges.localRepartitionExchange) { StreamProperties localProperties = StreamPropertyDerivations.derivePropertiesRecursively(node, metadata, session, types, parser); checkArgument(localProperties.isSingleStream(), "Final aggregation with default value not separated from partial aggregation by local hash exchange"); } return Optional.empty(); }
Source:
<code>public void write(URL url) throws IllegalArgumentException, IOException, InterruptedException { LockFile lockFile = new LockFile(file.toFile()); for (int retryCount = 0; retryCount < LOCK_ACQUIRE_MAX_RETRY_COUNT; retryCount++) { if (lockFile.lock()) { try { if (snapshot.isModified(file.toFile())) { LOG.debug( "Reading the underlying cookie file '{}' as it has been modified since the last access", file); Set<HttpCookie> cookiesFromFile = NetscapeCookieFile .read(file, creationDate); this.cookies = mergeCookies(cookiesFromFile, cookies); } <START> write(file, cookies, url, creationDate); <END> } finally { lockFile.unlock(); } return; } Thread.sleep(LOCK_ACQUIRE_RETRY_SLEEP); } throw new IOException( MessageFormat.format(JGitText.get().cannotLock, lockFile)); }</code><technical_language>normal LockFile is write LockFile's OutputStream commit() lockFile. worry creating a temporary file renaming that; LockFile for you</technical_language>

Target:
public void write(URL url) throws IllegalArgumentException, IOException, InterruptedException { LockFile lockFile = new LockFile(file.toFile()); for (int retryCount = 0; retryCount < LOCK_ACQUIRE_MAX_RETRY_COUNT; retryCount++) { if (lockFile.lock()) { try { if (snapshot.isModified(file.toFile())) { LOG.debug( "Reading the underlying cookie file '{}' as it has been modified since the last access", file); Set<HttpCookie> cookiesFromFile = NetscapeCookieFile .read(file, creationDate); this.cookies = mergeCookies(cookiesFromFile, cookies); } try (OutputStream output = new BufferedOutputStream( lockFile.getOutputStream()); Writer writer = new OutputStreamWriter(output, StandardCharsets.US_ASCII)) { write(writer, cookies, url, creationDate); } lockFile.commit(); } finally { lockFile.unlock(); } return; } Thread.sleep(LOCK_ACQUIRE_RETRY_SLEEP); } throw new IOException( MessageFormat.format(JGitText.get().cannotLock, lockFile)); }
Source:
<code>public String handleCallBack(HttpMessage msg) throws ApiException { if (observer == null) { this.extension.addAllChannelObserver(this.getWebSocketObserver()); } <START> try { <END> LOG.debug("callback url = " + msg.getRequestHeader().getURI()); String connectionHeader = msg.getRequestHeader().getHeader("connection"); String upgradeHeader = msg.getRequestHeader().getHeader("upgrade"); if (connectionHeader != null && connectionHeader.toLowerCase().contains("upgrade")) { if (upgradeHeader != null && upgradeHeader.equalsIgnoreCase("websocket")) { msg.setResponseHeader(API.getDefaultResponseHeader("101 Switching Protocols", null, 0)); msg.getResponseHeader().setHeader("Content-Type", null); msg.getResponseHeader().setHeader("Connection", "Upgrade"); msg.getResponseHeader().setHeader("Upgrade", "websocket"); String secWebSocketKey = msg.getRequestHeader().getHeader("Sec-WebSocket-Key"); msg.getResponseHeader() .setHeader("Sec-WebSocket-Accept", WebSocketUtils.encodeWebSocketKey(secWebSocketKey)); } } return ""; } catch (Exception e) { throw new ApiException(ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString()); } }</code><technical_language>For consistency drop cap Back</technical_language>

Target:
public String handleCallBack(HttpMessage msg) throws ApiException { try { if (LOG.isDebugEnabled()) { LOG.debug("callback url = " + msg.getRequestHeader().getURI()); } String connectionHeader = msg.getRequestHeader().getHeader(HttpHeader.CONNECTION); String upgradeHeader = msg.getRequestHeader().getHeader("upgrade"); if (connectionHeader != null && connectionHeader.toLowerCase().contains("upgrade")) { if (upgradeHeader != null && upgradeHeader.equalsIgnoreCase("websocket")) { msg.setResponseHeader(API.getDefaultResponseHeader("101 Switching Protocols", null, 0)); msg.getResponseHeader().setHeader(HttpHeader.CONTENT_TYPE, null); msg.getResponseHeader().setHeader(HttpHeader.CONNECTION, "Upgrade"); msg.getResponseHeader().setHeader("Upgrade", "websocket"); String secWebSocketKey = msg.getRequestHeader().getHeader("Sec-WebSocket-Key"); msg.getResponseHeader() .setHeader("Sec-WebSocket-Accept", WebSocketUtils.encodeWebSocketKey(secWebSocketKey)); } } return ""; } catch (Exception e) { throw new ApiException(ApiException.Type.URL_NOT_FOUND, msg.getRequestHeader().getURI().toString()); } }
Source:
<code>IndexTuningConfig computeTuningConfig() { IndexTuningConfig newTuningConfig = tuningConfig == null ? IndexTuningConfig.createDefault() : tuningConfig; newTuningConfig = newTuningConfig.withPartitionsSpec(newTuningConfig.getGivenOrDefaultPartitionsSpec()); if (newTuningConfig.getPartitionsSpec() instanceof DynamicPartitionsSpec) { final DynamicPartitionsSpec dynamicPartitionsSpec = (DynamicPartitionsSpec) newTuningConfig.getPartitionsSpec(); return newTuningConfig.withPartitionsSpec( new DynamicPartitionsSpec( dynamicPartitionsSpec.getMaxRowsPerSegment(), <START> dynamicPartitionsSpec.getMaxTotalRowsOr(Long.MAX_VALUE) <END> ) ); } else { return newTuningConfig; } }</code><technical_language>Alternative allocates TuningConfig for DynamicPartitionsSpec case: java PartitionsSpec partitionsSpec = newTuningConfig.getGivenOrDefaultPartitionsSpec()); if (partitionsSpec instanceof DynamicPartitionsSpec) { final DynamicPartitionsSpec dynamicPartitionsSpec = (DynamicPartitionsSpec) partitionsSpec; partitionsSpec = new DynamicPartitionsSpec( dynamicPartitionsSpec.getMaxRowsPerSegment(), dynamicPartitionsSpec.getMaxTotalRowsOr(Long.MAX_VALUE), ); } return newTuningConfig.withPartitionsSpec(partitionsSpec);</technical_language>

Target:
IndexTuningConfig computeTuningConfig() { IndexTuningConfig newTuningConfig = tuningConfig == null ? IndexTuningConfig.createDefault() : tuningConfig; PartitionsSpec partitionsSpec = newTuningConfig.getGivenOrDefaultPartitionsSpec(); if (partitionsSpec instanceof DynamicPartitionsSpec) { final DynamicPartitionsSpec dynamicPartitionsSpec = (DynamicPartitionsSpec) partitionsSpec; partitionsSpec = new DynamicPartitionsSpec( dynamicPartitionsSpec.getMaxRowsPerSegment(), dynamicPartitionsSpec.getMaxTotalRowsOr(Long.MAX_VALUE) ); } return newTuningConfig.withPartitionsSpec(partitionsSpec); }
Source:
<code>public void processEvent(Schema schema, MaxwellFilter filter, TableMapEvent event) { Long tableId = event.getTableId(); if ( !tableMapCache.containsKey(tableId) ) { String dbName = new String(event.getDatabaseName().getValue()); String tblName = new String(event.getTableName().getValue()); Database db = schema.findDatabase(dbName); if ( db == null ) throw new RuntimeException("Couldn't find database " + dbName); Table tbl = db.findTable(tblName); <START> if ( filter != null && filter.isTableBlacklisted(tbl.getDatabase().getName(), tblName) ) <END> blacklistedTableCache.put(tableId, tblName); else if ( tbl == null ) throw new RuntimeException("Couldn't find table " + tblName); else tableMapCache.put(tableId, tbl); } }</code><technical_language>@jpeyper eyes sort of glossed this line, in local testing I subject crashing -- if database is blacklisted, db.findTable() return null (if process CREATE TABLE ddl), call schema.findDatabase return null (if process CREATE DATABASE ddl). do integration test sets a database blacklist runs a scenarios? notably: - create DB - capture schema - blacklist DB - create table DB.tbl - insert DB.tbl - capture schema - blacklist DB - create DB - create tbl - insert DB.tbl</technical_language>

Target:
public void processEvent(Schema schema, MaxwellFilter filter, TableMapEvent event) { Long tableId = event.getTableId(); if ( !tableMapCache.containsKey(tableId) ) { String dbName = new String(event.getDatabaseName().getValue()); String tblName = new String(event.getTableName().getValue()); Database db = schema.findDatabase(dbName); if ( filter != null && filter.isTableBlacklisted(dbName, tblName) ) blacklistedTableCache.put(tableId, tblName); else if ( db == null ) throw new RuntimeException("Couldn't find database " + dbName); else { Table tbl = db.findTable(tblName); if (tbl == null) throw new RuntimeException("Couldn't find table " + tblName); else tableMapCache.put(tableId, tbl); } } }
Source:
<code>public String putBlob(BlobProperties blobProperties, ByteBuffer userMetadata, InputStream blobStream) throws CoordinatorException { if (blobProperties == null) { throw new IllegalArgumentException("BlobProperties argument to put operation is null."); } if (userMetadata == null) { throw new IllegalArgumentException("User metadata argument to put operation is null."); } if (blobStream == null) { throw new IllegalArgumentException("Blob stream argument to put operation is null."); } <START> OperationContext oc = getOperationContext(); <END> PartitionId partitionId = getPartitionForPut(); BlobId blobId = new BlobId(partitionId); new PutOperation(datacenterName, connectionPool, requesterPool, oc, blobId, operationTimeoutMs, blobProperties, userMetadata, blobStream).execute(); return blobId.toString(); }</code><technical_language>name for this</technical_language>

Target:
public String putBlob(BlobProperties blobProperties, ByteBuffer userMetadata, InputStream blobStream) throws CoordinatorException { if (blobProperties == null) { logger.info("Caller passed in null blobProperties."); throw new CoordinatorException("BlobProperties argument to put operation is null.", CoordinatorError.InvalidPutArgument); } if (userMetadata == null) { logger.info("Caller passed in null userMetadata."); throw new CoordinatorException("UserMetadata argument to put operation is null.", CoordinatorError.InvalidPutArgument); } if (blobStream == null) { logger.info("Caller passed in null blobStream."); throw new CoordinatorException("Blob stream argument to put operation is null.", CoordinatorError.InvalidPutArgument); } PartitionId partitionId = getPartitionForPut(); BlobId blobId = new BlobId(partitionId); PutOperation putOperation = new PutOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs, blobProperties, userMetadata, blobStream); putOperation.execute(); return blobId.toString(); }
Source:
<code>private static boolean isSameSymbol(ExpressionTree tree, ExpressionTree other) { <START> return Optional.ofNullable(symbol(tree)).map(s -> s.equals(symbol(other))).orElse(false); <END> }</code><technical_language>I this usage of Optional is adding in terms of clarity. usual control flow constructs is more straightforward in Java</technical_language>

Target:
private static boolean isSameSymbol(ExpressionTree tree, ExpressionTree other) { Symbol s = symbol(tree); return s != null && s.equals(symbol(other)); }
Source:
<code>public boolean changeState(@Selector String name, State state) { Assert.notNull(name, "'name' must not be null"); <START> Assert.notNull(name, "'state' must not be null"); <END> Binding<?> binding = BindingsEndpoint.this.locateBinding(name); if (binding != null) { switch (state) { case STARTED: binding.start(); return true; case STOPPED: binding.stop(); return true; case PAUSED: binding.pause(); return true; case RESUMED: binding.resume(); return true; default: break; } } return false; }</code><technical_language>If asserts do anything, a bug in Spring Boot. get null if argument is annotated @Nullable. endpoint called if a required parameter is missing. For example, a POST missing a state automatically rejected a 400 response</technical_language>

Target:
public void changeState(@Selector String name, State state) { Binding<?> binding = BindingsEndpoint.this.locateBinding(name); if (binding != null) { switch (state) { case STARTED: binding.start(); break; case STOPPED: binding.stop(); break; case PAUSED: binding.pause(); break; case RESUMED: binding.resume(); break; default: break; } } }
Source:
<code>void scheduleMessage() { long sequenceNumberReturned =10; when(managementNode.schedule(any(ServiceBusMessage.class), any(Instant.class))) .thenReturn(just(sequenceNumberReturned)); <START> StepVerifier.create(sender.scheduleMessage(mock(ServiceBusMessage.class), mock(Instant.class))) <END> .expectNext(sequenceNumberReturned) .verifyComplete(); }</code><technical_language>more specific create a mock of message if managementNode a schedule call instance return number. any() in case parameter variable specific test case checking</technical_language>

Target:
void scheduleMessage() { long sequenceNumberReturned = 10; Instant instant = mock(Instant.class); when(connection.createSendLink(eq(ENTITY_NAME), eq(ENTITY_NAME), any(AmqpRetryOptions.class))) .thenReturn(Mono.just(sendLink)); when(sendLink.getLinkSize()).thenReturn(Mono.just(MAX_MESSAGE_LENGTH_BYTES)); when(managementNode.schedule(eq(message), eq(instant), any(Integer.class))) .thenReturn(just(sequenceNumberReturned)); StepVerifier.create(sender.scheduleMessage(message, instant)) .expectNext(sequenceNumberReturned) .verifyComplete(); verify(managementNode).schedule(message, instant, MAX_MESSAGE_LENGTH_BYTES); }
Source:
<code>protected void sanityCheckTableName(TableReference tableRef) { <START> String tableName = tableRef.getQualifiedName(); <END> Validate.isTrue( (!tableName.startsWith("_") && (tableName.contains("."))) && ALLOWED_TABLE_NAMES.matcher(tableName).matches() || AtlasDbConstants.hiddenTables.contains(tableRef) || tableName.startsWith(AtlasDbConstants.NAMESPACE_PREFIX), "invalid tableName: ", tableName); }</code><technical_language>This matter internal preconditions stuff deals safe logging correctly. concerned stack trace pretty clear</technical_language>

Target:
protected void sanityCheckTableName(TableReference tableRef) { String tableName = tableRef.getQualifiedName(); Validate.isTrue( (!tableName.startsWith("_") && tableName.contains(".") && ALLOWED_TABLE_NAMES.matcher(tableName).matches()) || AtlasDbConstants.hiddenTables.contains(tableRef) || tableName.startsWith(AtlasDbConstants.NAMESPACE_PREFIX), "invalid tableName: ", tableName); }
Source:
<code>protected FastLocalCacheProvider( final PartyLineCacheProvider plCacheProvider, final Cache<String, String> nfsUsageCache, final PathGenerator pathGenerator, final FileEventManager fileEventManager, final TransferDecorator transferDecorator, final ExecutorService executor, final String nfsBaseDir ) { this.plCacheProvider = plCacheProvider; if ( nfsUsageCache != null ) <START> { <END> this.nfsOwnerCache = nfsUsageCache; } else { this.nfsOwnerCache = new NFSOwnerCacheProducer().getCacheMgr().getCache( NFSOwnerCacheProducer.CACHE_NAME ); } this.pathGenerator = pathGenerator; this.fileEventManager = fileEventManager; this.transferDecorator = transferDecorator; this.executor = executor; setNfsBaseDir( nfsBaseDir ); init(); }</code><technical_language>I support null case here. force user supply something, if want call NFSOwnerCacheProducer themselves, can. leave class in place automatically</technical_language>

Target:
protected FastLocalCacheProvider( final PartyLineCacheProvider plCacheProvider, final Cache<String, String> nfsUsageCache, final PathGenerator pathGenerator, final FileEventManager fileEventManager, final TransferDecorator transferDecorator, final ExecutorService executor, final String nfsBaseDir ) { this.plCacheProvider = plCacheProvider; this.nfsOwnerCache = nfsUsageCache; this.pathGenerator = pathGenerator; this.fileEventManager = fileEventManager; this.transferDecorator = transferDecorator; this.executor = executor; setNfsBaseDir( nfsBaseDir ); init(); }
Source:
<code>public void testDenyReadWrites() throws InterruptedException { RemoteCacheManager cacheManager = ITestUtils.createCacheManager(server2); RemoteCache<Object, Object> cache = cacheManager.getCache(DENY_READ_WRITES_CACHE); String server1OwnedKey = getKeyOwnedByNode(server1Address, cacheManager, cache, 1); String server3OwnedKey = getKeyOwnedByNode(server3Address, cacheManager, cache, 1); partitionCluster(); RemoteCache<Object, Object> denyReadWritesCache1 = ITestUtils.createCacheManager(server1).getCache(DENY_READ_WRITES_CACHE); RemoteCache<Object, Object> denyReadWritesCache3 = ITestUtils.createCacheManager(server3).getCache(DENY_READ_WRITES_CACHE); <START> <END> denyReadWritesCache1.put(server1OwnedKey, "value"); assertEquals("value", denyReadWritesCache1.get(server1OwnedKey)); assertThrowsHotRodClientException(() -> denyReadWritesCache1.put(server3OwnedKey, "value")); assertThrowsHotRodClientException(() -> denyReadWritesCache1.get(server3OwnedKey)); denyReadWritesCache3.put(server3OwnedKey, "value"); assertEquals("value", denyReadWritesCache3.get(server3OwnedKey)); assertThrowsHotRodClientException(() -> denyReadWritesCache3.put(server1OwnedKey, "value")); assertThrowsHotRodClientException(() -> denyReadWritesCache3.get(server1OwnedKey)); healCluster(); }</code><technical_language>Other cache name, content of testAllowReads testDenyReadWrites is same. create method this logic takes cache name a param simply call this in test methods name</technical_language>

Target:
public void testDenyReadWrites() throws InterruptedException { testCommonLogic(DENY_READ_WRITES_CACHE); }
Source:
<code>public void shouldRemoveDiscountCode() throws Exception { withCartDiscountAndDiscountCode(sphereClient, discountCode -> { withTaxedFilledAndDiscountedCart(sphereClient, discountCode, cart -> { when(cartInSession.findCartId()).thenReturn(Optional.of(cart.getId())); final Map<String, String> bodyForm = new HashMap<>(); bodyForm.put("discountCodeId", discountCode.getId()); final Result result = route(new Http.RequestBuilder() .uri("/en/cart/discount/remove") .method(POST) .bodyForm(bodyForm)); <START> assertThat(result.status()).isEqualTo(SEE_OTHER); <END> return cart; }); return discountCode; }); }</code><technical_language>Consider checking location of redirection too</technical_language>

Target:
public void shouldRemoveDiscountCode() throws Exception { withCartDiscountAndDiscountCode(sphereClient, discountCode -> { withTaxedFilledAndDiscountedCart(sphereClient, discountCode, cart -> { when(cartInSession.findCartId()).thenReturn(Optional.of(cart.getId())); final Map<String, String> bodyForm = new HashMap<>(); bodyForm.put("discountCodeId", discountCode.getId()); final Result result = route(new Http.RequestBuilder() .uri("/en/cart/discount/remove") .method(POST) .bodyForm(bodyForm)); assertThat(result.status()).isEqualTo(SEE_OTHER); assertThat(result.redirectLocation()) .isPresent() .hasValue("/en/cart"); return cart; }); return discountCode; }); }
Source:
<code>public MethodDeclaration method(List<IExtendedModifier> modifiers, String methodName, List<SingleVariableDeclaration> parameters, Block block) { <START> MethodDeclaration methodDeclaration = getAST().newMethodDeclaration(); <END> methodDeclaration.modifiers().addAll(modifiers); methodDeclaration.setName(simpleName(methodName)); methodDeclaration.parameters().addAll(parameters); methodDeclaration.setBody(block); return methodDeclaration; }</code><technical_language>methodDeclaration => md</technical_language>

Target:
public MethodDeclaration method(List<IExtendedModifier> modifiers, String methodName, List<SingleVariableDeclaration> parameters, Block block) { MethodDeclaration md = getAST().newMethodDeclaration(); md.modifiers().addAll(modifiers); md.setName(simpleName(methodName)); md.parameters().addAll(parameters); md.setBody(block); return md; }
Source:
<code>public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { String a = node.getImage(); <START> System.out.println(a); <END> List<ASTMethodDeclaration> methods = node.findDescendantsOfType(ASTMethodDeclaration.class); System.out.println(methods); int count = 0; for (ASTMethodDeclaration method : methods) { System.out.println(method.getName()); if (method.getName().equals("getInstance")) { count++; } } if (count > 1) { System.out.println("error"); addViolation(data, node); } return super.visit(node, data); }</code><technical_language>this a leftover debugging, please remove</technical_language>

Target:
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { List<ASTMethodDeclaration> methods = node.findDescendantsOfType(ASTMethodDeclaration.class); int count = 0; for (ASTMethodDeclaration method : methods) { if (method.getName().equals("getInstance")) { count++; if (count > 1) { addViolation(data, node); break; } } } return super.visit(node, data); }
Source:
<code>@Nonnull private Set<AncestorSource> parseAncestorSourceList() throws DirectiveParseException { Set<AncestorSource> ancestorSources = new LinkedHashSet<>(); if (this.hasNext(DirectiveValueToken.class)) { boolean parseException = false; Token dv = this.advance(); <START> if (trimRHSWS(dv.value).equalsIgnoreCase("'none'")) { <END> ancestorSources.add(None.INSTANCE); return ancestorSources; } for (SubDirectiveValueToken subdv : splitByWSP(dv)) { try { ancestorSources.add(this.parseAncestorSource(subdv)); } catch (DirectiveValueParseException e) { parseException = true; } } if (parseException) { throw INVALID_ANCESTOR_SOURCE_LIST; } } return ancestorSources; }</code><technical_language>do here</technical_language>

Target:
@Nonnull private Set<AncestorSource> parseAncestorSourceList() throws DirectiveParseException { Set<AncestorSource> ancestorSources = new LinkedHashSet<>(); if (this.hasNext(DirectiveValueToken.class)) { boolean parseException = false; boolean seenNone = false; Token dv = this.advance(); for (SubDirectiveValueToken subdv : splitByWSP(dv)) { try { AncestorSource as = this.parseAncestorSource(subdv); if (seenNone || as == None.INSTANCE && !ancestorSources.isEmpty()) { this.error(subdv, "The 'none' keyword must not be combined with any other ancestor-source"); throw INVALID_ANCESTOR_SOURCE; } if (as == None.INSTANCE) { seenNone = true; } ancestorSources.add(as); } catch (DirectiveValueParseException e) { parseException = true; } } if (parseException) { throw INVALID_ANCESTOR_SOURCE_LIST; } } return ancestorSources; }
Source:
<code>public static boolean isSafeInline(String contentType, String name) { <START> boolean result = false; <END> ReviewDb db = null; try { int index = name.lastIndexOf('.'); if (index >= 0) { String suffix = name.substring(index + 1); String[] allowedMimeTypes = GerritServer.getInstance().getGerritConfig() .getStringList("viewinline", null, "allow"); for (String allowedMimeType : allowedMimeTypes) { if (allowedMimeType.endsWith(suffix)) { return true; } } } } catch (OrmException e) { e.printStackTrace(); } catch (XsrfException e) { e.printStackTrace(); } return false; }</code><technical_language>Unused</technical_language>

Target:
public static boolean isSafeInline(String contentType, String name) { try { int index = name.lastIndexOf('.'); if (index >= 0) { String suffix = name.substring(index + 1); String[] allowedMimeTypes = GerritServer.getInstance().getGerritConfig() .getStringList("viewinline", null, "allow"); for (String allowedMimeType : allowedMimeTypes) { if (allowedMimeType.endsWith(suffix)) { return true; } } } } catch (OrmException e) { e.printStackTrace(); } catch (XsrfException e) { e.printStackTrace(); } return false; }
Source:
<code>public void testDDLwithPendingMutations() throws Exception { String tableName = generateUniqueName(); ensureTableCreated(getUrl(), tableName, TestUtil.PTSDB_NAME, null, null, null); Properties props = new Properties(); props.setProperty(QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB, Boolean.toString(true)); <START> Connection conn = DriverManager.getConnection(getUrl(), props); <END> conn.setAutoCommit(false); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + tableName + " (inst,host,\"DATE\") VALUES(?,'b',CURRENT_DATE())"); stmt.setString(1, "a"); stmt.execute(); String tableName2 = generateUniqueName(); String ddl = "CREATE TABLE " + tableName2 + " (V BIGINT PRIMARY KEY, K BIGINT)"; exceptionRule.expect(SQLException.class); exceptionRule.expectMessage( SQLExceptionCode.CANNOT_PERFORM_DDL_WITH_PENDING_MUTATIONS.getMessage()); conn.createStatement().execute(ddl); }</code><technical_language>nit: try-with-resources auto-close connection statement</technical_language>

Target:
public void testDDLwithPendingMutations() throws Exception { String tableName = generateUniqueName(); ensureTableCreated(getUrl(), tableName, TestUtil.PTSDB_NAME, null, null, null); Properties props = new Properties(); props.setProperty(QueryServices.PENDING_MUTATIONS_DDL_THROW_ATTRIB, Boolean.toString(true)); try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.setAutoCommit(false); PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + tableName + " (inst,host,\"DATE\") VALUES(?,'b',CURRENT_DATE())"); stmt.setString(1, "a"); stmt.execute(); String tableName2 = generateUniqueName(); String ddl = "CREATE TABLE " + tableName2 + " (V BIGINT PRIMARY KEY, K BIGINT)"; exceptionRule.expect(SQLException.class); exceptionRule.expectMessage( SQLExceptionCode.CANNOT_PERFORM_DDL_WITH_PENDING_MUTATIONS.getMessage()); conn.createStatement().execute(ddl); } }
Source:
<code>IndexAccessors(IndexSchemaElement root) { string = root.field( "string", f -> f.asString().projectable( Projectable.YES ) ).createAccessor(); text = root.field( "text", f -> f.asString().analyzer( DefaultAnalysisDefinitions.ANALYZER_STANDARD.name ).projectable( Projectable.YES ) ).createAccessor(); integer = root.field( "integer", f -> f.asInteger().projectable( Projectable.YES ) ).createAccessor(); longNumber = root.field( "longNumber", f -> f.asLong().projectable( Projectable.YES ) ).createAccessor(); bool = root.field( "bool", f -> f.asBoolean().projectable( Projectable.YES ) ).createAccessor(); <START> nativeBool = root.field( "nativeBool", f -> <END> f.extension( LuceneExtension.get() ).asLuceneField( Boolean.class, (absoluteFieldPath, value, collector) -> { if ( value == null ) { return; } Integer intValue = value ? 1 : 0; collector.accept( new StoredField( absoluteFieldPath, intValue ) ); collector.accept( new NumericDocValuesField( absoluteFieldPath, intValue.longValue() ) ); collector.accept( new IntPoint( absoluteFieldPath, intValue ) ); }, field -> { Integer intValue = (Integer) field.numericValue(); return ( intValue > 0 ); } ) ) .createAccessor(); }</code><technical_language>decided test this? basically testing code defined in tests, I doubt is useful</technical_language>

Target:
IndexAccessors(IndexSchemaElement root) { string = root.field( "string", f -> f.asString().projectable( Projectable.YES ) ).createAccessor(); text = root.field( "text", f -> f.asString().analyzer( DefaultAnalysisDefinitions.ANALYZER_STANDARD.name ).projectable( Projectable.YES ) ).createAccessor(); integer = root.field( "integer", f -> f.asInteger().projectable( Projectable.YES ) ).createAccessor(); longNumber = root.field( "longNumber", f -> f.asLong().projectable( Projectable.YES ) ).createAccessor(); bool = root.field( "bool", f -> f.asBoolean().projectable( Projectable.YES ) ).createAccessor(); }
Source:
<code>private boolean processInQueue() { while (true) { long cursor = inSubSequence.next(); if (cursor < -1) { <START> LockSupport.parkNanos(1); <END> continue; } if (cursor < 0) { return false; } RetryHolder toRun; try { toRun = inQueue.get(cursor); } finally { inSubSequence.done(cursor); } RetryHolder copy = new RetryHolder(); copy.retry = toRun.retry; copy.waitStartTimestamp = toRun.waitStartTimestamp; copy.attempt = toRun.attempt; copy.lastRunTimestamp = toRun.lastRunTimestamp; copy.nextRunTimestamp = calculateNextTimestamp(toRun.attempt, toRun.waitStartTimestamp, toRun.lastRunTimestamp); nextRerun.add(copy); } }</code><technical_language>yield - for right</technical_language>

Target:
private boolean processInQueue() { boolean any = false; while (true) { long cursor = inSubSequence.next(); if (cursor < -1) { continue; } if (cursor < 0) { return any; } Retry retry; try { RetryHolder toRun = inQueue.get(cursor); retry = toRun.retry; toRun.retry = null; } finally { inSubSequence.done(cursor); } retry.getAttemptDetails().nextRunTimestamp = calculateNextTimestamp(retry.getAttemptDetails()); nextRerun.add(retry); any = true; } }
Source:
<code>public CompletionStage<Void> saveMany(Publisher<Map.Entry<K, V>> pairs) { return CompletableFuture.runAsync(() -> { Flowable<Map.Entry<K, V>> entryFlowable = Flowable.fromPublisher(pairs); <START> entryFlowable.subscribe(e -> cache.putAsync(e.getKey(), e.getValue()), <END> err -> new InfinispanException("KeyValueStore - Error in put many", err) ); }, cache.getRemoteCacheManager().getAsyncExecutorService()); }</code><technical_language>this works, saveMany() completion stage completed entries stored</technical_language>

Target:
public Publisher<WriteResult<K>> saveMany(Publisher<Map.Entry<K, V>> pairs) { UnicastProcessor<WriteResult<K>> unicastProcessor = UnicastProcessor.create(); Flowable<Map.Entry<K, V>> entryFlowable = Flowable.fromPublisher(pairs); entryFlowable.subscribe(e -> { cache.putAsync(e.getKey(), e.getValue()) .whenComplete((r, ex) -> unicastProcessor.onNext(new WriteResult<>(e.getKey(), ex))); }); return unicastProcessor; }
Source:
<code>public String toJSONString() { <START> if (!get(getNode(), getPropertyKeys(), NAME).isDefined()) { <END> throw new IllegalArgumentException("Name of volume source is missing"); } return toJson(true); }</code><technical_language>check StringUtils.isBlank(getName()) getters return a value, specifically in this case return emptystring is bad name is essentially identity</technical_language>

Target:
public String toJSONString() { if (StringUtils.isBlank(getName())) { throw new IllegalArgumentException("Name of volume source is missing"); } return toJson(true); }
Source:
<code>public Set<FieldInfo> candidateRelationshipFields(String relationshipName, Direction relationshipDirection, boolean strict) { Set<FieldInfo> candidateFields = new HashSet<>(); for (FieldInfo fieldInfo : relationshipFields()) { String relationship = strict ? fieldInfo.relationshipTypeAnnotation() : fieldInfo.relationship(); <START> if (relationshipName.equalsIgnoreCase(relationship)) { <END> if (((fieldInfo.relationshipDirectionOrDefault(Direction.OUTGOING).equals(Direction.INCOMING) || fieldInfo .relationshipDirectionOrDefault(Direction.OUTGOING).equals(Direction.UNDIRECTED)) && (relationshipDirection.equals(Direction.INCOMING))) || (relationshipDirection.equals(Direction.OUTGOING) && !(fieldInfo .relationshipDirectionOrDefault(Direction.OUTGOING).equals(Direction.INCOMING)))) { candidateFields.add(fieldInfo); } } } return candidateFields; }</code><technical_language>Please ==</technical_language>

Target:
public Set<FieldInfo> candidateRelationshipFields(String relationshipName, Direction relationshipDirection, boolean strict) { Set<FieldInfo> candidateFields = new HashSet<>(); for (FieldInfo fieldInfo : relationshipFields()) { String relationship = strict ? fieldInfo.relationshipTypeAnnotation() : fieldInfo.relationship(); if (relationshipName.equalsIgnoreCase(relationship)) { Direction declaredDirection = fieldInfo.relationshipDirectionOrDefault(Direction.OUTGOING); if (isActualDirectionCompatibleWithDeclaredDirection(relationshipDirection, declaredDirection)) { candidateFields.add(fieldInfo); } } } return candidateFields; }
Source:
<code>public void stream() throws InterruptedException { <START> currentState = new StreamCreatedState(this); <END> switchState(new StartingState(this)); while (null != currentState) { final Runnable task = taskQueue.poll(1, TimeUnit.MINUTES); try { task.run(); } catch (final RuntimeException ex) { LOG.error("Failed to process task " + task + ", code carefully!", ex); switchState(new CleanupState(this, ex)); } } }</code><technical_language>I need do done in constructor</technical_language>

Target:
public void stream() throws InterruptedException { currentState = new State() { @Override public void onEnter() { } }; switchState(new StartingState()); while (null != currentState) { final Runnable task = taskQueue.poll(1, TimeUnit.MINUTES); try { task.run(); } catch (final SubscriptionWrappedException ex) { LOG.error("Failed to process task " + task + ", will rethrow original error", ex); switchState(new CleanupState(ex.getSourceException())); } catch (final RuntimeException ex) { LOG.error("Failed to process task " + task + ", code carefully!", ex); switchState(new CleanupState(ex)); } } }
Source:
<code>public long restoreMessagesFromDeadLetterQueue(long[] messageIDs, String destinationQueueName) throws BrokerManagerAdminException { long unavailableMessageCount; try { QueueManagerService queueManagerService = AndesBrokerManagerAdminServiceDSHolder.getInstance().getQueueManagerService(); <START> unavailableMessageCount = queueManagerService.restoreMessagesFromDeadLetterQueue(messageIDs, <END> destinationQueueName); return unavailableMessageCount; } catch (QueueManagerException e) { String errorMessage = e.getMessage(); log.error(errorMessage, e); throw new BrokerManagerAdminException(errorMessage, e); } }</code><technical_language>of this variable here, right? returne returned method</technical_language>

Target:
public long restoreMessagesFromDeadLetterQueue(long[] messageIDs, String destinationQueueName) throws BrokerManagerAdminException { try { QueueManagerService queueManagerService = AndesBrokerManagerAdminServiceDSHolder.getInstance().getQueueManagerService(); return queueManagerService.restoreMessagesFromDeadLetterQueue(messageIDs, destinationQueueName); } catch (QueueManagerException e) { String errorMessage = e.getMessage(); log.error(errorMessage, e); throw new BrokerManagerAdminException(errorMessage, e); } }
Source:
<code>public void clear() { rwLock.writeLock().lock(); try { nodes = new TreeSet<>(nodeComparator); oldNodesCount = 0L; if (locNode != null) nodes.add(locNode); nodesMap = new HashMap<>(); if (locNode != null) nodesMap.put(locNode.id(), locNode); nodeOrder = 0; <START> maxInternalOrder = locNode.internalOrder(); <END> topVer = 0; minNodeVer = locNode.version(); } finally { rwLock.writeLock().unlock(); } }</code><technical_language>incorrect me. clear() reset</technical_language>

Target:
public void clear() { rwLock.writeLock().lock(); try { notSyncClear(); } finally { rwLock.writeLock().unlock(); } }
Source:
<code>private void promptForMultipleChoicePlay(int page, int startSura, int startAyah, List<Integer> startingSuraList) { ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.select_dialog_item); for (Integer integer : startingSuraList) { String suraName = quranInfo.getSuraName(this, integer, false); adapter.add(suraName); } if(startSura != startingSuraList.get(0)) { adapter.insert("Beginning of Page", 0); startingSuraList.add(0, startSura); } <START> new AlertDialog.Builder(this) <END> .setTitle("Where do you want to listen from?") .setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if(i == 0) playFromAyah(page, startSura, startAyah); else playFromAyah(page, startingSuraList.get(i), 1); } }) .create().show(); }</code><technical_language>a reference dialog null out onClick, explicitly .dismiss() if set in onDestroy</technical_language>

Target:
private void promptForMultipleChoicePlay(int page, int startSura, int startAyah, List<Integer> startingSuraList) { ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.select_dialog_item); for (Integer integer : startingSuraList) { String suraName = quranInfo.getSuraName(this, integer, false); adapter.add(suraName); } if(startSura != startingSuraList.get(0)) { adapter.insert(getString(R.string.starting_page_label), 0); startingSuraList.add(0, startSura); } AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(getString(R.string.playback_prompt_title)) .setAdapter(adapter, (dialog, i) -> { if (i == 0) { playFromAyah(page, startSura, startAyah); } else { playFromAyah(page, startingSuraList.get(i), 1); } dialog.dismiss(); promptDialog = null; }); promptDialog = builder.create(); promptDialog.show(); }
Source:
<code>protected void updateOriginalTemplate(VmStatic vmStatic) { vmStatic.setOriginalTemplateGuid(getParameters().getVmStaticData().getOriginalTemplateGuid()); <START> vmStatic.setOriginalTemplateName(getParameters().getVmStaticData().getOriginalTemplateName()); <END> }</code><technical_language>a bit weird get getParameters().getVmStaticData() is method argument vmStatic.. in other places, in ovirt-engine, I suggest argument instead, in order comply standards in commands infrastructure I suggest remove argument (and change AddVmCommand accordingly). anyway, solution fine</technical_language>

Target:
protected void updateOriginalTemplate(VmStatic vmStatic) { }
Source:
<code><START> public void loggedInUserCanVoteOnceInPollOnMobile() { <END> Poll poll = new PostsListPage().open().getPost().clickNthPostWithPoll(0).getPoll(); Assert.assertTrue(poll.getAnswersRadioButtonsList().size() > 0); poll.clickNthAnswer(0); poll.clickNthAnswer(1); poll.clickVoteButton(); Assert.assertTrue(poll.isChosenResultBarDisplayed()); Assert.assertTrue(poll.getBarResultsList().size() > 0); Assert.assertTrue(poll.isAlreadyVotedMessageVisible()); }</code><technical_language>mobile desktop tests more of - please re-use code avoid duplications</technical_language>

Target:
public void loggedInUserCanVoteOnceInPollOnMobile() { Poll poll = new PostsListPage().open().getPost().clickNthPostWithPoll(0).getPoll(); Assert.assertTrue(poll.getAnswersRadioButtonsList().size() > 0); poll.clickNthAnswer(0); poll.clickVoteButton(); Assert.assertTrue(poll.isChosenResultBarDisplayed()); Assert.assertTrue(poll.getBarResultsList().size() > 0); Assert.assertTrue(poll.isAlreadyVotedMessageVisible()); }
Source:
<code>public String toString() { <START> return createToString(this, map( <END> "dataProviderSettings", getDataProviderSettings(), "steps", getSteps() ), super.toString()); }</code><technical_language>add visualizationSettings toString, please</technical_language>

Target:
public String toString() { return createToString(this, map( "dataProviderSettings", getDataProviderSettings(), "visualizationSettings", getVisualizationSettings(), "steps", getSteps() ), super.toString()); }
Source:
<code>public static SAMLInspectionResult inspectMessage(HttpMessage message) { for (HtmlParameter parameter : message.getUrlParams()) { if (isSAMLParameter(parameter)) { return new SAMLInspectionResult(true, parameter); } } for (HtmlParameter parameter : message.getFormParams()) { if (isSAMLParameter(parameter)) { <START> return new SAMLInspectionResult(true, parameter); <END> } } return new SAMLInspectionResult(false, null); }</code><technical_language>Worth keeping "old" method, need change codebase call this evidence is needed</technical_language>

Target:
public static SAMLInspectionResult inspectMessage(HttpMessage message) { for (HtmlParameter parameter : message.getUrlParams()) { if (isSAMLParameter(parameter)) { return new SAMLInspectionResult(parameter); } } for (HtmlParameter parameter : message.getFormParams()) { if (isSAMLParameter(parameter)) { return new SAMLInspectionResult(parameter); } } return SAMLInspectionResult.NOT_SAML; }
Source:
<code><START> public static <M> Window createWindow(AbstractViewController<M> viewBinder) { <END> Assert.requireNonNull(viewBinder, "viewBinder"); return new DolphinWindow<M>(viewBinder); }</code><technical_language>please add final keyword</technical_language>

Target:
public static final <M> Window createWindow(AbstractViewController<M> viewBinder) { Assert.requireNonNull(viewBinder, "viewBinder"); return new DolphinWindow<M>(viewBinder); }
Source:
<code>private boolean mustChangeAddress (int oldType, int newType) { return (oldType == VmInterfaceType.spaprVlan.getValue() <START> && newType != VmInterfaceType.spaprVlan.getValue()) <END> || (oldType != VmInterfaceType.spaprVlan.getValue() && newType == VmInterfaceType.spaprVlan.getValue()); }</code><technical_language>this condition simplified XOR operator (^): return oldType == VmInterfaceType.spaprVlan.getValue() ^ newType == VmInterfaceType.spaprVlan.getValue(); shorten line a bit (by adding a new ;) ) int spaprVlanType = VmInterfaceType.spaprVlan.getValue() return oldType == spaprVlanType ^ newType == spaprVlanType;</technical_language>

Target:
private boolean mustChangeAddress (int oldType, int newType) { int spaprVlanType = VmInterfaceType.spaprVlan.getValue(); return oldType == spaprVlanType ^ newType == spaprVlanType; }
Source:
<code>public void shouldParseVepOutputWithoutTranscript() { AnnotationLineMapper lineMapper = new AnnotationLineMapper(); VariantAnnotation variantAnnotation = lineMapper.mapLine(VepOutputContent.vepOutputContentWithOutTranscript, 0); List<ConsequenceType> consequenceTypes = variantAnnotation.getConsequenceTypes(); assertNotNull(consequenceTypes); <START> assertTrue(consequenceTypes.size() == 1); <END> ConsequenceType consequenceType = consequenceTypes.get(0); assertNotNull(consequenceType.getSoTerms()); assertNull(consequenceType.getcDnaPosition()); assertNull(consequenceType.getCdsPosition()); assertNull(consequenceType.getAaPosition()); assertNull(consequenceType.getAaChange()); assertNull(consequenceType.getCodon()); }</code><technical_language>assertEquals(1, consequenceTypes.size())</technical_language>

Target:
public void shouldParseVepOutputWithoutTranscript() { AnnotationLineMapper lineMapper = new AnnotationLineMapper(); VariantAnnotation variantAnnotation = lineMapper.mapLine(VepOutputContent.vepOutputContentWithOutTranscript, 0); List<ConsequenceType> consequenceTypes = variantAnnotation.getConsequenceTypes(); assertNotNull(consequenceTypes); assertEquals(1, consequenceTypes.size()); ConsequenceType consequenceType = consequenceTypes.get(0); assertNotNull(consequenceType.getSoTerms()); assertNull(consequenceType.getcDnaPosition()); assertNull(consequenceType.getCdsPosition()); assertNull(consequenceType.getAaPosition()); assertNull(consequenceType.getAaChange()); assertNull(consequenceType.getCodon()); }
Source:
<code>public ZibaseBindingConfigReceiver(String[] configParameters) { super(configParameters); logger.debug("Item protocol : {}", this.getProtocol()); <START> if (this.getProtocol().equals(ZbProtocol.ZWAVE.toString())) { <END> logger.debug("Item is ZWAVE !"); this.isZWave = true; this.x10Id = this.getId().substring(1); } else { this.x10Id = this.getId(); } logger.debug("Item X10 id set to : {}", this.x10Id); }</code><technical_language>consider dropping occurrences of this meaningless (as here)</technical_language>

Target:
public ZibaseBindingConfigReceiver(String[] configParameters) { super(configParameters); logger.debug("Item protocol : {}", this.getProtocol()); if (getProtocol().equals(ZbProtocol.ZWAVE.toString())) { logger.debug("Item is ZWAVE !"); isZWave = true; x10Id = getId().substring(1); } else { x10Id = getId(); } logger.debug("Item X10 id set to : {}", this.x10Id); }
Source:
<code>public void handle(Request request, Response response) { long qualityGateId = request.mandatoryParamAsLong(QualityGatesWsParameters.PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { QualityGateDto qualityGate = finder.getById(dbSession, qualityGateId); Optional<QualityGateDto> defaultQualityGate = finder.getDefault(dbSession); checkArgument(!defaultQualityGate.isPresent() || !defaultQualityGate.get().getId().equals(qualityGate.getId()), "The default quality gate cannot be removed"); wsSupport.checkCanEdit(qualityGate); dbClient.qualityGateDao().delete(qualityGate, dbSession); <START> <END> dbSession.commit(); response.noContent(); } }</code><technical_language>I UUIDs check equality</technical_language>

Target:
public void handle(Request request, Response response) { long qualityGateId = request.mandatoryParamAsLong(QualityGatesWsParameters.PARAM_ID); try (DbSession dbSession = dbClient.openSession(false)) { OrganizationDto organization = wsSupport.getOrganization(dbSession, request); QGateWithOrgDto qualityGate = finder.getByOrganizationAndId(dbSession, organization, qualityGateId); Optional<QualityGateDto> defaultQualityGate = finder.getDefault(dbSession); checkArgument(!defaultQualityGate.isPresent() || !defaultQualityGate.get().getId().equals(qualityGate.getId()), "The default quality gate cannot be removed"); wsSupport.checkCanEdit(qualityGate); dbClient.qualityGateDao().delete(qualityGate, dbSession); dbSession.commit(); response.noContent(); } }
Source:
<code><START> public void testEdges() throws TableNotFoundException { <END> CloseableIterable<Edge> edges = graph.getEdges(); Assert.assertEquals(1, Iterables.size(edges)); EntityEdge actualEdge = (EntityEdge) Iterables.get(edges, 0); assertEntitiesEqual(edge, actualEdge.getEntity()); }</code><technical_language>a big deal, is sooo easier do throws Exception in a test exception fail a test anyway</technical_language>

Target:
public void testEdges() throws Exception { CloseableIterable<Edge> edges = graph.getEdges(); Assert.assertEquals(1, Iterables.size(edges)); EntityEdge actualEdge = (EntityEdge) Iterables.get(edges, 0); assertEntitiesEqual(edge, actualEdge.getEntity()); }