auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void validate(final MultivaluedMap<String, String> data) throws NullPointerException { if (!data.containsKey("EmailAddress")) { throw new NullPointerException("Email address can not be null."); } else if (!data.containsKey("Password")) { throw new NullPointerException("Password can not be null."); } String emailAddress = data.getFirst("EmailAddress"); try { InternetAddress emailAddr = new InternetAddress(emailAddress); emailAddr.validate(); } catch (AddressException ex) { String msg = String.format("Provided email address %s is not valid",emailAddress); if (logger.isDebugEnabled()) { logger.debug(msg); } throw new IllegalArgumentException(msg); } String clientLogin = data.getFirst("EmailAddress").split("@")[0]; <START> for (char ch: ClientLoginConstrains.NOT_ALLOWED_CHARS) { <END> if (clientLogin.indexOf(ch) > -1) { String msg = String.format("Login %s contains invalid character: %s ",data.getFirst("Login"), ch); if (logger.isDebugEnabled()) { logger.debug(msg); } throw new IllegalArgumentException(msg); } } }</code><technical_language>move this code ClientLoginCosntraints reuse?=</technical_language>

Target:
private void validate(final MultivaluedMap<String, String> data) throws NullPointerException { if (!data.containsKey("EmailAddress")) { throw new NullPointerException("Email address can not be null."); } else if (!data.containsKey("Password")) { throw new NullPointerException("Password can not be null."); } String emailAddress = data.getFirst("EmailAddress"); try { InternetAddress emailAddr = new InternetAddress(emailAddress); emailAddr.validate(); } catch (AddressException ex) { String msg = String.format("Provided email address %s is not valid",emailAddress); if (logger.isDebugEnabled()) { logger.debug(msg); } throw new IllegalArgumentException(msg); } String clientLogin = data.getFirst("EmailAddress").split("@")[0]; if (!ClientLoginConstrains.isValidClientLogin(clientLogin)) { String msg = String.format("Login %s contains invalid character(s) ",clientLogin); if (logger.isDebugEnabled()) { logger.debug(msg); } throw new IllegalArgumentException(msg); } }
Source:
<code>private File makeGesturesDirectory(String directory) { File dir = new File(directory); dir.mkdirs(); if (!dir.isDirectory()) { <START> log.warn("Gestures directory doest not exist, will create it.", directory); <END> return null; } return dir; }</code><technical_language>This log message is correct. line dir.mkdirs() create directory. This log message is in event create directory... example a file permissions issue. please revert this log message incorrect is happening here</technical_language>

Target:
private File makeGesturesDirectory(String directory) { File dir = new File(directory); dir.mkdirs(); if (!dir.isDirectory()) { log.warn("Gestures directory doest not exist.", directory); return null; } return dir; }
Source:
<code>private StatementRank getStatementRank(int intRank) { StatementRank result = StatementRank.NORMAL; if (intRank < 1) { result = StatementRank.DEPRECATED; } else if (intRank > 1) { result = StatementRank.PREFERRED; <START> } <END> return result; }</code><technical_language>a switch direct return (no break) for clarity. Assigning a re-assigning in cases is readable returning a single result for specific condition. is "default case" here, options values</technical_language>

Target:
private StatementRank getStatementRank(int intRank) { switch (intRank) { case 0: return StatementRank.DEPRECATED; case 1: return StatementRank.NORMAL; case 2: return StatementRank.PREFERRED; default: throw new IllegalArgumentException("Unknown statement rank " + intRank); } }
Source:
<code>private void reportToServer(String tokenString){ <START> isReportting = true; <END> RequestTranscation transcation = createUploadRequestTranscation(tokenString); if (transcation == null){ return; } byte[] logData = getLogData(); if (logData == null && logData.length == 9){ return; } transcation.reportLog(logData, X_Log_Client_Id, true, new RequestTranscation.RequestCompleteHandler() { @Override public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) { if (responseInfo.isOK()){ lastReportTime = new Date().getTime(); if (X_Log_Client_Id == null && responseInfo.responseHeader != null && responseInfo.responseHeader.get("x-log-client-id") != null){ X_Log_Client_Id = responseInfo.responseHeader.get("x-log-client-id"); } cleanTempLogFile(); } isReportting = false; } }); }</code><technical_language>isReportting => isReporting</technical_language>

Target:
private void reportToServer(String tokenString){ isReporting = true; RequestTransaction transaction = createUploadRequestTransaction(tokenString); if (transaction == null){ return; } byte[] logData = getLogData(); if (logData == null && logData.length == 9){ return; } transaction.reportLog(logData, X_Log_Client_Id, true, new RequestTransaction.RequestCompleteHandler() { @Override public void complete(ResponseInfo responseInfo, UploadRegionRequestMetrics requestMetrics, JSONObject response) { if (responseInfo.isOK()){ lastReportTime = new Date().getTime(); if (X_Log_Client_Id == null && responseInfo.responseHeader != null && responseInfo.responseHeader.get("x-log-client-id") != null){ X_Log_Client_Id = responseInfo.responseHeader.get("x-log-client-id"); } cleanTempLogFile(); } isReporting = false; } }); }
Source:
<code>public int getRateLimiterAspectOrder() { <START> return Ordered.LOWEST_PRECEDENCE - 1; <END> }</code><technical_language>Variable</technical_language>

Target:
public int getRateLimiterAspectOrder() { return rateLimiterAspectOrder; }
Source:
<code>protected String encrypt(String clearText) { try { <START> Logger.d(TAG, "Started encrypt"); <END> final byte[] bytes = clearText != null ? clearText.getBytes() : new byte[0]; SecretKey secretKey = getSecretKeyForAPI(); Cipher pbeCipher = Cipher.getInstance(CIPHER_ALGORITHM); IvParameterSpec ivSpec = new IvParameterSpec(IV); pbeCipher.init(Cipher.ENCRYPT_MODE, secretKey, ivSpec); String encrypted = new String(Base64.encode(pbeCipher.doFinal(bytes), Base64.NO_WRAP), AuthenticationConstants.ENCODING_UTF8); Logger.d(TAG, "Finished encryption"); return encrypted; } catch (Exception e) { Logger.e(TAG, "It failed to use encryption", "", ADALError.ENCRYPTION_FAILED); } return clearText; }</code><technical_language>"Starting encryption" is typical wording</technical_language>

Target:
protected String encrypt(String clearText) throws NoSuchAlgorithmException, InvalidKeySpecException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, IOException, NoSuchPaddingException { Logger.d(TAG, "Starting encryption"); if (StringExtensions.IsNullOrBlank(clearText)) { throw new IllegalArgumentException("input is empty or null"); } loadSecretKeyForAPI(); final byte[] blobVersion = sBlobVersion.getBytes(AuthenticationConstants.ENCODING_UTF8); final byte[] bytes = clearText.getBytes(AuthenticationConstants.ENCODING_UTF8); byte[] iv = new byte[DATA_KEY_LENGTH]; mRandom.nextBytes(iv); IvParameterSpec ivSpec = new IvParameterSpec(iv); Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM); Mac mac = Mac.getInstance(MAC_ALGORITHM); cipher.init(Cipher.ENCRYPT_MODE, sKey, ivSpec); byte[] encrypted = cipher.doFinal(bytes); mac.init(sMacKey); mac.update(blobVersion); mac.update(encrypted); mac.update(iv); byte[] macDigest = mac.doFinal(); byte[] blobVerAndEncryptedDataAndIVAndMacDigest = new byte[blobVersion.length + encrypted.length + iv.length + macDigest.length]; System.arraycopy(blobVersion, 0, blobVerAndEncryptedDataAndIVAndMacDigest, 0, blobVersion.length); System.arraycopy(encrypted, 0, blobVerAndEncryptedDataAndIVAndMacDigest, blobVersion.length, encrypted.length); System.arraycopy(iv, 0, blobVerAndEncryptedDataAndIVAndMacDigest, blobVersion.length + encrypted.length, iv.length); System.arraycopy(macDigest, 0, blobVerAndEncryptedDataAndIVAndMacDigest, blobVersion.length + encrypted.length + iv.length, macDigest.length); String encryptedText = new String(Base64.encode(blobVerAndEncryptedDataAndIVAndMacDigest, Base64.NO_WRAP), AuthenticationConstants.ENCODING_UTF8); Logger.d(TAG, "Finished encryption"); return ENCODE_VERSION + encryptedText; }
Source:
<code>private List<String> sanitiseUserIndexPaths(List<String> userIndexPaths) { List<String> sanitisedUserIndexPaths = new ArrayList<>(); for (String userIndexPath : userIndexPaths) { if (PathUtils.getName(userIndexPath).equals(PurgeOldVersionUtils.OAK_INDEX)) { sanitisedUserIndexPaths.add(userIndexPath); } else if (PathUtils.getName(PathUtils.getParentPath(userIndexPath)).equals(PurgeOldVersionUtils.OAK_INDEX)) { sanitisedUserIndexPaths.add(IndexName.parse(userIndexPath).getBaseName()); } else { <START> throw new RuntimeException(userIndexPath + " indexpath is not valid"); <END> } } return sanitisedUserIndexPaths; }</code><technical_language>nit-pick: I IllegalArgumentException</technical_language>

Target:
private List<String> sanitiseUserIndexPaths(List<String> userIndexPaths) { List<String> sanitisedUserIndexPaths = new ArrayList<>(); for (String userIndexPath : userIndexPaths) { if (PathUtils.getName(userIndexPath).equals(PurgeOldVersionUtils.OAK_INDEX)) { sanitisedUserIndexPaths.add(userIndexPath); } else if (PathUtils.getName(PathUtils.getParentPath(userIndexPath)).equals(PurgeOldVersionUtils.OAK_INDEX)) { sanitisedUserIndexPaths.add(IndexName.parse(userIndexPath).getBaseName()); } else { throw new IllegalArgumentException(userIndexPath + " indexpath is not valid"); } } return sanitisedUserIndexPaths; }
Source:
<code>public void removeWidget(String pageCode, int pos) throws ApsSystemException { try { Widget widget = this.getDraftPage(pageCode).getWidgets()[pos]; super.removeWidget(pageCode, pos); <START> String stringId = widget != null && widget.getConfig() != null ? widget.getConfig().getProperty(KieBpmSystemConstants.WIDGET_PARAM_DATA_UX_ID) : null; <END> if (stringId != null) { int modelId = Integer.valueOf(stringId); DataObjectModel model = new DataObjectModel(); model.setId(modelId); this.getDataObjectModelManager().removeDataObjectModel(model); } } catch (Throwable t) { String message = "Error removing the widget from the page '" + pageCode + "' in the frame " + pos; _kielogger.error("Error removing the widget from the page '{}' in the frame {}", pageCode, pos, t); throw new ApsSystemException(message, t); } }</code><technical_language>Change this if statement a setter. long for trinary operator. Tough is happening here</technical_language>

Target:
public void removeWidget(String pageCode, int pos) throws ApsSystemException { try { Widget widget = this.getDraftPage(pageCode).getWidgets()[pos]; super.removeWidget(pageCode, pos); String stringId = null; if (widget != null && widget.getConfig() != null) { stringId = widget.getConfig().getProperty(KieBpmSystemConstants.WIDGET_PARAM_DATA_UX_ID); } if (stringId != null) { int modelId = Integer.valueOf(stringId); DataObjectModel model = new DataObjectModel(); model.setId(modelId); this.getDataObjectModelManager().removeDataObjectModel(model); } } catch (Throwable t) { String message = "Error removing the widget from the page '" + pageCode + "' in the frame " + pos; _kielogger.error("Error removing the widget from the page '{}' in the frame {}", pageCode, pos, t); throw new ApsSystemException(message, t); } }
Source:
<code>public Object getParent(Object element) { Object toReturn = null; if (element instanceof AttributeLineElement) { toReturn = ((AttributeLineElement) element).getParent(); } else if (element instanceof AttributeMatch) { AttributeMatch match = (AttributeMatch) element; toReturn = match.getArtifact(); } else if (element instanceof Artifact) { Artifact resource = (Artifact) element; try { toReturn = resource.getParent(); if (toReturn == null && resource.isNotRootedInDefaultRoot()) { toReturn = orphanParent; } <START> } catch (OseeCoreException ex) { <END> OseeLog.log(Activator.class, Level.SEVERE, ex); if (ex instanceof MultipleArtifactsExist) { toReturn = multiParent; } } } return toReturn; }</code><technical_language>Add a catch statement this line of MultiArtifactExist type do instance of in this block of code</technical_language>

Target:
public Object getParent(Object element) { Object toReturn = null; if (element instanceof AttributeLineElement) { toReturn = ((AttributeLineElement) element).getParent(); } else if (element instanceof AttributeMatch) { AttributeMatch match = (AttributeMatch) element; toReturn = match.getArtifact(); } else if (element instanceof Artifact) { Artifact resource = (Artifact) element; try { toReturn = resource.getParent(); if (toReturn == null && resource.isNotRootedInDefaultRoot()) { toReturn = orphanParent; } } catch (MultipleArtifactsExist ex) { toReturn = multiParent; } catch (OseeCoreException ex) { OseeLog.log(Activator.class, Level.SEVERE, ex); } } return toReturn; }
Source:
<code>public final Object copyAs(final String source, final String dest, final SBlock fail) { try { Files.copy(Paths.get(source), Paths.get(dest), new CopyOption[0]); } catch (IOException e) { <START> fail.getMethod().invoke(new Object[] {fail, e.toString()}); <END> } return Nil.nilObject; }</code><technical_language>nicer if a block dispatch node instead of manually, unoptimized</technical_language>

Target:
public final Object copyAs(final String source, final String dest, final SBlock fail) { try { Files.copy(Paths.get(source), Paths.get(dest), new CopyOption[0]); } catch (IOException e) { dispatchHandler.executeDispatch(new Object[] {fail, e.toString()}); } return Nil.nilObject; }
Source:
<code>public InSessionPageStore(IPageStore delegate, int maxPages, ISerializer serializer) { super(delegate); this.serializer = Args.notNull(serializer, "serializer"); <START> this.maxPages = maxPages; <END> }</code><technical_language>add a check maxPages is positive number</technical_language>

Target:
public InSessionPageStore(IPageStore delegate, int maxPages, ISerializer serializer) { this(delegate, serializer, () -> new CountLimitedData(maxPages)); }
Source:
<code>public void testComplexJSONParsing() throws Exception { final String[] jsonPaths = { "expensive:$.expensive", "bicycle_color:$.store.bicycle.color", "bicycle_price:$.store.bicycle.price", "window:$.store.window" }; MockEmitter<StructuredRecord> emitter = new MockEmitter<>(); <START> JSONParser.Config config = new JSONParser.Config("body", com.google.common.base.Joiner.on(",").join(jsonPaths), <END> OUTPUT3.toString()); Transform<StructuredRecord, StructuredRecord> transform = new JSONParser(config); MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(INPUT1); transform.configurePipeline(mockPipelineConfigurer); transform.initialize(null); transform.transform(StructuredRecord.builder(INPUT1) .set("body", json) .build(), emitter); Assert.assertEquals(10, emitter.getEmitted().get(0).get("expensive")); Assert.assertEquals("red", emitter.getEmitted().get(0).get("bicycle_color")); Assert.assertEquals(19.95, emitter.getEmitted().get(0).get("bicycle_price")); }</code><technical_language>import instead of full package for usages of class</technical_language>

Target:
public void testComplexJSONParsing() throws Exception { final String[] jsonPaths = { "expensive:$.expensive", "bicycle_color:$.store.bicycle.color", "bicycle_price:$.store.bicycle.price", "window:$.store.window" }; MockEmitter<StructuredRecord> emitter = new MockEmitter<>(); JSONParser.Config config = new JSONParser.Config("body", Joiner.on(",").join(jsonPaths), OUTPUT3.toString()); Transform<StructuredRecord, StructuredRecord> transform = new JSONParser(config); MockPipelineConfigurer mockPipelineConfigurer = new MockPipelineConfigurer(INPUT1); transform.configurePipeline(mockPipelineConfigurer); transform.initialize(null); transform.transform(StructuredRecord.builder(INPUT1) .set("body", json) .build(), emitter); Assert.assertEquals(10, emitter.getEmitted().get(0).get("expensive")); Assert.assertEquals("red", emitter.getEmitted().get(0).get("bicycle_color")); Assert.assertEquals(19.95, emitter.getEmitted().get(0).get("bicycle_price")); }
Source:
<code>public HttpModelControllerClient(String host, int port, String username, String password, int timeoutMillis) { target = new HttpHost(host, port, "http"); credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(target.getHostName(), target.getPort()), new UsernamePasswordCredentials(username, password)); RequestConfig.Builder configBuilder = RequestConfig.copy(RequestConfig.DEFAULT); if (timeoutMillis != NO_TIMEOUT) { <START> configBuilder.setConnectTimeout(timeoutMillis).setSocketTimeout(timeoutMillis); <END> } requestConfig = configBuilder.build(); url = String.format("http://%s:%s/management", host, port); }</code><technical_language>prefer chained invocation another line. line -- method call</technical_language>

Target:
HttpModelControllerClient(String host, int port, String username, String password, int timeoutMillis) throws IOException { url = "http://" + host + ":" + port + "/management"; RequestConfig.Builder requestConfigBuilder = RequestConfig.custom(); if (timeoutMillis != NO_TIMEOUT) { requestConfigBuilder .setConnectTimeout(timeoutMillis) .setSocketTimeout(timeoutMillis); } requestConfig = requestConfigBuilder.build(); Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create() .register("http", PlainConnectionSocketFactory.getSocketFactory()) .build(); BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider(); if (username != null && password != null) { credentialsProvider.setCredentials( new AuthScope(host, port, getManagementRealm(url), AuthSchemes.DIGEST), new UsernamePasswordCredentials(username, password)); } client = HttpClients.custom() .setConnectionManager(new PoolingHttpClientConnectionManager(registry)) .setDefaultCredentialsProvider(credentialsProvider) .setDefaultRequestConfig(requestConfig) .build(); }
Source:
<code>public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); pageLoadStrategy.onSaveInstanceState(outState); <START> outState.putParcelableArrayList("tabList", tabList); <END> }</code><technical_language>mind making "tabList" string a constant symbol referenced in multiple places</technical_language>

Target:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); pageLoadStrategy.onSaveInstanceState(outState); outState.putParcelableArrayList(TAB_LIST_KEY, tabList); }
Source:
<code>public void should_reprepare_statement_with_keyspace_on_the_fly() { try (CqlSession session = SessionUtils.newSession(ccmRule)) { executeDdl( session, String.format( "CREATE TABLE IF NOT EXISTS %s.bar (k int primary key)", sessionRule.keyspace())); PreparedStatement pst = session.prepare( SimpleStatement.newInstance("SELECT * FROM bar WHERE k=?") .setKeyspace(sessionRule.keyspace())); executeDdl(session, String.format("DROP TABLE %s.bar", sessionRule.keyspace())); executeDdl( session, String.format("CREATE TABLE %s.bar (k int primary key)", sessionRule.keyspace())); session.execute(pst.bind(0)); } <START> } <END></code><technical_language>check cache re-prepared populated</technical_language>

Target:
public void should_reprepare_statement_with_keyspace_on_the_fly() { try (CqlSession session = SessionUtils.newSession(ccmRule)) { executeDdl( session, String.format( "CREATE TABLE IF NOT EXISTS %s.bar (k int primary key)", sessionRule.keyspace())); PreparedStatement pst = session.prepare( SimpleStatement.newInstance("SELECT * FROM bar WHERE k=?") .setKeyspace(sessionRule.keyspace())); executeDdl(session, String.format("DROP TABLE %s.bar", sessionRule.keyspace())); executeDdl( session, String.format("CREATE TABLE %s.bar (k int primary key)", sessionRule.keyspace())); assertThat(preparedStatementExistsOnServer(session, pst.getId())).isFalse(); session.execute(pst.bind(0)); assertThat(preparedStatementExistsOnServer(session, pst.getId())).isTrue(); } }
Source:
<code>void configureRequest(HttpConnection conn) throws IOException { GSSManager gssManager = GSS_MANAGER_FACTORY.newInstance(conn .getURL()); String host = conn.getURL().getHost(); String peerName = "HTTP@" + host.toLowerCase(); try { GSSName gssName = gssManager.createName(peerName, GSSName.NT_HOSTBASED_SERVICE); GSSContext context = gssManager.createContext(gssName, OID, null, GSSContext.DEFAULT_LIFETIME); context.requestCredDeleg(true); byte[] token = context.initSecContext(prevToken, 0, prevToken.length); <START> <END> conn.setRequestProperty(HDR_AUTHORIZATION, getType().name() + " " + Base64.encodeBytes(token)); } catch (GSSException e) { IOException ioe = new IOException(); ioe.initCause(e); throw ioe; } }</code><technical_language>forgot this .name() call? This line set's "Authorization" header I read specs named "Basic", "Digest", ..</technical_language>

Target:
void configureRequest(HttpConnection conn) throws IOException { GSSManager gssManager = GSS_MANAGER_FACTORY.newInstance(conn .getURL()); String host = conn.getURL().getHost(); String peerName = "HTTP@" + host.toLowerCase(); try { GSSName gssName = gssManager.createName(peerName, GSSName.NT_HOSTBASED_SERVICE); GSSContext context = gssManager.createContext(gssName, OID, null, GSSContext.DEFAULT_LIFETIME); context.requestCredDeleg(true); byte[] token = context.initSecContext(prevToken, 0, prevToken.length); conn.setRequestProperty(HDR_AUTHORIZATION, getType().getName() + " " + Base64.encodeBytes(token)); } catch (GSSException e) { IOException ioe = new IOException(); ioe.initCause(e); throw ioe; } }
Source:
<code>public Response deleteBranchExchange(String path) { boolean modified = false; String exchangePath = asExchangeLocator(path); IResourceLocator locator = resourceManager.getResourceLocator(exchangePath); if (locator != null) { int deleteResult = resourceManager.delete(locator); switch (deleteResult) { <START> case IResourceManager.OK: <END> activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format("Branch Operation Delete Branch Exachange Resource {resource: %s, locator %s}", path, locator.getLocation())); modified = true; break; case IResourceManager.FAIL: throw new OseeWebApplicationException(Status.INTERNAL_SERVER_ERROR, "Error deleting exchange resource [%s] - locator [%s]", path, locator.getLocation()); case IResourceManager.RESOURCE_NOT_FOUND: default: break; } } return OrcsRestUtil.asResponse(modified); }</code><technical_language>try/catch</technical_language>

Target:
public Response deleteBranchExchange(String path) { boolean modified = false; String exchangePath = asExchangeLocator(path); IResourceLocator locator = resourceManager.getResourceLocator(exchangePath); if (locator != null) { int deleteResult = resourceManager.delete(locator); switch (deleteResult) { case IResourceManager.OK: try { activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format("Branch Operation Delete Branch Exachange Resource {resource: %s, locator %s}", path, locator.getLocation())); } catch (OseeCoreException ex) { OseeLog.log(ActivityLog.class, OseeLevel.SEVERE_POPUP, ex); } modified = true; break; case IResourceManager.FAIL: throw new OseeWebApplicationException(Status.INTERNAL_SERVER_ERROR, "Error deleting exchange resource [%s] - locator [%s]", path, locator.getLocation()); case IResourceManager.RESOURCE_NOT_FOUND: default: break; } } return OrcsRestUtil.asResponse(modified); }
Source:
<code>private Undertow configureServer() { gracefulShutdown = new HermesShutdownHandler(deployAndStart(), hermesMetrics); Undertow.Builder builder = Undertow.builder() .addHttpListener(port, host) .setServerOption(REQUEST_PARSE_TIMEOUT, configFactory.getIntProperty(FRONTEND_REQUEST_PARSE_TIMEOUT)) .setServerOption(MAX_HEADERS, configFactory.getIntProperty(FRONTEND_MAX_HEADERS)) .setServerOption(MAX_PARAMETERS, configFactory.getIntProperty(FRONTEND_MAX_PARAMETERS)) .setServerOption(MAX_COOKIES, configFactory.getIntProperty(FRONTEND_MAX_COOKIES)) .setServerOption(ALWAYS_SET_KEEP_ALIVE, configFactory.getBooleanProperty(FRONTEND_SET_KEEP_ALIVE)) .setSocketOption(BACKLOG, configFactory.getIntProperty(FRONTEND_BACKLOG_SIZE)) .setSocketOption(READ_TIMEOUT, configFactory.getIntProperty(FRONTEND_READ_TIMEOUT)) .setIoThreads(configFactory.getIntProperty(FRONTEND_IO_THREADS_COUNT)) .setWorkerThreads(configFactory.getIntProperty(FRONTEND_WORKER_THREADS_COUNT)) .setBufferSize(configFactory.getIntProperty(FRONTEND_BUFFER_SIZE)) .setHandler(gracefulShutdown); if (configFactory.getBooleanProperty(FRONTEND_HTTP2_ENABLED)) { builder.setServerOption(ENABLE_HTTP2, true) .addHttpsListener(portSSL, host, new SSLContextSupplier(configFactory).get()); } <START> this.undertow = builder.build(); <END> return undertow; }</code><technical_language>i needed</technical_language>

Target:
private Undertow configureServer() { gracefulShutdown = new HermesShutdownHandler(deployAndStart(), hermesMetrics); Undertow.Builder builder = Undertow.builder() .addHttpListener(port, host) .setServerOption(REQUEST_PARSE_TIMEOUT, configFactory.getIntProperty(FRONTEND_REQUEST_PARSE_TIMEOUT)) .setServerOption(MAX_HEADERS, configFactory.getIntProperty(FRONTEND_MAX_HEADERS)) .setServerOption(MAX_PARAMETERS, configFactory.getIntProperty(FRONTEND_MAX_PARAMETERS)) .setServerOption(MAX_COOKIES, configFactory.getIntProperty(FRONTEND_MAX_COOKIES)) .setServerOption(ALWAYS_SET_KEEP_ALIVE, configFactory.getBooleanProperty(FRONTEND_SET_KEEP_ALIVE)) .setSocketOption(BACKLOG, configFactory.getIntProperty(FRONTEND_BACKLOG_SIZE)) .setSocketOption(READ_TIMEOUT, configFactory.getIntProperty(FRONTEND_READ_TIMEOUT)) .setIoThreads(configFactory.getIntProperty(FRONTEND_IO_THREADS_COUNT)) .setWorkerThreads(configFactory.getIntProperty(FRONTEND_WORKER_THREADS_COUNT)) .setBufferSize(configFactory.getIntProperty(FRONTEND_BUFFER_SIZE)) .setHandler(gracefulShutdown); if (configFactory.getBooleanProperty(FRONTEND_HTTP2_ENABLED)) { builder.setServerOption(ENABLE_HTTP2, true) .addHttpsListener(sslPort, host, new SSLContextSupplier(configFactory).get()); } this.undertow = builder.build(); return undertow; }
Source:
<code>private static void assemblerFromForm(HttpAction action, StreamRDF dest) { String dbType = action.getRequest().getParameter(paramDatasetType) ; String dbName = action.getRequest().getParameter(paramDatasetName) ; if ( StringUtils.isBlank(dbType) || StringUtils.isBlank(dbName) ) ServletOps.errorBadRequest("Required parameters: dbName and dbType"); Map<String, String> params = new HashMap<>() ; if ( dbName.startsWith("/") ) params.put(Template.NAME, dbName.substring(1)) ; else params.put(Template.NAME, dbName) ; FusekiSystem.addGlobals(params); String template = dbTypeToTemplate.get(dbType.toLowerCase(Locale.ROOT)); if ( template == null ) <START> ServletOps.errorBadRequest(format("dbType can be only '%s' or '%s'", tDatabaseTDB, tDatabaseMem)) ; <END> String syntax = TemplateFunctions.templateFile(template, params, Lang.TTL) ; RDFParser.create().source(new StringReader(syntax)).base("http://base/").lang(Lang.TTL).parse(dest); }</code><technical_language>This PR allows possibilities error message is inaccurate</technical_language>

Target:
private static void assemblerFromForm(HttpAction action, StreamRDF dest) { String dbType = action.getRequest().getParameter(paramDatasetType) ; String dbName = action.getRequest().getParameter(paramDatasetName) ; if ( StringUtils.isBlank(dbType) || StringUtils.isBlank(dbName) ) ServletOps.errorBadRequest("Required parameters: dbName and dbType"); Map<String, String> params = new HashMap<>() ; if ( dbName.startsWith("/") ) params.put(Template.NAME, dbName.substring(1)) ; else params.put(Template.NAME, dbName) ; FusekiSystem.addGlobals(params); String template = dbTypeToTemplate.get(dbType.toLowerCase(Locale.ROOT)); if ( template == null ) ServletOps.errorBadRequest(format("dbType can be only '%s', '%s' or '%s'", tDatabaseTDB, tDatabaseTDB2, tDatabaseMem)) ; String syntax = TemplateFunctions.templateFile(template, params, Lang.TTL) ; RDFParser.create().source(new StringReader(syntax)).base("http://base/").lang(Lang.TTL).parse(dest); }
Source:
<code><START> private void handleNotOperator(SubscriptionContext ctx, PyUnaryExpressionTree unary) { <END> PyExpressionTree negatedExpr = unary.expression(); if (negatedExpr.is(Tree.Kind.PARENTHESIZED)) { negatedExpr = ((PyParenthesizedExpressionTree) negatedExpr).expression(); if (negatedExpr.is(Tree.Kind.COMPARISON) || !(negatedExpr instanceof PyBinaryExpressionTree)) { ctx.addIssue(negatedExpr, String.format(MESSAGE, "not")); } } }</code><technical_language>This method static</technical_language>

Target:
private static void handleNotOperator(SubscriptionContext ctx, PyUnaryExpressionTree unary) { PyExpressionTree negatedExpr = unary.expression(); if (negatedExpr.is(Tree.Kind.PARENTHESIZED)) { negatedExpr = ((PyParenthesizedExpressionTree) negatedExpr).expression(); if (negatedExpr.is(Tree.Kind.COMPARISON) || !(negatedExpr instanceof PyBinaryExpressionTree)) { ctx.addIssue(negatedExpr, String.format(MESSAGE, "not")); } } }
Source:
<code>public Response getPublicDatasets(@Context SecurityContext sc, @Context HttpServletRequest req) throws AppException { List<Dataset> clusterDatasets = delaDatasetCtrl.getLocalPublicDatasets(); DistributedFileSystemOps dfso = dfs.getDfsOps(); List<LocalDatasetDTO> localDS; try { localDS = LocalDatasetHelper.parse(datasetCtrl, dfso, clusterDatasets); } finally { <START> dfso.close(); <END> } GenericEntity<List<LocalDatasetDTO>> datasets = new GenericEntity<List<LocalDatasetDTO>>(localDS) {}; return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(datasets).build(); }</code><technical_language>@o-alex replace this DistributedFsService.closeDfsClient()</technical_language>

Target:
public Response getPublicDatasets(@Context SecurityContext sc, @Context HttpServletRequest req) throws AppException { List<Dataset> clusterDatasets = delaDatasetCtrl.getLocalPublicDatasets(); DistributedFileSystemOps dfso = dfs.getDfsOps(); List<LocalDatasetDTO> localDS; try { localDS = LocalDatasetHelper.parse(datasetCtrl, dfso, clusterDatasets); } finally { dfs.closeDfsClient(dfso); } GenericEntity<List<LocalDatasetDTO>> datasets = new GenericEntity<List<LocalDatasetDTO>>(localDS) {}; return noCacheResponse.getNoCacheResponseBuilder(Response.Status.OK).entity(datasets).build(); }
Source:
<code>public FileActivity( User source, Type type, Purpose purpose, IFile newFile, IFile oldFile, byte[] content, String encoding) { super(source, newFile); if (type == null) throw new IllegalArgumentException("type must not be null"); if (purpose == null) throw new IllegalArgumentException("purpose must not be null"); if (newFile == null) throw new IllegalArgumentException("newPath must not be null"); switch (type) { case CREATED: if (content == null || oldFile != null) throw new IllegalArgumentException(); break; case REMOVED: if (content != null || oldFile != null) throw new IllegalArgumentException(); break; case MOVED: if (oldFile == null) throw new IllegalArgumentException(); break; } if (encoding == null && (type == Type.CREATED || (type == Type.MOVED && content != null))) { throw new IllegalArgumentException( "Encoding must be passed if type is created and/or binary content is passed"); } this.type = type; <START> this.oldFile = oldFile != null ? new ResourceTransportWrapper<>(oldFile) : null; <END> this.content = content; this.encoding = encoding; this.purpose = purpose; }</code><technical_language>private field "oldFile" class "oldFile" constructor parameter (a bit unusual)</technical_language>

Target:
public FileActivity( User source, Type type, Purpose purpose, IFile newFile, IFile oldFile, byte[] content, String encoding) { super(source, newFile); if (type == null) throw new IllegalArgumentException("type must not be null"); if (purpose == null) throw new IllegalArgumentException("purpose must not be null"); if (newFile == null) throw new IllegalArgumentException("newPath must not be null"); switch (type) { case CREATED: if (content == null || oldFile != null) throw new IllegalArgumentException(); break; case REMOVED: if (content != null || oldFile != null) throw new IllegalArgumentException(); break; case MOVED: if (oldFile == null) throw new IllegalArgumentException(); break; } if (encoding == null && (type == Type.CREATED || (type == Type.MOVED && content != null))) { throw new IllegalArgumentException( "Encoding must be passed if type is created and/or binary content is passed"); } this.type = type; this.oldFileWrapper = oldFile != null ? new ResourceTransportWrapper<>(oldFile) : null; this.content = content; this.encoding = encoding; this.purpose = purpose; }
Source:
<code>private void doSpell(final String cmd, final String id, final JSONArray paramArray) { final SpellChecker checker = new SpellChecker(dict); <START> final Set<String> errors = new HashSet(); <END> checker.addSpellCheckListener(new SpellCheckListener() { @Override public void spellingError(SpellCheckEvent event) { errors.add(event.getInvalidWord()); } }); JSONArray words = paramArray.optJSONArray(1); checker.checkSpelling(new StringWordTokenizer(words.toString())); respond(errors.iterator(), cmd, id); }</code><technical_language>Dyamond operator again..</technical_language>

Target:
private void doSpell(final String cmd, final String id, final JSONArray paramArray) { final SpellChecker checker = new SpellChecker(dict); final Set<String> errors = new HashSet<>(); checker.addSpellCheckListener(new SpellCheckListener() { @Override public void spellingError(SpellCheckEvent event) { errors.add(event.getInvalidWord()); } }); JSONArray words = paramArray.optJSONArray(1); checker.checkSpelling(new StringWordTokenizer(words.toString())); respond(errors.iterator(), cmd, id); }
Source:
<code>public Result apply(AggregationNode aggregationNode, Captures captures, Context context) { boolean anyRewritten = false; ImmutableMap.Builder<Symbol, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<Symbol, Aggregation> entry : aggregationNode.getAggregations().entrySet()) { Aggregation aggregation = entry.getValue(); FunctionCall call = new FunctionCall( <START> aggregation.getCall().getName(), <END> Optional.empty(), aggregation.getFilter().map(a -> rewriter.rewrite(a, context)), aggregation.getCall().getOrderBy(), aggregation.isDistinct(), aggregation.getArguments().stream().map(a -> rewriter.rewrite(a, context)).collect(toImmutableList())); aggregations.put( entry.getKey(), new Aggregation(call, aggregation.getFunctionHandle(), aggregation.getMask())); if (!aggregation.getCall().equals(call)) { anyRewritten = true; } } if (anyRewritten) { return Result.ofPlanNode(new AggregationNode( aggregationNode.getId(), aggregationNode.getSource(), aggregations.build(), aggregationNode.getGroupingSets(), aggregationNode.getPreGroupedSymbols(), aggregationNode.getStep(), aggregationNode.getHashSymbol(), aggregationNode.getGroupIdSymbol())); } return Result.empty(); }</code><technical_language>function manager</technical_language>

Target:
public Result apply(AggregationNode aggregationNode, Captures captures, Context context) { boolean anyRewritten = false; ImmutableMap.Builder<VariableReferenceExpression, Aggregation> aggregations = ImmutableMap.builder(); for (Map.Entry<VariableReferenceExpression, Aggregation> entry : aggregationNode.getAggregations().entrySet()) { Aggregation aggregation = entry.getValue(); Aggregation rewritten = new Aggregation( new CallExpression(aggregation.getCall().getDisplayName(), aggregation.getCall().getFunctionHandle(), aggregation.getCall().getType(), aggregation.getCall().getArguments() .stream() .map(argument -> castToRowExpression(rewriter.rewrite(castToExpression(argument), context))) .collect(toImmutableList())), aggregation.getFilter() .map(filter -> castToRowExpression(rewriter.rewrite(castToExpression(filter), context))), aggregation.getOrderBy(), aggregation.isDistinct(), aggregation.getMask()); aggregations.put(entry.getKey(), rewritten); if (!aggregation.equals(rewritten)) { anyRewritten = true; } } if (anyRewritten) { return Result.ofPlanNode(new AggregationNode( aggregationNode.getId(), aggregationNode.getSource(), aggregations.build(), aggregationNode.getGroupingSets(), aggregationNode.getPreGroupedVariables(), aggregationNode.getStep(), aggregationNode.getHashVariable(), aggregationNode.getGroupIdVariable())); } return Result.empty(); }
Source:
<code>protected void requestDatacentersToCreateWaitingCloudlets() { final List<Cloudlet> successfullySubmitted = new ArrayList<>(); <START> for (final Cloudlet cloudlet : getCloudletWaitingList()) { <END> if (cloudletCreationRequestsMap.containsKey(cloudlet)) { continue; } lastSelectedVm = vmMapper.apply(cloudlet); if (lastSelectedVm == Vm.NULL) { println(String.format( "%.2f: %s: : Postponing execution of cloudlet %d: bind VM not available.", getSimulation().clock(), getName(), cloudlet.getId())); continue; } println(String.format( "%.2f: %s: Sending %s %d to %s in %s.", getSimulation().clock(), getName(), cloudlet.getClass().getSimpleName(), cloudlet.getId(), lastSelectedVm, lastSelectedVm.getHost())); cloudlet.setVm(lastSelectedVm); send(getVmDatacenter(lastSelectedVm).getId(), cloudlet.getSubmissionDelay(), CloudSimTags.CLOUDLET_SUBMIT, cloudlet); cloudletCreationRequestsMap.put(cloudlet, getVmDatacenter(lastSelectedVm)); cloudletsCreated++; successfullySubmitted.add(cloudlet); } cloudletWaitingList.removeAll(successfullySubmitted); }</code><technical_language>access attribute</technical_language>

Target:
protected void requestDatacentersToCreateWaitingCloudlets() { final List<Cloudlet> successfullySubmitted = new ArrayList<>(); for (final Cloudlet cloudlet : cloudletWaitingList) { if (cloudletCreationRequestsMap.containsKey(cloudlet)) { continue; } lastSelectedVm = vmMapper.apply(cloudlet); if (lastSelectedVm == Vm.NULL) { println(String.format( "%.2f: %s: : Postponing execution of cloudlet %d: bind VM not available.", getSimulation().clock(), getName(), cloudlet.getId())); continue; } println(String.format( "%.2f: %s: Sending %s %d to %s in %s.", getSimulation().clock(), getName(), cloudlet.getClass().getSimpleName(), cloudlet.getId(), lastSelectedVm, lastSelectedVm.getHost())); cloudlet.setVm(lastSelectedVm); send(getVmDatacenter(lastSelectedVm).getId(), cloudlet.getSubmissionDelay(), CloudSimTags.CLOUDLET_SUBMIT, cloudlet); cloudletCreationRequestsMap.put(cloudlet, getVmDatacenter(lastSelectedVm)); cloudletsCreated++; successfullySubmitted.add(cloudlet); } cloudletWaitingList.removeAll(successfullySubmitted); }
Source:
<code><START> public @Nullable IntervalField getEndField() { <END> return endField; }</code><technical_language>write annotations method definition</technical_language>

Target:
public IntervalField getEndField() { return endField; }
Source:
<code><START> private boolean connectorSupportsTest(TypeElement connector, Class<?> test) <END> { Set<ConnectorFeature> supportedFeatures = supportedFeatures(connector); Set<ConnectorFeature> requiredFeatures = requiredFeatures(test); return supportedFeatures.containsAll(requiredFeatures); }</code><technical_language>This static</technical_language>

Target:
private static boolean connectorSupportsTest(TypeElement connector, Class<?> test) { Set<ConnectorFeature> supportedFeatures = supportedFeatures(connector); Set<ConnectorFeature> requiredFeatures = requiredFeatures(test); return supportedFeatures.containsAll(requiredFeatures); }
Source:
<code>private void printPlugins() { final List<String> installedPlugins = getInstalledPlugins(); if (installedPlugins != null) { System.out.println("The following DITA-OT plugins are installed:"); for (final String plugin : installedPlugins) { System.out.println(" " + plugin); } } else { System.out.println("No DITA-OT plugins are installed."); } <START> } <END></code><technical_language>if I want this line output ID prefixed spaces. preference ID line, prefixes. output piped other processes parsing out pretty printing. This is basically [plumbing porcelain](<LINK_0> distinction</technical_language>

Target:
private void printPlugins() { final List<String> installedPlugins = getInstalledPlugins(); for (final String plugin : installedPlugins) { System.out.println(plugin); } }
Source:
<code><START> public List<Facility> getAllowedFacilities(PerunSession sess, Member member) throws InternalErrorException { <END> return getFacilitiesManagerImpl().getAllowedFacilities(sess, member); }</code><technical_language>do throw InternalErrorException</technical_language>

Target:
public List<Facility> getAllowedFacilities(PerunSession sess, Member member) { return getFacilitiesManagerImpl().getAllowedFacilities(sess, member); }
Source:
<code>EmbeddedPostgres(File parentDirectory, File dataDirectory, boolean cleanDataDirectory, Map<String, String> postgresConfig, Map<String, String> localeConfig, int port, Map<String, String> connectConfig, PgDirectoryResolver pgDirectoryResolver, ProcessBuilder.Redirect errorRedirector, ProcessBuilder.Redirect outputRedirector, Duration pgStartupWait, Optional<File> overrideWorkingDirectory) throws IOException { this.cleanDataDirectory = cleanDataDirectory; this.postgresConfig = new HashMap<>(postgresConfig); this.localeConfig = new HashMap<>(localeConfig); this.port = port; this.pgDir = pgDirectoryResolver.getDirectory(overrideWorkingDirectory); this.errorRedirector = errorRedirector; this.outputRedirector = outputRedirector; this.pgStartupWait = Objects.requireNonNull(pgStartupWait, "Wait time cannot be null"); if (parentDirectory != null) { mkdirs(parentDirectory); cleanOldDataDirectories(parentDirectory); if (dataDirectory != null) { this.dataDirectory = dataDirectory; } else { this.dataDirectory = new File(parentDirectory, instanceId.toString()); } } else { this.dataDirectory = dataDirectory; } if (this.dataDirectory == null) { throw new IllegalArgumentException("no data directory"); } <START> LOG.info("{} postgres: data directory is {}, postgres directory is {}", instanceId, this.dataDirectory, this.pgDir); <END> mkdirs(this.dataDirectory); lockFile = new File(this.dataDirectory, LOCK_FILE_NAME); if (cleanDataDirectory || !new File(dataDirectory, "postgresql.conf").exists()) { initdb(); } lock(); startPostmaster(connectConfig); }</code><technical_language>change debug</technical_language>

Target:
EmbeddedPostgres(File parentDirectory, File dataDirectory, boolean cleanDataDirectory, Map<String, String> postgresConfig, Map<String, String> localeConfig, int port, Map<String, String> connectConfig, PgDirectoryResolver pgDirectoryResolver, ProcessBuilder.Redirect errorRedirector, ProcessBuilder.Redirect outputRedirector, Duration pgStartupWait, Optional<File> overrideWorkingDirectory) throws IOException { this.cleanDataDirectory = cleanDataDirectory; this.postgresConfig = new HashMap<>(postgresConfig); this.localeConfig = new HashMap<>(localeConfig); this.port = port; this.pgDir = pgDirectoryResolver.getDirectory(overrideWorkingDirectory); this.errorRedirector = errorRedirector; this.outputRedirector = outputRedirector; this.pgStartupWait = Objects.requireNonNull(pgStartupWait, "Wait time cannot be null"); if (parentDirectory != null) { mkdirs(parentDirectory); cleanOldDataDirectories(parentDirectory); if (dataDirectory != null) { this.dataDirectory = dataDirectory; } else { this.dataDirectory = new File(parentDirectory, instanceId.toString()); } } else { this.dataDirectory = dataDirectory; } if (this.dataDirectory == null) { throw new IllegalArgumentException("no data directory"); } LOG.debug("{} postgres: data directory is {}, postgres directory is {}", instanceId, this.dataDirectory, this.pgDir); mkdirs(this.dataDirectory); lockFile = new File(this.dataDirectory, LOCK_FILE_NAME); if (cleanDataDirectory || !new File(dataDirectory, "postgresql.conf").exists()) { initdb(); } lock(); startPostmaster(connectConfig); }
Source:
<code>public byte[] call(final byte[] bytes) throws Exception { CatchableExecutors.newSingleThreadExecutor().submit(() -> { for (int i = 1; i <= 100; i++) { <START> LOG.log(Level.INFO, "Test print : [{0} / 200]", i); <END> } final int errorNumber = 1 / 0; for (int i = 101; i <= 200; i++) { LOG.log(Level.INFO, "Test print : [{0} / 200]", i); } }); Thread.sleep(5000); return null; }</code><technical_language>do need prints</technical_language>

Target:
public byte[] call(final byte[] bytes) throws Exception { CatchableExecutors.newSingleThreadExecutor().submit(() -> { LOG.log(Level.INFO, "Before error"); final int errorNumber = 1 / 0; LOG.log(Level.INFO, "After error"); }); Thread.sleep(5000); return null; }
Source:
<code>public void stop() { LOG.info("Oracle TriggerBased connector stop requested."); try { <START> _daemonThreadExecutorService.shutdown(); <END> if (!_daemonThreadExecutorService.awaitTermination(5, TimeUnit.SECONDS)) { LOG.warn("Timeout waiting for daemon thread to stop! Continue to shutdown all task handlers."); } } catch (InterruptedException e) { LOG.error("Interrupted when waiting for daemon thread to stop! Continue to shutdown all task handlers.", e); } _daemonThreadExecutorService = null; if (_namedTaskHandlers != null) { LOG.info(String.format("attempting to shutdown %s connector ...", CONNECTOR_TYPE)); synchronized (this) { _namedTaskHandlers.values().forEach(OracleTaskHandler::stop); } ThreadUtils.shutdownExecutor(_executorService, SHUTDOWN_TIMEOUT, LOG); } LOG.info(String.format("%s connector has successfully stopped", CONNECTOR_TYPE)); }</code><technical_language>ThreadUtil instead</technical_language>

Target:
public void stop() { LOG.info(String.format("attempting to shutdown %s connector ...", CONNECTOR_TYPE)); _namedTaskHandlers.values().forEach(OracleTaskHandler::stop); if (!ThreadUtils.shutdownExecutor(_executorService, SHUTDOWN_TIMEOUT, LOG)) { LOG.warn("Failed to shut down OracleTaskHandler Executor Service cleanly"); } if (!ThreadUtils.shutdownExecutor(_daemonThreadExecutorService, SHUTDOWN_TIMEOUT, LOG)) { LOG.warn("Failed to shut down daemon Thread Executor Service cleanly"); } _daemonThreadExecutorService = null; _namedTaskHandlers.clear(); LOG.info(String.format("%s connector has successfully stopped", CONNECTOR_TYPE)); }
Source:
<code>protected Iterable<IAnalysisModule> getDependentAnalyses() { ITmfTrace trace = getTrace(); if (trace != null) { ISegmentStoreProvider provider = findSegmentProviderAnalysis(trace); <START> if (provider != null && provider instanceof IAnalysisModule) { <END> fSegmentStoreProviderModule = (IAnalysisModule) provider; return ImmutableList.of((IAnalysisModule) provider); } } return super.getDependentAnalyses(); }</code><technical_language>instanceof check is enough, need for null checks in this case</technical_language>

Target:
protected Iterable<IAnalysisModule> getDependentAnalyses() { ITmfTrace trace = getTrace(); if (trace != null) { ISegmentStoreProvider provider = getSegmentProviderAnalysis(trace); if (provider instanceof IAnalysisModule) { fSegmentStoreProviderModule = (IAnalysisModule) provider; return ImmutableList.of((IAnalysisModule) provider); } } return super.getDependentAnalyses(); }
Source:
<code>public void onEvent(PersistenceProcessorImpl.PersistBatchEvent batchEvent) throws Exception { int commitEventsToFlush = 0; Batch batch = batchEvent.getBatch(); int numOfBatchedEvents = batch.getNumEvents(); batchSizeHistogram.update(numOfBatchedEvents); for (int i=0; i < numOfBatchedEvents; ++i) { PersistEvent event = batch.get(i); switch (event.getType()) { case COMMIT: event.getMonCtx().timerStart("commitPersistProcessor"); writer.addCommittedTransaction(event.getStartTimestamp(), event.getCommitTimestamp()); commitEventsToFlush++; break; case ABORT: break; case TIMESTAMP: event.getMonCtx().timerStart("timestampPersistProcessor"); break; } } <START> if(commitEventsToFlush > 0) { <END> flush(commitEventsToFlush); } filterClientRetriesAndSendBatchToReplyProcessor(batch, batchEvent.getBatchSequence()); }</code><technical_language>call flush(....) do check flush() complexity is hidden</technical_language>

Target:
public void onEvent(PersistenceProcessorImpl.PersistBatchEvent batchEvent) throws Exception { int commitEventsToFlush = 0; Batch batch = batchEvent.getBatch(); int numOfBatchedEvents = batch.getNumEvents(); batchSizeHistogram.update(numOfBatchedEvents); for (int i=0; i < numOfBatchedEvents; ++i) { PersistEvent event = batch.get(i); switch (event.getType()) { case COMMIT: event.getMonCtx().timerStart("commitPersistProcessor"); writer.addCommittedTransaction(event.getStartTimestamp(), event.getCommitTimestamp()); commitEventsToFlush++; break; case ABORT: break; case TIMESTAMP: event.getMonCtx().timerStart("timestampPersistProcessor"); break; } } flush(commitEventsToFlush); filterAndDissambiguateClientRetries(batch); replyProcessor.manageResponsesBatch(batchEvent.getBatchSequence(), batch); }