auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Warning createWarning(final Matcher matcher) { String message = matcher.group(2); Priority priority; StringBuilder category = new StringBuilder(); <START> if (matcher.group(1).equalsIgnoreCase("error")) { <END> priority = Priority.HIGH; category.append("ERROR"); } else if (matcher.group(1).equalsIgnoreCase("information")) { priority = Priority.LOW; category.append("Info"); } else { priority = Priority.NORMAL; category.append("Warning"); } Warning warning = createWarning("See Warning message", 0, category.toString(), message, priority); return warning; }</code><technical_language>constant left side</technical_language>

Target:
protected Warning createWarning(final Matcher matcher) { String message = matcher.group(2); String message_category = matcher.group(1); Priority priority; String category; if ("error".equalsIgnoreCase(message_category)) { priority = Priority.HIGH; category = "ERROR"; } else if ("information".equalsIgnoreCase(message_category)) { priority = Priority.LOW; category = "Info"; } else { priority = Priority.NORMAL; category = "Warning"; } return createWarning("See Warning message", 0, category, message, priority); }
Source:
<code><START> private void readCursorFile(File file) { <END> try { m_cursorsWriter = new RandomAccessFile(file, "rwd"); String cursorId = null; while ((cursorId=m_cursorsWriter.readUTF()) != null) { m_readCursors.put(cursorId, new ReadCursor(cursorId)); m_cursorsWriter.readUTF(); } } catch(EOFException e) { } catch(IOException e) { throw new RuntimeException(e); } }</code><technical_language>| line 661-662 | | --- | CRC entries written cursor file verify checksum read? thinking cases server powers cursor file manipulation. read invalid cursor recover advance cursor exist</technical_language>

Target:
private void readCursorFile(File file) { try { m_cursorsWriter = new RandomAccessFile(file, "rwd"); String cursorId = null; while ((cursorId=m_cursorsWriter.readUTF()) != null) { m_readCursors.put(cursorId, new ReadCursor(cursorId, m_numDeleted)); m_cursorsWriter.readUTF(); } } catch(EOFException e) { } catch(IOException e) { throw new RuntimeException(e); } }
Source:
<code>public static ColumnPath fromDotString(String path) { checkNotNull(path, "path"); <START> String[] parts = path.split("\\.(?=([^`]*`[^`]*`)*[^`]*$)"); <END> for (int i = 0; i < parts.length; ++i) { String part = parts[i]; if (part.startsWith("`") && part.endsWith("`")) { parts[i] = part.substring(1, part.length() - 1); } } return get(parts); }</code><technical_language>I centralize quote parsing logic. This is 3rd place unquote/unescape quoted names</technical_language>

Target:
public static ColumnPath fromDotString(String path) { checkNotNull(path, "path"); return get(QuotedIdentifiers.getParts(path)); }
Source:
<code>public String getUnifiedDiff() { PatchList patchList; try { patchList = getPatchList(); if (patchList.getOldId() == null) { return ""; } } catch (PatchListNotAvailableException e) { log.error("Cannot format patch", e); return ""; } TemporaryBuffer.Heap buf = new TemporaryBuffer.Heap(args.settings.maximumDiffSize); DiffFormatter fmt = new DiffFormatter(buf); Repository git; try { git = args.server.openRepository(change.getProject()); } catch (IOException e) { log.error("Cannot open repository to format patch", e); <START> return ""; <END> } try { fmt.setRepository(git); fmt.setDetectRenames(true); List<DiffEntry> entries = fmt.scan(patchList.getOldId(), patchList.getNewId()); try { fmt.format(entries); return RawParseUtils.decode(buf.toByteArray()); } catch (IOException err) { if (!JGitText.get().inMemoryBufferLimitExceeded.equals(err.getMessage())) { throw err; } StringBuilder sb = new StringBuilder(); for (DiffEntry e : entries) { switch (e.getChangeType()) { case ADD: sb.append("A ").append(e.getNewPath()); break; case MODIFY: sb.append("M ").append(e.getNewPath()); break; case DELETE: sb.append("D ").append(e.getOldPath()); break; case RENAME: sb.append(String.format("R%03d %s\n to %s", e.getScore(), e.getOldPath(), e.getNewPath())); break; case COPY: sb.append(String.format("C%03d %s\n from %s", e.getScore(), e.getNewPath(), e.getOldPath())); break; } sb.append('\n'); } sb.append(String.format( " %d files changed, %d insertions(+), %d deletions(-)\n", entries.size(), patchList.getInsertions(), patchList.getDeletions())); return sb.toString(); } } catch (IOException e) { log.error("Cannot format patch", e); return ""; } finally { fmt.release(); git.close(); } }</code><technical_language>want inform user, "An error occurred formatting patch"</technical_language>

Target:
public String getUnifiedDiff() { PatchList patchList; try { patchList = getPatchList(); if (patchList.getOldId() == null) { return ""; } } catch (PatchListNotAvailableException e) { log.error("Cannot format patch", e); return ""; } TemporaryBuffer.Heap buf = new TemporaryBuffer.Heap(args.settings.maximumDiffSize); DiffFormatter fmt = new DiffFormatter(buf); Repository git; try { git = args.server.openRepository(change.getProject()); } catch (IOException e) { log.error("Cannot open repository to format patch", e); return ""; } try { fmt.setRepository(git); fmt.setDetectRenames(true); fmt.format(patchList.getOldId(), patchList.getNewId()); return RawParseUtils.decode(buf.toByteArray()); } catch (IOException e) { if (JGitText.get().inMemoryBufferLimitExceeded.equals(e.getMessage())) { return ""; } log.error("Cannot format patch", e); return ""; } finally { fmt.release(); git.close(); } }
Source:
<code>public static String percentageValueIsInRange(Number number) { <START> return String.format("The percentage value <%s> should be between zero and hundred.",number.doubleValue()); <END> }</code><technical_language>0 100</technical_language>

Target:
public static String percentageValueIsInRange(Number number) { return String.format("The percentage value <%s> should be between 0 and 100.",number.doubleValue()); }
Source:
<code>private boolean isRootProcessorScope(ComponentModel componentModel) { ComponentIdentifier identifier = componentModel.getIdentifier(); return identifier.equals(FLOW_IDENTIFIER) || identifier.equals(MUNIT_BEFORE_SUITE_IDENTIFIER) <START> || identifier.equals(SUBFLOW_IDENTIFIER) || identifier.equals(CHOICE_WHEN_COMPONENT_IDENTIFIER) <END> || identifier.equals(CHOICE_OTHERWISE_COMPONENT_IDENTIFIER) || identifier.equals(MUNIT_BEFORE_TEST_IDENTIFIER) || identifier.equals(MUNIT_AFTER_SUITE_IDENTIFIER) || identifier.equals(MUNIT_AFTER_TEST_IDENTIFIER); }</code><technical_language>create issue add a TODO review this situation other components (try scatter-gather pop mind right now.)</technical_language>

Target:
private boolean isRootProcessorScope(ComponentModel componentModel) { ComponentIdentifier identifier = componentModel.getIdentifier(); return identifier.equals(FLOW_IDENTIFIER) || identifier.equals(MUNIT_BEFORE_SUITE_IDENTIFIER) || identifier.equals(SUBFLOW_IDENTIFIER) || identifier.equals(MUNIT_BEFORE_TEST_IDENTIFIER) || identifier.equals(MUNIT_AFTER_SUITE_IDENTIFIER) || identifier.equals(MUNIT_AFTER_TEST_IDENTIFIER); }
Source:
<code>public void testListRemote_Dumb_NoHEAD() throws Exception { Repository src = remoteRepository.getRepository(); File headref = new File(src.getDirectory(), Constants.HEAD); assertTrue("HEAD used to be present", headref.delete()); assertFalse("HEAD is gone", headref.exists()); Repository dst = createBareRepository(); Ref head; <START> try (Transport t = Transport.open(dst, dumbAuthNoneURI)) { try (FetchConnection c = t.openFetch()) { <END> head = c.getRef(Constants.HEAD); } } assertNull("has no " + Constants.HEAD, head); }</code><technical_language>This combined, line 198</technical_language>

Target:
public void testListRemote_Dumb_NoHEAD() throws Exception { Repository src = remoteRepository.getRepository(); File headref = new File(src.getDirectory(), Constants.HEAD); assertTrue("HEAD used to be present", headref.delete()); assertFalse("HEAD is gone", headref.exists()); Repository dst = createBareRepository(); Ref head; try (Transport t = Transport.open(dst, dumbAuthNoneURI); FetchConnection c = t.openFetch()) { head = c.getRef(Constants.HEAD); } assertNull("has no " + Constants.HEAD, head); }
Source:
<code>public void boardAutoCreator_clickYesInSavePrompt_currentBoardSaved() { int panelCount = panelControl.getPanelCount(); assertEquals(0, panelControl.getNumberOfSavedBoards()); pushKeys(new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN)); pushKeys(new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN)); <START> pushKeys(new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN)); <END> assertEquals(panelCount + 3, panelControl.getPanelCount()); traverseMenu("Boards", "Auto-create", "Milestones"); PlatformEx.waitOnFxThread(); waitUntilNodeAppears(String.format(SAVE_MESSAGE, "Milestones")); click("Yes"); click("OK"); assertEquals(2, panelControl.getNumberOfSavedBoards()); assertEquals(5, panelControl.getPanelCount()); traverseMenu("Boards", "Open", "New Board"); PlatformEx.waitOnFxThread(); assertEquals(panelCount + 3, panelControl.getPanelCount()); }</code><technical_language>KeyboardShortcuts.CREATE_RIGHT_PANEL</technical_language>

Target:
public void boardAutoCreator_clickYesInSavePrompt_currentBoardSaved() { int panelCount = panelControl.getPanelCount(); assertEquals(0, panelControl.getNumberOfSavedBoards()); pushKeys(KeyboardShortcuts.CREATE_RIGHT_PANEL); pushKeys(KeyboardShortcuts.CREATE_RIGHT_PANEL); pushKeys(KeyboardShortcuts.CREATE_RIGHT_PANEL); assertEquals(panelCount + 3, panelControl.getPanelCount()); traverseMenu("Boards", "Auto-create", "Milestones"); PlatformEx.waitOnFxThread(); waitUntilNodeAppears(String.format(SAVE_MESSAGE, "Milestones")); click("Yes"); click("OK"); assertEquals(2, panelControl.getNumberOfSavedBoards()); assertEquals(5, panelControl.getPanelCount()); traverseMenu("Boards", "Open", "New Board"); PlatformEx.waitOnFxThread(); assertEquals(panelCount + 3, panelControl.getPanelCount()); }
Source:
<code>public void startWebSocketServer(String hostname) throws IOException { <START> startWebSocketServer(getRandomPort(), hostname, 5000); <END> }</code><technical_language>This delegate startWebSocketServer(int, String)</technical_language>

Target:
public void startWebSocketServer(String hostname) throws IOException { startWebSocketServer(hostname, 0, DEFAULT_TIMEOUT); }
Source:
<code>public void afterPropertiesSet() { if (this.jpaParameters != null) { if (this.parameterSourceFactory == null) { ExpressionEvaluatingParameterSourceFactory expressionSourceFactory = new ExpressionEvaluatingParameterSourceFactory(this.beanFactory); expressionSourceFactory.setParameters(jpaParameters); this.parameterSourceFactory = expressionSourceFactory; } else { if (!(this.parameterSourceFactory instanceof ExpressionEvaluatingParameterSourceFactory)) { throw new IllegalStateException("You are providing 'JpaParameters'. " + "Was expecting the the provided jpaParameterSourceFactory " + "to be an instance of 'ExpressionEvaluatingJpaParameterSourceFactory', " + "however the provided one is of type '" + this.parameterSourceFactory.getClass().getName() + "'"); } } if (this.usePayloadAsParameterSource == null) { this.usePayloadAsParameterSource = false; } } else { if (this.parameterSourceFactory == null) { this.parameterSourceFactory = new BeanPropertyParameterSourceFactory(); } if (this.usePayloadAsParameterSource == null) { this.usePayloadAsParameterSource = true; } } if(maxNumberOfResultsExpression == null) { maxNumberOfResultsExpression = new LiteralExpression("0"); <START> } <END> }</code><technical_language>evaluateExpressionForNumericResult return 0 in case of provided expression is null</technical_language>

Target:
public void afterPropertiesSet() { if (this.jpaParameters != null) { if (this.parameterSourceFactory == null) { ExpressionEvaluatingParameterSourceFactory expressionSourceFactory = new ExpressionEvaluatingParameterSourceFactory(this.beanFactory); expressionSourceFactory.setParameters(jpaParameters); this.parameterSourceFactory = expressionSourceFactory; } else { if (!(this.parameterSourceFactory instanceof ExpressionEvaluatingParameterSourceFactory)) { throw new IllegalStateException("You are providing 'JpaParameters'. " + "Was expecting the the provided jpaParameterSourceFactory " + "to be an instance of 'ExpressionEvaluatingJpaParameterSourceFactory', " + "however the provided one is of type '" + this.parameterSourceFactory.getClass().getName() + "'"); } } if (this.usePayloadAsParameterSource == null) { this.usePayloadAsParameterSource = false; } } else { if (this.parameterSourceFactory == null) { this.parameterSourceFactory = new BeanPropertyParameterSourceFactory(); } if (this.usePayloadAsParameterSource == null) { this.usePayloadAsParameterSource = true; } } }
Source:
<code>private SingleCellAnalyticsSchemaField[] getFactorFieldNames(String experimentAccession, String cellId) { Map<String, Collection<Object>> queryResult = getCellQueryResultForMultiValueFields( experimentAccession, cellId, SingleCellAnalyticsCollectionProxy.FACTORS); return queryResult.getOrDefault(SingleCellAnalyticsCollectionProxy.FACTORS.name(), Collections.emptyList()) .stream() .filter(factor -> !factor.toString().equalsIgnoreCase("single_cell_identifier")) .map(factor -> SingleCellAnalyticsCollectionProxy.factorAsSchemaField(factor.toString(), StringUtils.capitalize(factor.toString()))) <START> .toArray(SingleCellAnalyticsSchemaField[]::new); <END> }</code><technical_language>logic sets displayName encapsulated in characteristicAsSchemaField factorAsSchemaField, need pass a single argument</technical_language>

Target:
private SingleCellAnalyticsSchemaField[] getFactorFieldNames(String experimentAccession, String cellId) { Map<String, Collection<Object>> queryResult = getCellQueryResultForMultiValueFields( experimentAccession, cellId, SingleCellAnalyticsCollectionProxy.FACTORS); return queryResult.getOrDefault(SingleCellAnalyticsCollectionProxy.FACTORS.name(), Collections.emptyList()) .stream() .filter(factor -> !factor.toString().equalsIgnoreCase("single_cell_identifier")) .map(factor -> SingleCellAnalyticsCollectionProxy.factorAsSchemaField(factor.toString())) .toArray(SingleCellAnalyticsSchemaField[]::new); }
Source:
<code>public void run() { if (zibase != null && eventPubisher != null) { try { zibase.hostRegistering(listenerHost, listenerPort); DatagramSocket serverSocket = new DatagramSocket(listenerPort); byte[] receiveData = new byte[470]; DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); running = true; while (running) { serverSocket.receive(receivePacket); ZbResponse zbResponse = new ZbResponse(receivePacket.getData()); logger.debug("ZIBASE MESSAGE: {}", zbResponse.getMessage()); publishEvents(zbResponse); Arrays.fill(receivePacket.getData(), 0, receivePacket.getLength(), (byte) 0); } zibase.hostUnregistering(listenerHost, listenerPort); serverSocket.close(); } catch (SocketException ex) { logger.error("Could not open socket to zibase : {}", ex); } catch (UnknownHostException ex) { logger.error("Given Zibase host not reachable : {}", ex); } catch (IOException ex) { logger.error("IO error reading Zibase socket : {}", ex); } } else { <START> logger.error("Zibase not initialized. Ip Address may be wrong or not reachable !"); <END> } }</code><technical_language>"IP Address"</technical_language>

Target:
public void run() { if (zibase != null && eventPublisher != null) { try { zibase.hostRegistering(listenerHost, listenerPort); DatagramSocket serverSocket = new DatagramSocket(listenerPort); byte[] receiveData = new byte[470]; DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); running = true; while (running) { serverSocket.receive(receivePacket); ZbResponse zbResponse = new ZbResponse(receivePacket.getData()); logger.debug("ZIBASE MESSAGE: {}", zbResponse.getMessage()); publishEvents(zbResponse); Arrays.fill(receivePacket.getData(), 0, receivePacket.getLength(), (byte) 0); } zibase.hostUnregistering(listenerHost, listenerPort); serverSocket.close(); } catch (SocketException ex) { logger.error("Could not open socket to zibase : {}", ex); } catch (UnknownHostException ex) { logger.error("Given Zibase host not reachable : {}", ex); } catch (IOException ex) { logger.error("IO error reading Zibase socket : {}", ex); } } else { logger.error("Zibase not initialized. IP address may be wrong or not reachable !"); } }
Source:
<code>public String[] getIndexToolArgValues(String schema, String baseTable, String indexName, String outFile, String tenantId) { String args[] = { "-s", schema, "-dt", baseTable, "-it", indexName, "-direct", "-op", outFile }; ArrayList<String> list = new ArrayList<>(Arrays.asList(args)); if (!GLOBAL_INDEX_ID.equals(tenantId)) { list.add("-tenant"); list.add(tenantId); } if (syncRebuild) { list.add("-runfg"); } <START> if(verify != null) { <END> list.add("-v"); list.add(verify); } return list.toArray(new String[list.size()]); }</code><technical_language>Replace IsNullOrEmpty check</technical_language>

Target:
public String[] getIndexToolArgValues(String schema, String baseTable, String indexName, String outFile, String tenantId) { String args[] = { "-s", schema, "-dt", baseTable, "-it", indexName, "-direct", "-op", outFile }; ArrayList<String> list = new ArrayList<>(Arrays.asList(args)); if (!GLOBAL_INDEX_ID.equals(tenantId)) { list.add("-tenant"); list.add(tenantId); } if (syncRebuild) { list.add("-runfg"); } if(!Strings.isNullOrEmpty(verify)) { list.add("-v"); list.add(verify); } return list.toArray(new String[list.size()]); }
Source:
<code>public void execute() throws MetaModelException { final ElasticSearchRestUpdateCallback updateCallback = getUpdateCallback(); final ElasticSearchRestDataContext dataContext = updateCallback.getDataContext(); final String indexName = dataContext.getIndexName(); final List<Table> tables = dataContext.getDefaultSchema().getTables(); if (!(tables.isEmpty() || tables.get(0).getName().equals(getTable().getName()))) { throw new MetaModelException("Can't add more than one table to Elasticsearch index."); } final Map<String, Object> source = new HashMap<>(); final Column[] columns = getColumns(); final Object[] values = getValues(); String id = null; for (int i = 0; i < columns.length; i++) { if (isSet(columns[i])) { final String columnName = columns[i].getName(); final Object value = values[i]; if (ElasticSearchUtils.FIELD_ID.equals(columnName)) { if (value != null) { id = value.toString(); } } else { final String fieldName = ElasticSearchUtils.getValidatedFieldName(columnName); source.put(fieldName, value); } } } if (!source.isEmpty()) { IndexRequest indexRequest = new IndexRequest(indexName).id(id); indexRequest.source(source); getUpdateCallback().execute(indexRequest); } else { <START> logger.info("Source is empty no index request is executed."); <END> } }</code><technical_language>A comma "Source is empty" this more readable</technical_language>

Target:
public void execute() throws MetaModelException { final ElasticSearchRestUpdateCallback updateCallback = getUpdateCallback(); final ElasticSearchRestDataContext dataContext = updateCallback.getDataContext(); final String indexName = dataContext.getIndexName(); final List<Table> tables = dataContext.getDefaultSchema().getTables(); if (!(tables.isEmpty() || tables.get(0).getName().equals(getTable().getName()))) { throw new MetaModelException("Can't add more than one table to Elasticsearch index."); } final Map<String, Object> source = new HashMap<>(); final Column[] columns = getColumns(); final Object[] values = getValues(); String id = null; for (int i = 0; i < columns.length; i++) { if (isSet(columns[i])) { final String columnName = columns[i].getName(); final Object value = values[i]; if (ElasticSearchUtils.FIELD_ID.equals(columnName)) { if (value != null) { id = value.toString(); } } else { final String fieldName = ElasticSearchUtils.getValidatedFieldName(columnName); source.put(fieldName, value); } } } if (!source.isEmpty()) { IndexRequest indexRequest = new IndexRequest(indexName).id(id); indexRequest.source(source); getUpdateCallback().execute(indexRequest); } else { logger.info("Source is empty, no index request is executed."); } }
Source:
<code>public void onStartup(final ServletContext servletContext) throws ServletException { <START> ServerConfiguration configuration = injectedConfig; <END> if(configuration == null) { configuration = ConfigurationFileLoader.loadConfiguration(); } updateConfigurationBySpring(configuration); PlatformBootstrap bootstrap = new PlatformBootstrap(); bootstrap.init(servletContext, configuration); }</code><technical_language>Add final keyword</technical_language>

Target:
public void onStartup(final ServletContext servletContext) throws ServletException { final ServerConfiguration configuration = Optional.ofNullable(injectedConfig) .orElse(ConfigurationFileLoader.loadConfiguration()); updateConfigurationBySpring(configuration); final PlatformBootstrap bootstrap = new PlatformBootstrap(); bootstrap.init(servletContext, configuration); }
Source:
<code>public void define(Context context) { ImmutableList.Builder<Object> builder = ImmutableList.builder(); Version sonarQubeVersion = context.getSonarQubeVersion(); if (!sonarQubeVersion.isGreaterThanOrEqual(SQ_6_0) || context.getRuntime().getProduct() != SonarProduct.SONARLINT) { builder.addAll(SurefireExtensions.getExtensions()); builder.addAll(JaCoCoExtensions.getExtensions(sonarQubeVersion)); builder.add(JavaSonarWayProfile.class); builder.addAll(JavaClasspathProperties.getProperties()); builder.add(JavaClasspath.class); } else { <START> builder.addAll(JavaClasspathProperties.getProperties()); <END> builder.add(JavaSonarLintClasspath.class); } builder.add( JavaTestClasspath.class, Java.class, PropertyDefinition.builder(Java.FILE_SUFFIXES_KEY) .defaultValue(Java.DEFAULT_FILE_SUFFIXES) .category(JavaConstants.JAVA_CATEGORY) .name("File suffixes") .description("Comma-separated list of suffixes for files to analyze. To not filter, leave the list empty.") .subCategory("General") .onQualifiers(Qualifiers.PROJECT) .build(), new JavaRulesDefinition(context.getSonarQubeVersion()), SonarComponents.class, DefaultJavaResourceLocator.class, JavaSquidSensor.class, PostAnalysisIssueFilter.class, XmlFileSensor.class); context.addExtensions(builder.build()); }</code><technical_language>I get javaClasspath needs properties read JavaClasspathProperties, order important needed _before_ adding JavaClasspath... adding in side of if moving then</technical_language>

Target:
public void define(Context context) { ImmutableList.Builder<Object> builder = ImmutableList.builder(); Version sonarQubeVersion = context.getSonarQubeVersion(); if (!sonarQubeVersion.isGreaterThanOrEqual(SQ_6_0) || context.getRuntime().getProduct() != SonarProduct.SONARLINT) { builder.addAll(SurefireExtensions.getExtensions()); builder.addAll(JaCoCoExtensions.getExtensions(sonarQubeVersion)); builder.add(JavaSonarWayProfile.class); builder.add(JavaClasspath.class); } else { builder.add(JavaSonarLintClasspath.class); } builder.addAll(JavaClasspathProperties.getProperties()); builder.add( JavaTestClasspath.class, Java.class, PropertyDefinition.builder(Java.FILE_SUFFIXES_KEY) .defaultValue(Java.DEFAULT_FILE_SUFFIXES) .category(JavaConstants.JAVA_CATEGORY) .name("File suffixes") .description("Comma-separated list of suffixes for files to analyze. To not filter, leave the list empty.") .subCategory("General") .onQualifiers(Qualifiers.PROJECT) .build(), new JavaRulesDefinition(context.getSonarQubeVersion()), SonarComponents.class, DefaultJavaResourceLocator.class, JavaSquidSensor.class, PostAnalysisIssueFilter.class, XmlFileSensor.class); context.addExtensions(builder.build()); }
Source:
<code>public Response addCluster(@FormDataParam("clusterConfigFile") final InputStream inputStream, @FormDataParam("clusterConfigFile") final FormDataContentDisposition contentDispositionHeader, @FormDataParam("cluster") final FormDataBodyPart clusterConfig) { try { <START> clusterConfig.setMediaType(MediaType.APPLICATION_JSON_TYPE); <END> Cluster clusterObj = clusterConfig.getValueAs(Cluster.class); saveClusterConfig(inputStream, clusterObj); Cluster createdCluster = catalogService.addCluster(clusterObj); return WSUtils.respond(CREATED, SUCCESS, createdCluster); } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } }</code><technical_language>is media type set here? Assuming user sending in json format respective content-type set</technical_language>

Target:
public Response addCluster(@FormDataParam("clusterConfigFile") final InputStream inputStream, @FormDataParam("clusterConfigFile") final FormDataContentDisposition contentDispositionHeader, @FormDataParam("cluster") final FormDataBodyPart clusterConfig) { try { LOG.debug("Media type {}", clusterConfig.getMediaType()); if (!clusterConfig.getMediaType().equals(MediaType.APPLICATION_JSON_TYPE)) { return WSUtils.respond(UNSUPPORTED_MEDIA_TYPE, ResponseMessage.UNSUPPORTED_MEDIA_TYPE); } Cluster clusterObj = clusterConfig.getValueAs(Cluster.class); saveClusterConfig(inputStream, clusterObj); Cluster createdCluster = catalogService.addCluster(clusterObj); return WSUtils.respond(CREATED, SUCCESS, createdCluster); } catch (ProcessingException ex) { return WSUtils.respond(BAD_REQUEST, ResponseMessage.BAD_REQUEST); } catch (Exception ex) { return WSUtils.respond(INTERNAL_SERVER_ERROR, EXCEPTION, ex.getMessage()); } }
Source:
<code>private void triggerPipeline(Pipeline pipeline, TriggerSource triggerSource) throws RejectedExecutionException { <START> final Map<String, String> mdc = MDC.getCopyOfContextMap(); <END> executorService.submit( () -> { if (mdc != null) { MDC.setContextMap(mdc); } triggerPipelineImpl(pipeline, triggerSource); if (mdc != null) { MDC.clear(); } }); }</code><technical_language>Curious thought process this propagate()</technical_language>

Target:
private void triggerPipeline(Pipeline pipeline, TriggerSource triggerSource) throws RejectedExecutionException { Callable<Void> triggerWithCapturedContext = AuthenticatedRequest.propagate(() -> triggerPipelineImpl(pipeline, triggerSource)); executorService.submit(triggerWithCapturedContext); }
Source:
<code>public void undo() { RunESCommand.run(new Callable<Void>() { public Void call() throws Exception { projectSpace.undoLastOperations(executedOperations.size()); return null; } }); <START> isUndo = <END> false; }</code><technical_language>Variable name is misleading. canUndo</technical_language>

Target:
public void undo() { RunESCommand.run(new Callable<Void>() { public Void call() throws Exception { projectSpace.undoLastOperations(executedOperations.size()); return null; } }); canUndo = false; }
Source:
<code>protected static void test_StartWebViewDialogActivity_LoadsUrlAndShowsTitle(String url, String title) { final WebViewActivity activity = Robolectric.buildActivity(WebViewActivity.class) .withIntent(WebViewActivity.newIntent(RuntimeEnvironment.application, url, title)).setup().get(); final View dialogView = Shadows.shadowOf(activity).getContentView(); assertNotNull(dialogView); final WebView webView = (WebView) dialogView.findViewById(R.id.eula_webView); assertNotNull(webView); final ShadowWebView shadowWebView = Shadows.shadowOf(webView); assertEquals(shadowWebView.getLastLoadedUrl(), url); <START> android.support.v7.app.ActionBar actionBar = activity.getSupportActionBar(); <END> assertNotNull(actionBar); if (TextUtils.isEmpty(title)) { assertTrue(!actionBar.isShowing()); } else { assertTrue(actionBar.isShowing()); assertTrue(title.equals(activity.getTitle())); } activity.onBackPressed(); assertTrue(activity.isFinishing()); }</code><technical_language>import this</technical_language>

Target:
protected static void test_StartWebViewDialogActivity_LoadsUrlAndShowsTitle(String url, String title) { final WebViewActivity activity = Robolectric.buildActivity(WebViewActivity.class) .withIntent(WebViewActivity.newIntent(RuntimeEnvironment.application, url, title)).setup().get(); final View dialogView = Shadows.shadowOf(activity).getContentView(); assertNotNull(dialogView); final WebView webView = (WebView) dialogView.findViewById(R.id.eula_webView); assertNotNull(webView); final ShadowWebView shadowWebView = Shadows.shadowOf(webView); assertEquals(shadowWebView.getLastLoadedUrl(), url); ActionBar actionBar = activity.getSupportActionBar(); assertNotNull(actionBar); if (TextUtils.isEmpty(title)) { assertTrue(!actionBar.isShowing()); } else { assertTrue(actionBar.isShowing()); assertTrue(title.equals(activity.getTitle())); } activity.onBackPressed(); assertTrue(activity.isFinishing()); }
Source:
<code>public void getJobStatusDetailed(GetJobStatusDetailedPRequest request, StreamObserver<GetJobStatusDetailedPResponse> responseObserver) { RpcUtils.call(LOG, (RpcUtils.RpcCallableThrowsIOException<GetJobStatusDetailedPResponse>) () -> { return GetJobStatusDetailedPResponse.newBuilder() .setJobInfo(mJobMaster.getStatus(request.getJobId(), true).toProto()).build(); <START> }, "getJobStatus", "request=%s", responseObserver, request); <END> }</code><technical_language>this getJobStatusDetailed</technical_language>

Target:
public void getJobStatusDetailed(GetJobStatusDetailedPRequest request, StreamObserver<GetJobStatusDetailedPResponse> responseObserver) { RpcUtils.call(LOG, (RpcUtils.RpcCallableThrowsIOException<GetJobStatusDetailedPResponse>) () -> { return GetJobStatusDetailedPResponse.newBuilder() .setJobInfo(mJobMaster.getStatus(request.getJobId(), true).toProto()).build(); }, "getJobStatusDetailed", "request=%s", responseObserver, request); }
Source:
<code>public Response createDirs( @PathParam ( "pathId" ) String pathId ) { try { if ( FileUtils.isRootLevelPath( FileUtils.idToPath( pathId ) ) ) { return Response.status( Response.Status.FORBIDDEN ).entity( "couldNotCreateRootLevelFolder" ).build(); } if ( fileService.doCreateDirSafe( pathId ) ) { return Response.ok().build(); } else { return Response.status( Response.Status.CONFLICT ).entity( "couldNotCreateFolderDuplicate" ).build(); } <START> } catch ( FileService.InvalidNameException t ) { <END> return Response.status( Response.Status.FORBIDDEN ).entity( "containsIllegalCharacters" ).build(); } catch ( Throwable t ) { return Response.serverError().entity( "" ).build(); } }</code><technical_language>is exception variable named t</technical_language>

Target:
public Response createDirs( @PathParam ( "pathId" ) String pathId ) { try { if ( FileUtils.isRootLevelPath( FileUtils.idToPath( pathId ) ) ) { return Response.status( Response.Status.FORBIDDEN ).entity( "couldNotCreateRootLevelFolder" ).build(); } if ( fileService.doCreateDirSafe( pathId ) ) { return Response.ok().build(); } else { return Response.status( Response.Status.CONFLICT ).entity( "couldNotCreateFolderDuplicate" ).build(); } } catch ( FileService.InvalidNameException e ) { return Response.status( Response.Status.FORBIDDEN ).entity( "containsIllegalCharacters" ).build(); } catch ( Throwable t ) { return Response.serverError().entity( "" ).build(); } }
Source:
<code>public final <U> ParallelFlowable<U> compose(@NonNull ParallelTransformer<T, U> composer) { <START> return RxJavaPlugins.onAssembly(composer.apply(this)); <END> }</code><technical_language>Missing check for composer null</technical_language>

Target:
public final <U> ParallelFlowable<U> compose(@NonNull ParallelTransformer<T, U> composer) { return RxJavaPlugins.onAssembly(ObjectHelper.requireNonNull(composer, "composer is null").apply(this)); }
Source:
<code>private void validateOutgoingMessageEnvelope(OutgoingMessageEnvelope outgoingMessageEnvelope) { MetricsSnapshot metricsSnapshot = new MetricsSnapshotSerdeV2().fromBytes((byte[]) outgoingMessageEnvelope.getMessage()); DiagnosticsStreamMessage diagnosticsStreamMessage = DiagnosticsStreamMessage.convertToDiagnosticsStreamMessage(metricsSnapshot); <START> Assert.assertTrue(diagnosticsStreamMessage.getContainerMb().equals(containerMb)); <END> Assert.assertTrue(diagnosticsStreamMessage.getExceptionEvents().equals(exceptionEventList)); Assert.assertTrue(diagnosticsStreamMessage.getProcessorStopEvents() .equals(Arrays.asList(new ProcessorStopEvent("0", executionEnvContainerId, hostname, 101)))); Assert.assertEquals(containerModels, diagnosticsStreamMessage.getContainerModels()); Assert.assertTrue(diagnosticsStreamMessage.getContainerNumCores().equals(containerNumCores)); Assert.assertTrue(diagnosticsStreamMessage.getNumStoresWithChangelog().equals(numStoresWithChangelog)); }</code><technical_language>Minor: Assert.assertEquals</technical_language>

Target:
private void validateOutgoingMessageEnvelope(OutgoingMessageEnvelope outgoingMessageEnvelope) { MetricsSnapshot metricsSnapshot = new MetricsSnapshotSerdeV2().fromBytes((byte[]) outgoingMessageEnvelope.getMessage()); DiagnosticsStreamMessage diagnosticsStreamMessage = DiagnosticsStreamMessage.convertToDiagnosticsStreamMessage(metricsSnapshot); Assert.assertEquals(containerMb, diagnosticsStreamMessage.getContainerMb().intValue()); Assert.assertEquals(exceptionEventList, diagnosticsStreamMessage.getExceptionEvents()); Assert.assertEquals(diagnosticsStreamMessage.getProcessorStopEvents(), Arrays.asList(new ProcessorStopEvent("0", executionEnvContainerId, hostname, 101))); Assert.assertEquals(containerModels, diagnosticsStreamMessage.getContainerModels()); Assert.assertEquals(containerNumCores, diagnosticsStreamMessage.getContainerNumCores().intValue()); Assert.assertEquals(numStoresWithChangelog, diagnosticsStreamMessage.getNumStoresWithChangelog().intValue()); }
Source:
<code>public SELF isEqualTo(Iterable<?> expected) { <START> if((actual == null && expected == null) || (actual == expected)) <END> return myself; if(actual == null || expected == null) throw new AssertionError("Iterables to compare can not be null."); if(recursiveComparisonConfiguration.isInStrictTypeCheckingOnActualMode() && !actual.getClass().isAssignableFrom(expected.getClass())) throw new AssertionError("types are not compatible."); if(sizeOf((Iterable<?>) actual) != sizeOf(expected)) throw new AssertionError("Sizes are not the same.Actual is of size " + sizeOf((Iterable<?>) actual) + ", Expected is of size " + sizeOf(expected)); boolean ignoreActualIterableOrder = recursiveComparisonConfiguration.getIgnoreActualIterableOrder(); if(!ignoreActualIterableOrder) iterableAssert.isEqualTo(expected); else { for(Object element : expected) iterableAssert.contains(element); } return myself; }</code><technical_language>I (actual == null && expected == null) removed check actual == null || expected == null afterward</technical_language>

Target:
public SELF isEqualTo(Iterable<?> expected) { boolean sameReferenceOrNull = checkIfExpectedIsSameReferenceOrNull(expected); if(sameReferenceOrNull) return myself; if(recursiveComparisonConfiguration.isInStrictTypeCheckingMode() && !actual.getClass().isAssignableFrom(expected.getClass())) throw new AssertionError(format("Comparison enforces strict type checking and fields are considered different since %s is not a subtype of %s.", actual.getClass().getName(), expected.getClass().getName())); if(sizeOf(actual) != sizeOf(expected)) throw new AssertionError(format("actual and expected values are %s of different size, actual size=%s when expected size=%s%nActual: %s%nExpected: %s", "iterables", sizeOf(actual), sizeOf(expected), actual, expected)); boolean ignoreCollectionOrder = recursiveComparisonConfiguration.getIgnoreCollectionOrder(); if(!ignoreCollectionOrder) iterableAssert.isEqualTo(expected); else { for(Object element : expected) iterableAssert.contains(element); } return myself; }
Source:
<code>private Node getPropertyNode(Document doc, String propertyId) { String docName = doc.getXMLParser().getXmlFile().getName(); if (docName.equals("custom.xml")) { NodeList nl = doc.getXMLParser().getNodesFromXPathExpression( " new DocxNamespaceContextEx(new String[] { "def", "<LINK_2>", "vt","<LINK_3>"})); <START> if (nl.getLength() > 0) return nl.item(0); <END> } else if (docName.equals("core.xml")) { NodeList nl = doc.getXMLParser().getNodesFromXPathExpression( "/cp:coreProperties/"+propertyId, new DocxNamespaceContextEx(new String[] { "cp", "<LINK_1>", "dc", "<LINK_0>", "dcterms", "<LINK_4>", "dcmitype","<LINK_5>"})); if (nl.getLength() > 0) return nl.item(0); } return null; }</code><technical_language>brackets :)</technical_language>

Target:
private Node getPropertyNode(Document doc, String propertyId) { String docName = doc.getXMLParser().getXmlFile().getName(); if (docName.equals("custom.xml")) { NodeList nl = doc.getXMLParser().getNodesFromXPathExpression( " new DocxNamespaceContextEx(new String[] { "def", "<LINK_2>", "vt","<LINK_3>"})); if (nl.getLength() > 0) { return nl.item(0); } } else if (docName.equals("core.xml")) { NodeList nl = doc.getXMLParser().getNodesFromXPathExpression( "/cp:coreProperties/"+propertyId, new DocxNamespaceContextEx(new String[] { "cp", "<LINK_1>", "dc", "<LINK_0>", "dcterms", "<LINK_4>", "dcmitype","<LINK_5>"})); if (nl.getLength() > 0) return nl.item(0); } return null; }
Source:
<code>public int getMultiplication() { <START> return multiplication; <END> }</code><technical_language>this</technical_language>

Target:
@Override public int getMultiplication() { return this.mulFactor; }
Source:
<code>protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { DocumentRef[] docRefs = ids.stream().map(IdRef::new).toArray(DocumentRef[]::new); DocumentModelList docs = session.getDocuments(docRefs); for (DocumentModel doc : docs) { for (Entry<String, Serializable> es : properties.entrySet()) { try { doc.setPropertyValue(es.getKey(), es.getValue()); } catch (PropertyException e) { <START> log.warn("Cannot write property: " + es.getKey() + " of document: " + doc.getId(), e); <END> } } try { session.saveDocument(doc); } catch (PropertyException e) { log.warn("Cannot save document: " + doc.getId(), e); } } }</code><technical_language>please getLog() remove local definition of log</technical_language>

Target:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { DocumentRef[] docRefs = ids.stream().map(IdRef::new).toArray(DocumentRef[]::new); DocumentModelList docs = session.getDocuments(docRefs); for (DocumentModel doc : docs) { for (Entry<String, Serializable> es : properties.entrySet()) { try { doc.setPropertyValue(es.getKey(), es.getValue()); } catch (PropertyException e) { getLog().warn("Cannot write property: " + es.getKey() + " of document: " + doc.getId(), e); } } try { session.saveDocument(doc); } catch (PropertyException e) { getLog().warn("Cannot save document: " + doc.getId(), e); } } }
Source:
<code>public void shouldThrowExceptionHttpClient() throws Exception { UUID uuid = UUID.randomUUID(); when(rapidProHttpClient.executeGet("/contacts", MediaFormat.JSON, null)).thenThrow(new RapidProClientException("Exception")); <START> Contact fromWebservice = contactWebService.getContactByUUID(uuid); <END> }</code><technical_language>variable is pointless</technical_language>

Target:
public void shouldThrowExceptionHttpClient() throws Exception { UUID uuid = UUID.randomUUID(); when(rapidProHttpClient.executeGet("/contacts", MediaFormat.JSON, null)).thenThrow(new RapidProClientException("Exception")); contactWebService.getContactByUUID(uuid); }
Source:
<code>private void initializeHeaderOutLong() throws IOException { headerOut.close(); headerOutLong = new CountingOutputStream(ioPeon.makeOutputStream(makeFilename("headerLong"))); File f = ioPeon.getFile(makeFilename("header")); try (RandomAccessFile headerFile = new RandomAccessFile(f, "r")) { <START> for (int i = 0; i < numWritten; i++) { <END> headerFile.seek(i * Ints.BYTES); int count = headerFile.readInt(); headerOutLong.write(Longs.toByteArray(count)); } } }</code><technical_language>convert bulk transfer headerFile.getChannel() headerOutLong, a lot of RAF seek() calls</technical_language>

Target:
private void initializeHeaderOutLong() throws IOException { headerOut.close(); headerOutLong = new CountingOutputStream(ioPeon.makeOutputStream(makeFilename("headerLong"))); try (RandomAccessFile headerFile = new RandomAccessFile(ioPeon.getFile(makeFilename("header")), "r")) { ByteBuffer buf = ByteBuffer.allocate(Longs.BYTES).order(ByteOrder.nativeOrder()); for (int i = 0; i < numWritten; i++) { int count = headerFile.readInt(); writeLongValueToOutputStream(buf, count, headerOutLong); } } }
Source:
<code>public void setOnBehalfOf(String onBehalfOfID) { <START> this.onBehalfOf = APIResource.setExpandableFieldID(onBehalfOfID, this.destination); <END> }</code><technical_language>I understand this.destination is here, clarify</technical_language>

Target:
public void setOnBehalfOf(String onBehalfOfID) { this.onBehalfOf = APIResource.setExpandableFieldID(onBehalfOfID, this.onBehalfOf); }
Source:
<code>public void showAllSurvey(final List<Survey> surveys) { if (surveys.size() == 0) { surveySelectText.setText(R.string.no_survey); } <START> SurveyListAdapter surveyListAdapter = new SurveyListAdapter(getActivity(), surveys); <END> lv_surveys_list.setAdapter(surveyListAdapter); lv_surveys_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { mListener.loadSurveyQuestion(surveys.get(position), clientId); } }); }</code><technical_language>@mayank-kgp if surveys.size() == 0 creating a Survey List Adapter ? put rest of code in else block</technical_language>

Target:
public void showAllSurvey(final List<Survey> surveys) { if (surveys.size() == 0) { surveySelectText.setText(getResources(). getString(R.string.no_survey_available_for_client)); } else { SurveyListAdapter surveyListAdapter = new SurveyListAdapter(getActivity(), surveys); lv_surveys_list.setAdapter(surveyListAdapter); lv_surveys_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { mListener.loadSurveyQuestion(surveys.get(position), clientId); } }); } }
Source:
<code>public void shutdown() { cancelScheduledTasks(); if (instanceInfo != null && shouldRegister(instanceInfo)) { instanceInfo.setStatus(InstanceStatus.DOWN); unregister(); } <START> DiscoveryManager.getInstance().setDiscoveryClient(null); <END> DiscoveryManager.getInstance().setEurekaClientConfig(null); }</code><technical_language>I do this. Instead if paranoid people this shutdown(), add checks of isShutdown() I required</technical_language>

Target:
public void shutdown() { cancelScheduledTasks(); if (instanceInfo != null && shouldRegister(instanceInfo)) { instanceInfo.setStatus(InstanceStatus.DOWN); unregister(); } }
Source:
<code>public void write(JsonWriter out, T value) throws IOException { TypeAdapter chosen = delegate; Type runtimeType = getRuntimeTypeIfMoreSpecific(type, value); <START> if (runtimeType != type && !Primitives.areEquivalentTypes(runtimeType, type)) { <END> TypeAdapter runtimeTypeAdapter = context.getAdapter(TypeToken.get(runtimeType)); if (!(runtimeTypeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter)) { chosen = runtimeTypeAdapter; } else if (!(delegate instanceof ReflectiveTypeAdapterFactory.Adapter)) { chosen = delegate; } else { chosen = runtimeTypeAdapter; } } chosen.write(out, value); }</code><technical_language>This right location for fix. expect nearby @JsonAdapter handling code</technical_language>

Target:
public void write(JsonWriter out, T value) throws IOException { TypeAdapter chosen = delegate; Type runtimeType = getRuntimeTypeIfMoreSpecific(type, value); if (runtimeType != type) { TypeAdapter runtimeTypeAdapter = context.getAdapter(TypeToken.get(runtimeType)); if (!(runtimeTypeAdapter instanceof ReflectiveTypeAdapterFactory.Adapter)) { chosen = runtimeTypeAdapter; } else if (!(delegate instanceof ReflectiveTypeAdapterFactory.Adapter)) { chosen = delegate; } else { chosen = runtimeTypeAdapter; } } chosen.write(out, value); }
Source:
<code>private boolean loadBooleanParam(String name, FilterConfig filterConfig, boolean defaultValue) { boolean result = defaultValue; String fParam = filterConfig.getInitParameter(name); if (fParam != null) { result = parseBoolean(fParam); } <START> String sParam = System.getProperty("blazegraph." + filterConfig.getFilterName() + "." + name); <END> if (sParam != null) { result = parseBoolean(sParam); } return result; }</code><technical_language>I if sense split logic parsing logic repeat logic in int boolean versions</technical_language>

Target:
private boolean loadBooleanParam(String name, FilterConfig filterConfig, boolean defaultValue) { String result = loadStringParam(name, filterConfig); return result != null ? parseBoolean(result) : defaultValue; }
Source:
<code>public void theEnableDebugRequestIsReceived(final Map<String, String> requestData) throws Throwable { final EnableDebuggingRequest request = EnableDebuggingRequestFactory.fromParameterMap(requestData); final EnableDebuggingAsyncResponse asyncResponse = this.requestClientEnableDebugging.doRequest(request); <START> assertNotNull("asyncResponse should not be null", asyncResponse); <END> ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }</code><technical_language>capital 'AsyncResponse'</technical_language>

Target:
public void theEnableDebugRequestIsReceived(final Map<String, String> requestData) throws Throwable { final EnableDebuggingRequest enableDebuggingRequest = EnableDebuggingRequestFactory .fromParameterMap(requestData); final EnableDebuggingAsyncResponse enableDebuggingAsyncResponse = this.smartMeteringManagementRequestClientEnableDebugging .doRequest(enableDebuggingRequest); assertNotNull("AsyncResponse should not be null", enableDebuggingAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, enableDebuggingAsyncResponse.getCorrelationUid()); }
Source:
<code>private void sendCancelCommand(IntSet cancelledSegments) { <START> Address origin = rpcManager.getAddress(); <END> CacheRpcCommand cmd = commandsFactory.buildStateTransferCancelCommand(topologyId, cancelledSegments); try { rpcManager.sendTo(source, cmd, DeliverOrder.NONE); } catch (Exception e) { log.debugf("Caught an exception while cancelling state transfer from node %s for segments %s", source, cancelledSegments); } }</code><technical_language>removed</technical_language>

Target:
private void sendCancelCommand(IntSet cancelledSegments) { CacheRpcCommand cmd = commandsFactory.buildStateTransferCancelCommand(topologyId, cancelledSegments); try { rpcManager.sendTo(source, cmd, DeliverOrder.NONE); } catch (Exception e) { log.debugf("Caught an exception while cancelling state transfer from node %s for segments %s", source, cancelledSegments); } }
Source:
<code>public void testWebView() { WelcomePageBase welcomePage = initPage(getDriver(), WelcomePageBase.class); LoginPageBase loginPage = welcomePage.clickNextBtn(); loginPage.login(); WebViewPageBase webViewPageBase = initPage(getDriver(), WebViewPageBase.class); MobileContextUtils contextHelper = new MobileContextUtils(); <START> contextHelper.switchMobileContext(MobileContextUtils.View.WEB, getDriver()); <END> ContactUsPageBase contactUsPage = webViewPageBase.goToContactUsPage(); contactUsPage.typeName("John Doe"); contactUsPage.typeEmail("some@email.com"); contactUsPage.typeQuestion("This is a message"); MobileUtils.hideKeyboard(); contactUsPage.submit(); Assert.assertTrue(contactUsPage.isSuccessMessagePresent() || contactUsPage.isRecaptchaPresent(), "message was not sent or captcha was not displayed"); }</code><technical_language>contextHelper.switchMobileContext(MobileContextUtils.View.WEB, getDriver()); strange. I that: contextHelper.switchMobileContext(View.WEB);</technical_language>

Target:
public void testWebView() { WelcomePageBase welcomePage = initPage(getDriver(), WelcomePageBase.class); LoginPageBase loginPage = welcomePage.clickNextBtn(); loginPage.login(); WebViewPageBase webViewPageBase = initPage(getDriver(), WebViewPageBase.class); MobileContextUtils contextHelper = new MobileContextUtils(); contextHelper.switchMobileContext(View.WEB); ContactUsPageBase contactUsPage = webViewPageBase.goToContactUsPage(); contactUsPage.typeName("John Doe"); contactUsPage.typeEmail("some@email.com"); contactUsPage.typeQuestion("This is a message"); MobileUtils.hideKeyboard(); contactUsPage.submit(); Assert.assertTrue(contactUsPage.isSuccessMessagePresent() || contactUsPage.isRecaptchaPresent(), "message was not sent or captcha was not displayed"); }