auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isValidInput() { mErrorView.setVisibility(View.GONE); mInputView.setContentDescription(String.format("%s. %s.", mInputView.getSelectedItemName(), mField.getInstructions())); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if (errorMessage == null || errorMessage.isEmpty()) { <START> errorMessage = getView().getResources().getString(R.string.error_select_field, <END> mField.getLabel()); } handleError(errorMessage); return false; } else if (!mField.isRequired() && mField.getFieldType().equals(RegistrationFieldType.MULTI) && mInputView.length() > 0 && !hasValue()) { String errorMessage = getView().getResources().getString(R.string.error_select_or_enter_field, mField.getLabel()); handleError(errorMessage); return false; } return true; }</code><technical_language>IMO, 'error_select_or_enter_field' message instated of</technical_language>

Target:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); mInputView.setContentDescription(String.format("%s. %s.", mInputView.getSelectedItemName(), mField.getInstructions())); if ((mField.isRequired() || (!mField.isRequired() && mField.getFieldType().equals(RegistrationFieldType.MULTI) && mInputView.length() > 0)) && !hasValue()) { initializeErrorMessage(); return false; } return true; }
Source:
<code>public void shouldGetSizeOfDirectory() throws Exception { int testContent = 156575; URI resource = fileManagement.create(URI.create("fileTest"), "size.txt", true); Assert.assertTrue(fileManagement.fileExist(resource)); <START> OutputStream outputStream = fileManagement.write(URI.create("fileTest/size.txt")); <END> try { outputStream.write(testContent); } finally { outputStream.flush(); outputStream.close(); } long directorySize = fileManagement.getSizeOfDirectory(URI.create("fileTest")); Assert.assertEquals(directorySize, 1); }</code><technical_language>Please try-with-resources statement for outputStream object avoid resources leaks</technical_language>

Target:
public void shouldGetSizeOfDirectory() throws Exception { int testContent = 156575; URI directory = fileManagement.create(URI.create(""), "directorySize", false); URI resource = fileManagement.create(directory, "size.txt", true); Assert.assertTrue(fileManagement.fileExist(resource)); try (OutputStream outputStream = fileManagement.write(URI.create("directorySize/size.txt"))){ outputStream.write(testContent); } long directorySize = fileManagement.getSizeOfDirectory(URI.create("directorySize")); Assert.assertEquals("Incorrect size of directory", 1, directorySize); }
Source:
<code>public void verifyNewSuggestionsTextAndImages(String query) { searchField.click(); waitForElementByBy(jqueryAutocompleteBy); searchField.sendKeys(query); waitForElementByElement(newSuggestionsList.get(0)); System.out.println(newSuggestionsList.size() ); for(int i = 0; i < newSuggestionsList.size(); i++) { Assertion.assertStringContains(suggestionText.get(i).getText(), query); Assertion.assertTrue(suggestionImage.get(i).isDisplayed()); <START> PageObjectLogging.log("assertTrue", "Image next to suggestion verified", true, driver); <END> } }</code><technical_language>skip driver in PageObjectLogging.log() method. If assertion fails do screenshot if passes need screenshot is fine</technical_language>

Target:
public void verifyNewSuggestionsTextAndImages(String query) { searchField.click(); waitForElementByBy(jqueryAutocompleteBy); searchField.sendKeys(query); waitForElementByElement(newSuggestionsList.get(0)); System.out.println(newSuggestionsList.size() ); for(int i = 0; i < newSuggestionsList.size(); i++) { Assertion.assertStringContains(suggestionTextsList.get(i).getText(), query); Assertion.assertTrue(suggestionImagesList.get(i).isDisplayed()); } PageObjectLogging.log("verifyNewSuggestionsTextAndImages", "Image and text next to every suggestion is verified", true); }
Source:
<code><START> public void testLamba024() throws Exception { <END> new RuntimeTestHelper(LAMBDA024) .setSourceLevel(SourceLevel.JAVA_8) .addProperty(Options.LAMBDA_TO_ANONYMOUS_CONVERTER.getName(), Boolean.TRUE.toString()) .addTestExeFileChecker(new FileChecker() { @Override public void check(@Nonnull File file) throws Exception { DexFile dexFile = new DexFile(file); Set<String> sourceFileInDex = new HashSet<String>(); for (ClassDefItem classDef : dexFile.ClassDefsSection.getItems()) { sourceFileInDex.add(classDef.getSourceFile().getStringValue()); } Assert.assertTrue(sourceFileInDex.contains("I1.java")); Assert.assertTrue(!sourceFileInDex.contains("I2.java")); } }) .compileAndRunTest(); }</code><technical_language>is a lot of redundant code</technical_language>

Target:
public void testLamba024() throws Exception { new RuntimeTestHelper(LAMBDA024) .setSourceLevel(SourceLevel.JAVA_8) .addProperty(Options.LAMBDA_TO_ANONYMOUS_CONVERTER.getName(), Boolean.TRUE.toString()) .addTestExeFileChecker(new ShrinkFileChecker().addKeptFile("I1.java").addRemovedFile("I2.java")) .compileAndRunTest(); }
Source:
<code>public EngineScheduleExpression(String cronExpression) { super(); String[] cron = cronExpression.split("\\s *"); <START> second(cron[0]).minute(cron[1]).hour(cron[2]).dayOfMonth(cron[3]).month(cron[4]).dayOfWeek(cron[5]); <END> if (cron.length >= 7) { year(cron[6]); } }</code><technical_language>method invocation line more readable</technical_language>

Target:
public EngineScheduleExpression(String cronExpression) { String[] cron = cronExpression.split("\\s *"); second(cron[0]).minute(cron[1]).hour(cron[2]).dayOfMonth(cron[3]).month(cron[4]).dayOfWeek(cron[5]); if (cron.length >= 7) { year(cron[6]); } }
Source:
<code><START> public IMetaStoreClient getHeatbeatMSC() { <END> connectionStats.incrementMetastoreCalls(); return heartbeatMSClient; }</code><technical_language>similarly this</technical_language>

Target:
IMetaStoreClient getHeatbeatMSC() { connectionStats.incrementMetastoreCalls(); return heartbeatMSClient; }
Source:
<code>public void onAttach(Activity activity) { super.onAttach(activity); try { mDelegate = (ServiceFragmentDelegate) activity; <START> setTimer(INITIAL_MEASUREMENT_INTERVAL); <END> } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement ServiceFragmentDelegate"); } }</code><technical_language>onAttach is called onCreateView notification for a characteristic value. Gatt Server is initialized in onStart I move this onStart method</technical_language>

Target:
public void onAttach(Activity activity) { super.onAttach(activity); try { mDelegate = (ServiceFragmentDelegate) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement ServiceFragmentDelegate"); } }
Source:
<code>public void auditLoggingOffForInboundX12BatchRequest() { final CORE_X12BatchSubmissionAuditLogger auditLogger = getAuditLogger(false); <START> COREEnvelopeBatchSubmissionResponse expectedResponse = new COREEnvelopeBatchSubmissionResponse(); <END> when(adpFactory.getAdapterCORE_X12DocSubmissionProxy()).thenReturn(reqProxy); when(reqProxy.batchSubmitTransaction(request, assertion)).thenReturn(expectedResponse); PassthroughInboundCORE_X12DSGenericBatchRequest batchReq = new PassthroughInboundCORE_X12DSGenericBatchRequest(adpFactory, auditLogger); COREEnvelopeBatchSubmissionResponse actualResposne = batchReq.batchSubmitTransaction( request, assertion, webContextProperties); verify(mockEJBLogger, never()).auditResponseMessage(eq(request), eq(actualResposne), eq(assertion), isNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.FALSE), eq(webContextProperties), eq(NhincConstants.CORE_X12DS_GENERICBATCH_REQUEST_SERVICE_NAME), any(COREX12BatchSubmissionAuditTransforms.class)); }</code><technical_language>declared class level for methods</technical_language>

Target:
public void auditLoggingOffForInboundX12BatchRequest() { when(adpFactory.getAdapterCORE_X12DocSubmissionProxy()).thenReturn(reqProxy); when(reqProxy.batchSubmitTransaction(request, assertion)).thenReturn(expectedResponse); batchReq = new PassthroughInboundCORE_X12DSGenericBatchRequest(adpFactory, getAuditLogger(false)); actualResposne = batchReq.batchSubmitTransaction(request, assertion, webContextProperties); verify(mockEJBLogger, never()).auditResponseMessage(eq(request), eq(actualResposne), eq(assertion), isNull(NhinTargetSystemType.class), eq(NhincConstants.AUDIT_LOG_OUTBOUND_DIRECTION), eq(NhincConstants.AUDIT_LOG_NHIN_INTERFACE), eq(Boolean.FALSE), eq(webContextProperties), eq(NhincConstants.CORE_X12DS_GENERICBATCH_REQUEST_SERVICE_NAME), any(COREX12BatchSubmissionAuditTransforms.class)); }
Source:
<code>public NoteInfo getNote(long noteId) { Uri noteUri = Uri.withAppendedPath(Note.CONTENT_URI, Long.toString(noteId)); <START> Cursor cursor = mResolver.query(noteUri, null, null, null, null); <END> if (cursor == null) { return null; } try { if (!cursor.moveToNext()) { return null; } return NoteInfo.buildFromCursor(cursor); } finally { cursor.close(); } }</code><technical_language>I explicitly projection, more free in future change default projection in provider</technical_language>

Target:
public NoteInfo getNote(long noteId) { Uri noteUri = Uri.withAppendedPath(Note.CONTENT_URI, Long.toString(noteId)); Cursor cursor = mResolver.query(noteUri, PROJECTION, null, null, null); if (cursor == null) { return null; } try { if (!cursor.moveToNext()) { return null; } return NoteInfo.buildFromCursor(cursor); } finally { cursor.close(); } }
Source:
<code>public boolean isValidInput() { mErrorView.setVisibility(View.GONE); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_select_field); <START> errorMessage = errorMessage.replaceFirst(getView().getResources() <END> .getString(R.string.register_field) ,mField.getLabel().toLowerCase()); } if(errorMessage!=null){ handleError(errorMessage); } return false; } return true; }</code><technical_language>standard format strings for this instead of rolling formatting</technical_language>

Target:
public boolean isValidInput() { mErrorView.setVisibility(View.GONE); if (mField.isRequired() && !hasValue()) { String errorMessage = mField.getErrorMessage().getRequired(); if(errorMessage==null || errorMessage.isEmpty()){ errorMessage = getView().getResources().getString(R.string.error_select_field, mField.getLabel()); } handleError(errorMessage); return false; } return true; }
Source:
<code>private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<InputClauseRequirement> inputClauseRequirements, final String text) { for (BuiltInType bi : BuiltInType.values()) { for (String biName : bi.getNames()) { <START> if (biName.equals(typeRef.getLocalPart())) { <END> inputClauseRequirements.add(new InputClauseRequirement(text, typeRef)); return; } } } final Optional<ItemDefinition> oItemDefinition = definitions.getItemDefinition() .stream() .filter(itemDef -> itemDef.getName().getValue().equals(typeRef.getLocalPart())) .findFirst(); oItemDefinition.ifPresent(itemDefinition -> { if (itemDefinition.getItemComponent().size() == 0) { inputClauseRequirements.add(new InputClauseRequirement(text, itemDefinition.getTypeRef())); } else { itemDefinition.getItemComponent() .forEach(itemDefinitionComponent -> addInputClauseRequirement(itemDefinitionComponent.getTypeRef(), definitions, inputClauseRequirements, text + "." + itemDefinitionComponent.getName().getValue())); } }); }</code><technical_language>Objects.equals()</technical_language>

Target:
private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<InputClauseRequirement> inputClauseRequirements, final String text) { for (BuiltInType bi : BuiltInType.values()) { for (String biName : bi.getNames()) { if (Objects.equals(biName, typeRef.getLocalPart())) { inputClauseRequirements.add(new InputClauseRequirement(text, typeRef)); return; } } } definitions.getItemDefinition() .stream() .filter(itemDef -> itemDef.getName().getValue().equals(typeRef.getLocalPart())) .findFirst() .ifPresent(itemDefinition -> { if (itemDefinition.getItemComponent().size() == 0) { inputClauseRequirements.add(new InputClauseRequirement(text, itemDefinition.getTypeRef())); } else { itemDefinition.getItemComponent() .forEach(itemComponent -> { if (!Objects.equals(itemDefinition.getName().getValue(), itemComponent.getTypeRef().getLocalPart())) { addInputClauseRequirement(itemComponent.getTypeRef(), definitions, inputClauseRequirements, text + "." + itemComponent.getName().getValue()); } else { inputClauseRequirements.add(new InputClauseRequirement(text + "." + itemComponent.getName().getValue(), itemComponent.getTypeRef())); } }); } }); }
Source:
<code>public ListenableFuture<?> execute( SetPath statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); SqlPath sqlPath = new SqlPath(Optional.of(statement.getPathSpecification().toString())); List<SqlPathElement> path = sqlPath.getParsedPath(); <START> for (SqlPathElement element : path) { <END> if (!element.getCatalog().isPresent() && !session.getCatalog().isPresent()) { throw new SemanticException(CATALOG_NOT_SPECIFIED, statement, "Catalog must be specified for each path element when session catalog is not set"); } element.getCatalog().ifPresent(catalog -> { String catalogName = catalog.getValue().toLowerCase(ENGLISH); if (!metadata.getCatalogHandle(session, catalogName).isPresent()) { throw new PrestoException(NOT_FOUND, "Catalog does not exist: " + catalogName); } }); } stateMachine.setSetPath(sqlPath.toString()); return immediateFuture(null); }</code><technical_language>path is else, do for (SqlPathElement element : sqlPath.getParsedPath())</technical_language>

Target:
public ListenableFuture<?> execute( SetPath statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine, List<Expression> parameters) { Session session = stateMachine.getSession(); if (!session.getClientCapabilities().contains(ClientCapabilities.PATH.toString())) { throw new PrestoException(NOT_SUPPORTED, "SET PATH not supported by client"); } SqlPath sqlPath = new SqlPath(Optional.of(statement.getPathSpecification().toString())); for (SqlPathElement element : sqlPath.getParsedPath()) { if (!element.getCatalog().isPresent() && !session.getCatalog().isPresent()) { throw new SemanticException(CATALOG_NOT_SPECIFIED, statement, "Catalog must be specified for each path element when session catalog is not set"); } element.getCatalog().ifPresent(catalog -> { String catalogName = catalog.getValue().toLowerCase(ENGLISH); if (!metadata.getCatalogHandle(session, catalogName).isPresent()) { throw new PrestoException(NOT_FOUND, "Catalog does not exist: " + catalogName); } }); } stateMachine.setSetPath(sqlPath.toString()); return immediateFuture(null); }
Source:
<code>private ExportResult exportToClipboard(Exporter exporter) throws Exception { Globals.prefs.fileDirForDatabase = panel.getBibDatabaseContext().getFileDirectoriesAsPaths(Globals.prefs.getFilePreferences()).stream().map(Path::toString).collect(Collectors.toList()); Globals.prefs.put(JabRefPreferences.LAST_USED_EXPORT, exporter.getName()); Path tmp = null; try { tmp = Files.createTempFile("jabrefCb", ".tmp"); entries.addAll(panel.getSelectedEntries()); exporter.export(panel.getBibDatabaseContext(), tmp, panel.getBibDatabaseContext() .getMetaData() .getEncoding() .orElse(Globals.prefs.getDefaultEncoding()), entries); return new ExportResult(readFileToString(tmp), exporter.getFileType()); } catch (Exception e) { LOGGER.error("Error exporting to clipboard", e); } finally { if ((tmp != null) && Files.exists(tmp)) { try { Files.delete(tmp); } catch (IOException e) { LOGGER.info("Cannot delete temporary clipboard file", e); } } } <START> throw new Exception("export failed."); <END> }</code><technical_language>I remove Exception handler (or rethrow there) get a more detailed exception message of wrong</technical_language>

Target:
private ExportResult exportToClipboard(Exporter exporter) throws Exception { Globals.prefs.fileDirForDatabase = panel.getBibDatabaseContext().getFileDirectoriesAsPaths(Globals.prefs.getFilePreferences()).stream().map(Path::toString).collect(Collectors.toList()); Globals.prefs.put(JabRefPreferences.LAST_USED_EXPORT, exporter.getName()); Path tmp = null; try { tmp = Files.createTempFile("jabrefCb", ".tmp"); entries.addAll(panel.getSelectedEntries()); exporter.export(panel.getBibDatabaseContext(), tmp, panel.getBibDatabaseContext() .getMetaData() .getEncoding() .orElse(Globals.prefs.getDefaultEncoding()), entries); return new ExportResult(readFileToString(tmp), exporter.getFileType()); } catch (Exception e) { LOGGER.error("Error exporting to clipboard", e); throw new Exception("Rethrow ", e); } finally { if ((tmp != null) && Files.exists(tmp)) { try { Files.delete(tmp); } catch (IOException e) { LOGGER.info("Cannot delete temporary clipboard file", e); } } } }
Source:
<code>public void run() { <START> dataLakeFileClient.uploadFromFile(TEMP_FILE.toString(), true); <END> }</code><technical_language>perf impact negligible, a principle call TEMP_FILE.toString() store result in a variable, calling iteration</technical_language>

Target:
public void run() { dataLakeFileClient.uploadFromFile(TEMP_FILE_PATH, true); }
Source:
<code>private static void refreshPolicy(Policy policy) throws IOException { String policyString = "grant { permission java.security.AllPermission; };"; <START> File policyFile = File.createTempFile("oxy_policy", ".txt"); <END> try { try (OutputStream fos = java.nio.file.Files.newOutputStream(policyFile.toPath())) { fos.write(policyString.getBytes("UTF-8")); } System.setProperty("java.security.policy", policyFile.toURI().toURL().toString()); policy.refresh(); } finally { try { java.nio.file.Files.delete(policyFile.toPath()); } catch (IOException e) { e.printStackTrace(); } } }</code><technical_language>JGitTestUtil helpers create files a content</technical_language>

Target:
private static void refreshPolicy(Policy policy) throws IOException { String policyString = "grant { permission java.security.AllPermission; };"; File policyFile = File.createTempFile("oxy_policy", ".txt"); try (OutputStream fos = java.nio.file.Files .newOutputStream(policyFile.toPath())) { fos.write(policyString.getBytes("UTF-8")); } System.setProperty("java.security.policy", policyFile.toURI().toURL().toString()); policy.refresh(); }
Source:
<code>public ResultInterface executeQuery(int maxrows, boolean scrollable) { startTimeNanos = 0; long start = 0; Database database = session.getDatabase(); Object sync = database.isMultiThreaded() || database.getMvStore() != null ? session : database; session.waitIfExclusiveModeEnabled(); boolean callStop = true; boolean writing = !isReadOnly(); if (writing) { while (!database.beforeWriting()) { } } session.startStatementWithinTransaction(); <START> session.setCurrentCommand(this, false); <END> try { while (true) { database.checkPowerOff(); try { ResultInterface result; synchronized (sync) { result = query(maxrows); } callStop = !result.isLazy(); return result; } catch (DbException e) { start = filterConcurrentUpdate(e, start); } catch (OutOfMemoryError e) { callStop = false; database.shutdownImmediately(); throw DbException.convert(e); } catch (Throwable e) { throw DbException.convert(e); } } } catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { callStop = false; database.shutdownImmediately(); throw e; } database.checkPowerOff(); throw e; } finally { if (callStop) { stop(); } if (writing) { database.afterWriting(); } } }</code><technical_language>setCurrentCommand() synchronized (sync) resets fields in Session execution of command</technical_language>

Target:
public ResultInterface executeQuery(int maxrows, boolean scrollable) { startTimeNanos = 0; long start = 0; Database database = session.getDatabase(); Object sync = database.isMultiThreaded() || database.getMvStore() != null ? session : database; session.waitIfExclusiveModeEnabled(); boolean callStop = true; boolean writing = !isReadOnly(); if (writing) { while (!database.beforeWriting()) { } } synchronized (sync) { session.startStatementWithinTransaction(); session.setCurrentCommand(this, false); try { while (true) { database.checkPowerOff(); try { ResultInterface result = query(maxrows); callStop = !result.isLazy(); return result; } catch (DbException e) { start = filterConcurrentUpdate(e, start); } catch (OutOfMemoryError e) { callStop = false; database.shutdownImmediately(); throw DbException.convert(e); } catch (Throwable e) { throw DbException.convert(e); } } } catch (DbException e) { e = e.addSQL(sql); SQLException s = e.getSQLException(); database.exceptionThrown(s, sql); if (s.getErrorCode() == ErrorCode.OUT_OF_MEMORY) { callStop = false; database.shutdownImmediately(); throw e; } database.checkPowerOff(); throw e; } finally { if (callStop) { stop(); } if (writing) { database.afterWriting(); } } } }
Source:
<code>private static TupleDomain<ColumnHandle> fixedValueTupleDomain(TpchMetadata tpchMetadata, TpchColumn<?> column1, Object value1, TpchColumn<?> column2, Object value2) { requireNonNull(column1, "column1 is null"); requireNonNull(column2, "column2 is null"); requireNonNull(value1, "value1 is null"); <START> requireNonNull(value2, "value2 is null"); <END> return TupleDomain.fromFixedValues( ImmutableMap.of( tpchMetadata.toColumnHandle(column1), new NullableValue(getPrestoType(column1), value1), tpchMetadata.toColumnHandle(column2), new NullableValue(getPrestoType(column2), value2))); }</code><technical_language>required</technical_language>

Target:
private static TupleDomain<ColumnHandle> fixedValueTupleDomain(TpchMetadata tpchMetadata, TpchColumn<?> column1, Object value1, TpchColumn<?> column2, Object value2) { return TupleDomain.fromFixedValues( ImmutableMap.of( tpchMetadata.toColumnHandle(column1), new NullableValue(getPrestoType(column1), value1), tpchMetadata.toColumnHandle(column2), new NullableValue(getPrestoType(column2), value2))); }
Source:
<code>protected static boolean canAttachPrestartedVmToUser(Guid vmId) { <START> boolean returnValue = !vmAssignedToUser(vmId, new java.util.ArrayList<String>()); <END> returnValue = returnValue && vmIsRunningStateless(vmId); return returnValue; }</code><technical_language>please remove 'java.util.'</technical_language>

Target:
protected static boolean canAttachPrestartedVmToUser(Guid vmId) { return !vmAssignedToUser(vmId, new ArrayList<String>()) && vmIsRunningStateless(vmId); }
Source:
<code>private void openHelp() { final String helpWeb = (String) getText(R.string.url_help); <START> if (helpWeb != null && helpWeb.length() > 0) { <END> Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(helpWeb)); startActivity(intent); } }</code><technical_language>Do need this check</technical_language>

Target:
private void openHelp() { final String helpWeb = (String) getText(R.string.url_help); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(helpWeb)); startActivity(intent); }
Source:
<code>public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { checkValidTime(t); <START> LinkedList<HTNode> queue = new LinkedList<>(); <END> queue.add(fSht.getRootNode()); try { while (!queue.isEmpty()) { HTNode currentNode = queue.pop(); if ((currentNode.getNodeType() == HTNode.NodeType.CORE)) { queue.addAll(fSht.selectNextChildren((CoreNode) currentNode, t)); } currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } }</code><technical_language>supertype possible. Deque<HTNode> queue..</technical_language>

Target:
public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { checkValidTime(t); Deque<HTNode> queue = new LinkedList<>(); queue.add(fSht.getRootNode()); try { while (!queue.isEmpty()) { HTNode currentNode = queue.pop(); if ((currentNode.getNodeType() == HTNode.NodeType.CORE)) { queue.addAll(fSht.selectNextChildren((CoreNode) currentNode, t)); } currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } }
Source:
<code>private URI addCookieInterceptorIfRequired(URI uri) { String uriProtocol = uri.getScheme(); String uriHost = uri.getHost(); String uriPath = uri.getRawPath(); int uriPort = uri.getPort(); if ("http".equals(uriProtocol)) { uriPort = uriPort < 0 ? 80 : uriPort; } else if ("https".equals(uriProtocol)) { uriPort = uriPort < 0 ? 443 : uriPort; } else { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Protocol %s not supported", uriProtocol)); } if (uri.getUserInfo() != null && this.username == null && this.password == null) { String[] parts = uri.getUserInfo().split(":"); <START> this.username = parts[0]; <END> this.password = parts[1]; } if(this.username == null && this.password == null){ return uri; } try { String path = uriPath == null ? "" : uriPath; if(path.length() > 0) { int index = path.lastIndexOf("/"); if (index == path.length() - 1) { path = path.substring(0, index); index = path.lastIndexOf("/"); } path = path.substring(0, index); } URI baseURI = new URI(uriProtocol, null, uriHost, uriPort, path, null, null); CookieInterceptor ci = new CookieInterceptor(username, password, baseURI.toString()); requestInterceptors.add(ci); responseInterceptors.add(ci); } catch (URISyntaxException e) { throw new RuntimeException(e); } try { return new URI(uriProtocol + "://" + uriHost + ":" + uriPort + (uriPath != null ? uriPath : "")); } catch (URISyntaxException use) { throw new RuntimeException("Failed to construct URI", use); } }</code><technical_language>if (parts.length == 2) check - this throw OOB exception for a URL of format http://user@host/abc</technical_language>

Target:
private URI addCookieInterceptorIfRequired(URI uri) { String uriProtocol = uri.getScheme(); String uriHost = uri.getHost(); String uriPath = uri.getRawPath(); int uriPort = uri.getPort(); if ("http".equals(uriProtocol)) { uriPort = uriPort < 0 ? 80 : uriPort; } else if ("https".equals(uriProtocol)) { uriPort = uriPort < 0 ? 443 : uriPort; } else { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Protocol %s not supported", uriProtocol)); } if (uri.getUserInfo() != null && this.username == null && this.password == null) { String[] parts = uri.getUserInfo().split(":"); if (parts.length == 2) { this.username = parts[0]; this.password = parts[1]; } } if(this.username == null && this.password == null){ return uri; } try { String path = uriPath == null ? "" : uriPath; if(path.length() > 0) { int index = path.lastIndexOf("/"); if (index == path.length() - 1) { path = path.substring(0, index); index = path.lastIndexOf("/"); } path = path.substring(0, index); } URI baseURI = new URI(uriProtocol, null, uriHost, uriPort, path, null, null); CookieInterceptor ci = new CookieInterceptor(username, password, baseURI.toString()); requestInterceptors.add(ci); responseInterceptors.add(ci); } catch (URISyntaxException e) { throw new RuntimeException(e); } try { return new URI(uriProtocol + "://" + uriHost + ":" + uriPort + (uriPath != null ? uriPath : "")); } catch (URISyntaxException use) { throw new RuntimeException("Failed to construct URI", use); } }
Source:
<code>public void testHetSensTargeted(final double expected, final File metricsFile) throws Exception { final double tolerance = 0.000_000_01; final MetricsFile Metrics = new MetricsFile(); <START> Metrics.read(new FileReader(metricsFile)); <END> final List<Histogram<Integer>> histograms = Metrics.getAllHistograms(); final Histogram<Integer> depthHistogram = histograms.get(0); final Histogram<Integer> qualityHistogram = histograms.get(1); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final int sampleSize = 1_000; final double logOddsThreshold = 3.0; final double result = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, logOddsThreshold); Assert.assertEquals(result, expected, tolerance); }</code><technical_language>code...(perhaps...) try-with-resources</technical_language>

Target:
public void testHetSensTargeted(final double expected, final File metricsFile) throws Exception { final double tolerance = 0.000_000_01; final MetricsFile metrics = new MetricsFile(); try (final FileReader metricsFileReader = new FileReader(metricsFile)) { metrics.read(metricsFileReader); } final List<Histogram<Integer>> histograms = metrics.getAllHistograms(); final Histogram<Integer> depthHistogram = histograms.get(0); final Histogram<Integer> qualityHistogram = histograms.get(1); final double[] depthDistribution = TheoreticalSensitivity.normalizeHistogram(depthHistogram); final double[] qualityDistribution = TheoreticalSensitivity.normalizeHistogram(qualityHistogram); final int sampleSize = 1_000; final double logOddsThreshold = 3.0; final double result = TheoreticalSensitivity.hetSNPSensitivity(depthDistribution, qualityDistribution, sampleSize, logOddsThreshold); Assert.assertEquals(result, expected, tolerance); }
Source:
<code>private void handleErrors() throws StageException { <START> for (ServerException e : serverErrors) { <END> throw new StageException(Errors.MYSQL_006, e.getMessage(), e); } }</code><technical_language>loop? throw exception stop looping, throw more exception this method</technical_language>

Target:
private void handleErrors() throws StageException { for (ServerException e : serverErrors) { LOG.error("BinaryLogClient server error: {}", e.getMessage(), e); } ServerException e = serverErrors.poll(); if (e != null) { throw new StageException(Errors.MYSQL_006, e.getMessage(), e); } }
Source:
<code>TestTemplateInvocationTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod, TestTemplateInvocationContext invocationContext, int index, JupiterConfiguration configuration) { super(uniqueId, invocationContext.getDisplayName(index), testClass, templateMethod, configuration, <START> INTERCEPTOR_CALL); <END> this.invocationContext = invocationContext; this.index = index; }</code><technical_language>suggestion interceptorCall);</technical_language>

Target:
TestTemplateInvocationTestDescriptor(UniqueId uniqueId, Class<?> testClass, Method templateMethod, TestTemplateInvocationContext invocationContext, int index, JupiterConfiguration configuration) { super(uniqueId, invocationContext.getDisplayName(index), testClass, templateMethod, configuration, interceptorCall); this.invocationContext = invocationContext; this.index = index; }
Source:
<code>public JSONObject listProjectsDataTable(HttpSession session, JSONObject json) { try { final JSONObject j = new JSONObject(); final JSONArray jsonArray = new JSONArray(); for (Project project : requestManager.listAllProjects()) { JSONArray inner = new JSONArray(); inner.add(TableHelper.hyperLinkify("/miso/project" + project.getId(), project.getName())); <START> inner.add(TableHelper.hyperLinkify("/miso/project" + project.getId(), project.getAlias())); <END> inner.add(project.getDescription()); inner.add(project.getProgress().getKey()); inner.add(project.getProjectId()); jsonArray.add(inner); } j.put("projectsArray", jsonArray); return j; } catch (final IOException e) { log.debug("Failed", e); return JSONUtils.SimpleJSONError("Failed: " + e.getMessage()); } }</code><technical_language>Missing slash - "/miso/project/" lines</technical_language>

Target:
public JSONObject listProjectsDataTable(HttpSession session, JSONObject json) { try { final JSONObject j = new JSONObject(); final JSONArray jsonArray = new JSONArray(); for (Project project : requestManager.listAllProjects()) { JSONArray inner = new JSONArray(); inner.add(TableHelper.hyperLinkify("/miso/project/" + project.getId(), project.getName())); inner.add(TableHelper.hyperLinkify("/miso/project/" + project.getId(), project.getAlias())); inner.add(project.getDescription()); inner.add(project.getProgress().getKey()); inner.add(project.getProjectId()); jsonArray.add(inner); } j.put("projectsArray", jsonArray); return j; } catch (final IOException e) { log.debug("Failed", e); return JSONUtils.SimpleJSONError("Failed: " + e.getMessage()); } }
Source:
<code>private String getRemoteBranch() { if (params.branch == null) { return GitCloneTemplateParams.DEFAULT_BRANCH; } <START> if (params.branch.indexOf('/') == -1) { <END> return "origin/" + params.branch; } return params.branch; }</code><technical_language>This is right. Branches / in them. local "clone" determines calls remote repo, I suspect jgit is origin. test needs if (!params.branch.startsWith("origin/")</technical_language>

Target:
private String getRemoteBranch() { if (params.branch == null) { return GitCloneTemplateParams.DEFAULT_BRANCH; } if (!params.branch.startsWith("origin/")) { return "origin/" + params.branch; } return params.branch; }
Source:
<code>private static List<DatasetStatus> datasetStatusListHelper(final SQLiteStatement statement, final SQLiteConnection connection) throws CatalogException { try { ImmutableList.Builder<DatasetStatus> result = ImmutableList.builder(); while (statement.step()) { RelationKey relationKey = RelationKey.of(statement.columnString(0), statement.columnString(1), statement.columnString(2)); long numTuples = statement.columnLong(3); long queryId = statement.columnLong(4); String created = statement.columnString(5); PartitionFunction howPartitioned; try { howPartitioned = MyriaJsonMapperProvider.getMapper().readValue(statement.columnString(6), PartitionFunction.class); } catch (final IOException e) { <START> LOGGER.debug("Error deserializing howPartitioned for dataset #{}", relationKey.toString(), e); <END> howPartitioned = new UnknownPartitionFunction(null); } result.add(new DatasetStatus(relationKey, getDatasetSchema(connection, relationKey), numTuples, queryId, created, howPartitioned)); } statement.dispose(); return result.build(); } catch (final SQLiteException e) { throw new CatalogException(e); } }</code><technical_language>toString() is unnecessary; adds work raises overhead debug is enabled</technical_language>

Target:
private static List<DatasetStatus> datasetStatusListHelper(final SQLiteStatement statement, final SQLiteConnection connection) throws CatalogException { try { ImmutableList.Builder<DatasetStatus> result = ImmutableList.builder(); while (statement.step()) { RelationKey relationKey = RelationKey.of(statement.columnString(0), statement.columnString(1), statement.columnString(2)); long numTuples = statement.columnLong(3); long queryId = statement.columnLong(4); String created = statement.columnString(5); HowPartitioned howPartitioned; try { howPartitioned = MyriaJsonMapperProvider.getMapper().readValue(statement.columnString(6), HowPartitioned.class); } catch (final IOException e) { LOGGER.debug("Error deserializing howPartitioned for dataset #{}", relationKey, e); howPartitioned = new HowPartitioned(null, null); } result.add(new DatasetStatus(relationKey, getDatasetSchema(connection, relationKey), numTuples, queryId, created, howPartitioned)); } statement.dispose(); return result.build(); } catch (final SQLiteException e) { throw new CatalogException(e); } }
Source:
<code>public void before_shouldCallHandlerOnSaveMethodNameWithCollectionArgument() throws Throwable { Method m = WithAppropriatelyNamedMethod.class.getMethod("saveSomeOpenmrsDatas", List.class); List<SomeOpenmrsData> openmrsObjects = Arrays.asList(new SomeOpenmrsData(), new SomeOpenmrsData()); requiredDataAdvice.before(m, new Object[] { openmrsObjects }, new WithAppropriatelyNamedMethod()); <START> verify(saveHandler, times(2)).handle(Matchers.<SomeOpenmrsData> anyObject(), Matchers.anyObject(), <END> Matchers.anyObject(), anyString()); }</code><technical_language>I thought get rid of SomeOpenmrsData in "Matchers.<SomeOpenmrsData> anyObject()"</technical_language>

Target:
public void before_shouldCallHandlerOnSaveMethodNameWithCollectionArgument() throws Throwable { Method m = WithAppropriatelyNamedMethod.class.getMethod("saveSomeOpenmrsDatas", List.class); List<SomeOpenmrsData> openmrsObjects = Arrays.asList(new SomeOpenmrsData(), new SomeOpenmrsData()); requiredDataAdvice.before(m, new Object[] { openmrsObjects }, new WithAppropriatelyNamedMethod()); verify(saveHandler, times(2)).handle(Matchers.anyObject(), Matchers.anyObject(), Matchers.anyObject(), anyString()); }
Source:
<code>public RedisRunner randomDir() { this.randomDir = true; options.remove(REDIS_OPTIONS.DIR); makeRandomDefaultDir(); <START> addConfigOption(REDIS_OPTIONS.DIR, defaultDir); <END> return this; }</code><technical_language>do need change it</technical_language>

Target:
public RedisRunner randomDir() { this.randomDir = true; options.remove(REDIS_OPTIONS.DIR); makeRandomDefaultDir(); addConfigOption(REDIS_OPTIONS.DIR, "\"" + defaultDir + "\""); return this; }
Source:
<code>public Result createSession(HttpClient client, Command command) throws IOException { Capabilities desired = (Capabilities) command.getParameters().get("desiredCapabilities"); desired = desired == null ? new DesiredCapabilities() : desired; Capabilities required = (Capabilities) command.getParameters().get("requiredCapabilities"); required = required == null ? new DesiredCapabilities() : required; String des = new BeanToJsonConverter().convert(desired); String req = new BeanToJsonConverter().convert(required); StringBuilder parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append(","); amendOssParamters(parameters, des, req); parameters.append("}"); Optional<Result> result = createSession(client, parameters); <START> if (!result.isPresent()) { <END> parameters = new StringBuilder("{"); amendOssParamters(parameters, des, req); parameters.append("}"); result = createSession(client, parameters); } if (!result.isPresent()) { parameters = new StringBuilder("{"); amendW3CParameters(parameters, des, req); parameters.append("}"); result = createSession(client, parameters); } if (result.isPresent()) { Result toReturn = result.get(); return toReturn; } throw new SessionNotCreatedException( String.format( "Unable to create new remote session. " + "desired capabilities = %s, required capabilities = %s", desired, required)); }</code><technical_language>this chained _orElseGet.orElseGet.orElseThrow_</technical_language>

Target:
public Result createSession(HttpClient client, Command command) throws IOException, WebDriverException { Capabilities desired = ofNullable((Capabilities) command.getParameters().get("desiredCapabilities")) .orElseGet(DesiredCapabilities::new); Capabilities required = ofNullable((Capabilities) command.getParameters().get("requiredCapabilities")) .orElseGet(DesiredCapabilities::new); JsonParser parser = new JsonParser(); JsonElement des = parser.parse(new BeanToJsonConverter().convert(desired)); JsonElement req = parser.parse(new BeanToJsonConverter().convert(required)); JsonObject jsonObject = new JsonObject(); amendW3CParameters(jsonObject, des, req); amendOssParamters(jsonObject, des, req); Optional<Result> result = createSession(client, jsonObject); return ofNullable(result.orElseGet(() -> { JsonObject jsonObject1 = new JsonObject(); amendOssParamters(jsonObject1, des, req); try { return createSession(client, jsonObject1).orElseGet(() -> { JsonObject jsonObject2 = new JsonObject(); amendW3CParameters(jsonObject2, des, req); try { return createSession(client, jsonObject2).orElse(null); } catch (IOException e) { throw new WebDriverException(e); } }); } catch (IOException e) { throw new WebDriverException(e); } })).orElseThrow(() -> new SessionNotCreatedException( String.format( "Unable to create new remote session. " + "desired capabilities = %s, required capabilities = %s", desired, required))); }
Source:
<code>public static void onRequestPermissionsResult(Activity activity, AirMapInterface airMapInterface, int requestCode, <START> String[] permissions, int[] grantResults) { <END> switch (requestCode) { case LOCATION_PERMISSION_REQUEST_CODE: if (!isRequestedPermission(permissions)) { break; } if (verifyPermissions(grantResults)) { airMapInterface.onLocationPermissionsGranted(); } else if (!shouldShowRequestPermissionRationale(activity, LOCATION_PERMISSIONS)) { airMapInterface.onLocationPermissionsNeverAskAgain(); } else { airMapInterface.onLocationPermissionsDenied(); } break; default: break; } }</code><technical_language>revert formatting change</technical_language>

Target:
static void onRequestPermissionsResult(Activity activity, AirMapInterface airMapInterface, int requestCode, String[] permissions, int[] grantResults) { switch (requestCode) { case LOCATION_PERMISSION_REQUEST_CODE: if (!isRequestedPermission(permissions)) { break; } if (verifyPermissions(grantResults)) { airMapInterface.onLocationPermissionsGranted(); } else if (!shouldShowRequestPermissionRationale(activity, LOCATION_PERMISSIONS)) { airMapInterface.onLocationPermissionsNeverAskAgain(); } else { airMapInterface.onLocationPermissionsDenied(); } break; default: break; } }
Source:
<code><START> public PodTemplate(PodTemplate from) throws IOException { <END> this.setAnnotations(from.getAnnotations()); this.setContainers(from.getContainers()); this.setImagePullSecrets(from.getImagePullSecrets()); this.setInstanceCap(from.getInstanceCap()); this.setLabel(from.getLabel()); this.setName(from.getName()); this.setNamespace(from.getNamespace()); this.setInheritFrom(from.getInheritFrom()); this.setNodeSelector(from.getNodeSelector()); this.setNodeUsageMode(from.getNodeUsageMode()); this.setServiceAccount(from.getServiceAccount()); this.setSlaveConnectTimeout(from.getSlaveConnectTimeout()); this.setActiveDeadlineSeconds(from.getActiveDeadlineSeconds()); this.setVolumes(from.getVolumes()); this.setWorkspaceVolume(from.getWorkspaceVolume()); this.setYaml(from.getYaml()); this.setNodeProperties(from.getNodeProperties()); }</code><technical_language>throw IOException</technical_language>

Target:
public PodTemplate(PodTemplate from) { this.setAnnotations(from.getAnnotations()); this.setContainers(from.getContainers()); this.setImagePullSecrets(from.getImagePullSecrets()); this.setInstanceCap(from.getInstanceCap()); this.setLabel(from.getLabel()); this.setName(from.getName()); this.setNamespace(from.getNamespace()); this.setInheritFrom(from.getInheritFrom()); this.setNodeSelector(from.getNodeSelector()); this.setNodeUsageMode(from.getNodeUsageMode()); this.setServiceAccount(from.getServiceAccount()); this.setSlaveConnectTimeout(from.getSlaveConnectTimeout()); this.setActiveDeadlineSeconds(from.getActiveDeadlineSeconds()); this.setVolumes(from.getVolumes()); this.setWorkspaceVolume(from.getWorkspaceVolume()); this.setYaml(from.getYaml()); this.setNodeProperties(from.getNodeProperties()); }
Source:
<code>private void distributeDbDownEvent() { firstMatchSimpleFilter.clearFilterEntries(); firstMatchSimpleFilter.addFilterEntries( <START> FirstMatchSimpleFilter.parse(prop.getProperty(NotificationProperties.FILTER)) <END> ); if (failedQueries == 0) { try { firstMatchSimpleFilter.processEvent(eventsManager.createDBDownEvent()); } catch (Exception e) { log.error( String.format("Failed to dispatch %s event", EventsManager.DATABASE_UNREACHABLE), e); } } int failedQueriesNotificationThreshold = prop.getInteger(NotificationProperties.FAILED_QUERIES_NOTIFICATION_THRESHOLD); if (failedQueriesNotificationThreshold == 0) { failedQueriesNotificationThreshold = 1; } failedQueries = (failedQueries + 1) % failedQueriesNotificationThreshold; }</code><technical_language>nede re-parse, parser result always</technical_language>

Target:
private void distributeDbDownEvent() { firstMatchSimpleFilter.clearFilterEntries(); firstMatchSimpleFilter.addFilterEntries( configurationFilters ); if (failedQueries == 0) { try { firstMatchSimpleFilter.processEvent(eventsManager.createDBDownEvent()); } catch (Exception e) { log.error( String.format("Failed to dispatch %s event", EventsManager.DATABASE_UNREACHABLE), e); } } int failedQueriesNotificationThreshold = prop.getInteger(NotificationProperties.FAILED_QUERIES_NOTIFICATION_THRESHOLD); if (failedQueriesNotificationThreshold == 0) { failedQueriesNotificationThreshold = 1; } failedQueries = (failedQueries + 1) % failedQueriesNotificationThreshold; }
Source:
<code>public IndexDescProto getIndexByName(String databaseName, final String indexName) throws UndefinedDatabaseException, UndefinedIndexException { ResultSet res = null; IndexDescProto proto = null; String sql = GET_INDEXES_SQL + " WHERE " + COL_DATABASES_PK + "=? AND INDEX_NAME=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } <START> try (Connection conn = getConnection(); <END> PreparedStatement pstmt = conn.prepareStatement(sql)) { int databaseId = getDatabaseId(databaseName); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedIndexException(indexName); } IndexDescProto.Builder builder = IndexDescProto.newBuilder(); String tableName = getTableName(conn, res.getInt(COL_TABLES_PK)); builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); resultToIndexDescProtoBuilder(CatalogUtil.buildFQName(databaseName, tableName), builder, res); try { builder.setTargetRelationSchema(getTable(databaseName, tableName).getSchema()); } catch (UndefinedTableException e) { throw new TajoInternalError( "Inconsistent table and index information: table " + tableName + " does not exists."); } proto = builder.build(); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(res); } return proto; }</code><technical_language>do close connection here</technical_language>

Target:
public IndexDescProto getIndexByName(String databaseName, final String indexName) throws UndefinedDatabaseException, UndefinedIndexException { Connection conn = null; ResultSet res = null; PreparedStatement pstmt = null; IndexDescProto proto = null; try { int databaseId = getDatabaseId(databaseName); String sql = GET_INDEXES_SQL + " WHERE " + COL_DATABASES_PK + "=? AND INDEX_NAME=?"; if (LOG.isDebugEnabled()) { LOG.debug(sql); } conn = getConnection(); pstmt = conn.prepareStatement(sql); pstmt.setInt(1, databaseId); pstmt.setString(2, indexName); res = pstmt.executeQuery(); if (!res.next()) { throw new UndefinedIndexException(indexName); } IndexDescProto.Builder builder = IndexDescProto.newBuilder(); String tableName = getTableName(conn, res.getInt(COL_TABLES_PK)); builder.setTableIdentifier(CatalogUtil.buildTableIdentifier(databaseName, tableName)); resultToIndexDescProtoBuilder(CatalogUtil.buildFQName(databaseName, tableName), builder, res); try { builder.setTargetRelationSchema(getTable(databaseName, tableName).getSchema()); } catch (UndefinedTableException e) { throw new TajoInternalError( "Inconsistent table and index information: table " + tableName + " does not exists."); } proto = builder.build(); } catch (SQLException se) { throw new TajoInternalError(se); } finally { CatalogUtil.closeQuietly(pstmt, res); } return proto; }
Source:
<code>private FormDef loadFormFromFile(File formXmlFile) { FileInputStream fis; Log.i(TAG, "Attempting to load from: " + formXmlFile.getAbsolutePath()); try { fis = new FileInputStream(formXmlFile); } catch (FileNotFoundException e) { throw new RuntimeException("Error reading XForm file"); } XFormParser.registerHandler("intent", new IntentExtensionParser()); <START> XFormParser.registerActionHandler("pollsensor", new PollSensorExtensionParser()); <END> FormDef fd = XFormExtensionUtils.getFormFromInputStream(fis); if (fd == null) { throw new RuntimeException("Error reading XForm file"); } return fd; }</code><technical_language>"pollsensor" -> PollSensorAction.ELEMENT_NAME</technical_language>

Target:
private FormDef loadFormFromFile(File formXmlFile) { FileInputStream fis; Log.i(TAG, "Attempting to load from: " + formXmlFile.getAbsolutePath()); try { fis = new FileInputStream(formXmlFile); } catch (FileNotFoundException e) { throw new RuntimeException("Error reading XForm file"); } XFormParser.registerHandler("intent", new IntentExtensionParser()); XFormParser.registerActionHandler(PollSensorAction.ELEMENT_NAME, new PollSensorExtensionParser()); FormDef fd = XFormExtensionUtils.getFormFromInputStream(fis); if (fd == null) { throw new RuntimeException("Error reading XForm file"); } return fd; }