auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static String convertStorageExceptionMessage(String message, HttpResponse response) { if (response != null) { if (response.getStatusCode() == 403) { <START> return String.format("If you are using a StorageSharedKeyCredential, and the server returned an " <END> + "error message that says 'Signature did not match', you can compare the string to sign with" + " the one generated by the SDK. To log the string to sign, pass in the context key value pair " + "'%s': true to the appropriate method call.%n" + "If you are using a SAS token, and the server returned an error message that says " + "'Signature did not match', you can compare the string to sign with" + " the one generated by the SDK. To log the string to sign, pass in the context key value " + "pair '%s': true to the appropriate generateSas method call.%n" + "Please remember to disable '%s' before going to production as this string can potentially " + "contain PII.%n", Constants.STORAGE_LOG_STRING_TO_SIGN, Constants.STORAGE_LOG_STRING_TO_SIGN, Constants.STORAGE_LOG_STRING_TO_SIGN) + message; } if (response.getRequest() != null && response.getRequest().getHttpMethod() != null && response.getRequest().getHttpMethod().equals(HttpMethod.HEAD) && response.getHeaders().getValue(ERROR_CODE) != null) { return message.replaceFirst("(empty body)", response.getHeaders().getValue(ERROR_CODE)); } } return message; }</code><technical_language>this base message a constant parameters for formatting constant, need additional calls String.format wait for this optimized JIT</technical_language>

Target:
public static String convertStorageExceptionMessage(String message, HttpResponse response) { if (response != null) { if (response.getStatusCode() == 403) { return STORAGE_EXCEPTION_LOG_STRING_TO_SIGN_MESSAGE + message; } if (response.getRequest() != null && response.getRequest().getHttpMethod() != null && response.getRequest().getHttpMethod().equals(HttpMethod.HEAD) && response.getHeaders().getValue(ERROR_CODE) != null) { return message.replaceFirst("(empty body)", response.getHeaders().getValue(ERROR_CODE)); } } return message; }
Source:
<code>private void assertExpiredEvents(int count) { <START> eventually("Last count was :" + listener.getInvocationCount(), () -> count == listener.getInvocationCount()); <END> listener.getEvents().forEach(event -> { assertEquals(Event.Type.CACHE_ENTRY_EXPIRED, event.getType()); assertEquals(cache, event.getCache()); assertFalse(event.isPre()); assertNotNull(event.getKey()); assertNotNull(event.getValue()); assertNotNull(event.getMetadata()); }); }</code><technical_language>eventuallyEquals for this</technical_language>

Target:
private void assertExpiredEvents(int count) { eventuallyEquals(count, () -> listener.getInvocationCount()); listener.getEvents().forEach(event -> { assertEquals(Event.Type.CACHE_ENTRY_EXPIRED, event.getType()); assertEquals(cache, event.getCache()); assertFalse(event.isPre()); assertNotNull(event.getKey()); assertNotNull(event.getValue()); assertNotNull(event.getMetadata()); }); }
Source:
<code>private void rectifyCreatedTime(WorkspaceActivity activity) throws ServerException { if (activity.getCreated() == null) { <START> try { <END> Workspace workspace = workspaceManager.getWorkspace(activity.getWorkspaceId()); long createdTime = Long.parseLong(workspace.getAttributes().get(Constants.CREATED_ATTRIBUTE_NAME)); LOG.warn( "Workspace doesn't have any information about when it was created or last seen" + " starting. Setting the created time to {}.", activity.getWorkspaceId(), createdTime); activityDao.setCreatedTime(activity.getWorkspaceId(), createdTime); activity.setCreated(createdTime); } catch (NumberFormatException e) { LOG.error( "Failed to read the created time of the workspace from its attributes.", activity.getWorkspaceId(), e); } catch (NotFoundException e) { LOG.error( "Detected a running workspace but could not find" + " its record.", activity.getWorkspaceId(), e); } } }</code><technical_language>reduce nesting level rewriting in way: java private void rectifyCreatedTime(WorkspaceActivity activity) throws ServerException { if (activity.getCreated() != null) { // activity created time return; } try { Workspace workspace = workspaceManager.getWorkspace(activity.getWorkspaceId()); long createdTime = .... } }</technical_language>

Target:
private void rectifyCreatedTime(WorkspaceActivity activity) throws ServerException { if (activity.getCreated() != null) { return; } try { Workspace workspace = workspaceManager.getWorkspace(activity.getWorkspaceId()); long createdTime; try { createdTime = Long.parseLong(workspace.getAttributes().get(Constants.CREATED_ATTRIBUTE_NAME)); LOG.warn( "Workspace '{}' doesn't have any information about when it was created or last seen" + " starting. Setting the created time to {}.", activity.getWorkspaceId(), createdTime); } catch (NumberFormatException e) { Long oldestActivityTime = getOldestActivityTime(activity); if (oldestActivityTime == null) { long now = clock.millis(); LOG.error( "Failed to read the created time of the workspace '{}' from its attributes. Using" + " the current time ({}) for it because no other activity was ever recorded on" + " the workspace.", activity.getWorkspaceId(), now, e); createdTime = now; } else { LOG.error( "Failed to read the created time of the workspace '{}' from its attributes. Using" + " the oldest activity time found on it ({}) as its created time.", activity.getWorkspaceId(), oldestActivityTime, e); createdTime = oldestActivityTime; } } activityDao.setCreatedTime(activity.getWorkspaceId(), createdTime); activity.setCreated(createdTime); } catch (NotFoundException e) { LOG.error( "Detected a running workspace '{}' but could not find" + " its record.", activity.getWorkspaceId(), e); } }
Source:
<code>public static List<String> getAllPaths(InputStream in) throws IOException { Assert.notNull(in); List<String> paths = new ArrayList<String>(); TarArchiveInputStream archiveIn = new TarArchiveInputStream(new GZIPInputStream(in)); try { <START> for (ArchiveEntry nextEntry; (nextEntry = archiveIn.getNextEntry()) != null;) { <END> paths.add(nextEntry.getName()); } return paths; } finally { StreamUtils.close(archiveIn); } }</code><technical_language>please dont remove explicit initialization</technical_language>

Target:
public static List<String> getAllPaths(InputStream in) throws IOException { Assert.notNull(in); List<String> paths = new ArrayList<String>(); TarArchiveInputStream archiveIn = new TarArchiveInputStream(new GZIPInputStream(in)); try { for (ArchiveEntry nextEntry = null; (nextEntry = archiveIn.getNextEntry()) != null;) { paths.add(nextEntry.getName()); } return paths; } finally { StreamUtils.close(archiveIn); } }
Source:
<code><START> private List<ConstrainedTerm> fastComputeRewriteStep(ConstrainedTerm subject, boolean computeOne) { <END> List<ConstrainedTerm> results = new ArrayList<>(); List<Pair<Substitution<Variable, Term>, Integer>> matches = theFastMatcher.mainMatch(subject.term(), definition.automaton.leftHandSide(), allRuleBits); for (Pair<Substitution<Variable, Term>, Integer> pair : matches) { Rule rule = definition.ruleTable.get(pair.getRight()); Substitution<Variable, Term> substitution = RewriteEngineUtils.evaluateConditions(rule, pair.getLeft(), subject.termContext()); if (substitution != null) { Map<scala.collection.immutable.List<Integer>, Term> rewrites = theFastMatcher.getRewrites()[pair.getRight()]; List<Pair<scala.collection.immutable.List<Integer>, Term>> cleanedUpRewrites = rewrites.entrySet().stream().map(e -> Pair.of(e.getKey().reverse(), e.getValue())).collect(Collectors.toList()); Term theNew; if (cleanedUpRewrites.size() == 1) theNew = buildRHS(subject.term(), substitution, cleanedUpRewrites.get(0).getLeft(), cleanedUpRewrites.get(0).getRight(), subject.termContext()); else theNew = buildRHS((KItem) subject.term(), substitution, cleanedUpRewrites, subject.termContext()); results.add(new ConstrainedTerm(theNew, subject.termContext())); if (computeOne) { break; } } } return results; }</code><technical_language>new code added SymbolicRewriter straightforward; try spend some more time polish it</technical_language>

Target:
private List<ConstrainedTerm> fastComputeRewriteStep(ConstrainedTerm subject, boolean computeOne) { List<ConstrainedTerm> results = new ArrayList<>(); List<Pair<Substitution<Variable, Term>, Integer>> matches = theFastMatcher.mainMatch(subject.term(), definition.automaton.leftHandSide(), allRuleBits); for (Pair<Substitution<Variable, Term>, Integer> pair : matches) { Rule rule = definition.ruleTable.get(pair.getRight()); Substitution<Variable, Term> substitution = RewriteEngineUtils.evaluateConditions(rule, pair.getLeft(), subject.termContext()); if (substitution != null) { Map<scala.collection.immutable.List<Integer>, Term> rewrites = theFastMatcher.getRewrites()[pair.getRight()]; assert (rewrites.size() > 0); Term theNew; if (rewrites.size() == 1) theNew = buildRHS(subject.term(), substitution, rewrites.keySet().iterator().next(), rewrites.values().iterator().next(), subject.termContext()); else theNew = buildRHS(subject.term(), substitution, rewrites.entrySet().stream().map(e -> Pair.of(e.getKey(), e.getValue())).collect(Collectors.toList()), subject.termContext()); results.add(new ConstrainedTerm(theNew, subject.termContext())); if (computeOne) { break; } } } return results; }
Source:
<code>public void theGetFirmwareVersionRequestIsReceived(final Map<String, String> requestData) throws Throwable { final Map<String, String> settings = new HashMap<>(); settings.put(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION, requestData.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION)); <START> final GetFirmwareVersionRequest getFirmwareVersionRequest = GetFirmwareVersionRequestFactory <END> .fromParameterMap(settings); final GetFirmwareVersionAsyncResponse getFirmwareVersionAsyncResponse = this.smartMeteringConfigurationClient .getFirmwareVersion(getFirmwareVersionRequest); LOGGER.info("Get firmware version asyncResponse is received {}", getFirmwareVersionAsyncResponse); assertNotNull("Get firmware version asyncResponse should not be null", getFirmwareVersionAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, getFirmwareVersionAsyncResponse.getCorrelationUid()); }</code><technical_language>requestData instead of settings</technical_language>

Target:
public void theGetFirmwareVersionRequestIsReceived(final Map<String, String> requestData) throws Throwable { final GetFirmwareVersionRequest getFirmwareVersionRequest = GetFirmwareVersionRequestFactory .fromParameterMap(requestData); final GetFirmwareVersionAsyncResponse getFirmwareVersionAsyncResponse = this.smartMeteringConfigurationClient .getFirmwareVersion(getFirmwareVersionRequest); assertNotNull("Get firmware version asyncResponse should not be null", getFirmwareVersionAsyncResponse); LOGGER.info("Get firmware version asyncResponse is received {}", getFirmwareVersionAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, getFirmwareVersionAsyncResponse.getCorrelationUid()); }
Source:
<code>public boolean isFocusControl () { checkWidget(); <START> if ((text != null && text.isFocusControl ()) || (arrow != null && arrow.isFocusControl ()) || (list != null && list.isFocusControl ()) || (popup != null && popup.isFocusControl ())) { <END> return true; } return super.isFocusControl (); }</code><technical_language>This is a bit of a nasty if-statement. add a boolean "notNull": boolean notNull = text != null || arrow != null || ...; add notNull variable if-statement</technical_language>

Target:
public boolean isFocusControl () { checkWidget(); boolean notNull = (text != null || arrow != null || list != null || popup != null); if (notNull && (text.isFocusControl () || arrow.isFocusControl () || list.isFocusControl () || popup.isFocusControl ())) { return true; } return super.isFocusControl (); }
Source:
<code>public <START> boolean setBranchSameAsAccess(boolean <END> branchSameAsAccess) { return this.branchSameAsAccess = branchSameAsAccess; }</code><technical_language>Other setters in this class void</technical_language>

Target:
public void setBranchSameAsAccess(boolean branchSameAsAccess) { this.branchSameAsAccess = branchSameAsAccess; }
Source:
<code>public boolean isRebootCommandExecutionAllowed(List<VM> vms) { if (vms.isEmpty() || !VdcActionUtils.canExecute(vms, VM.class, VdcActionType.RebootVm)) { return false; } for (VM vm : vms) { Version version = vm.getVdsGroupCompatibilityVersion(); Version anyDcVersion = new Version(); <START> if (!isCommandCompatible(VdcActionType.RebootVm, version, anyDcVersion) || <END> (StringHelper.isNullOrEmpty(vm.getVmIp()) && Boolean.FALSE.equals(vm.getAcpiEnable()))) { return false; } } return true; }</code><technical_language>OK, this starts hard read - I rewrite paper get rid of negations understand is correct :) rewrite this? boolean compatibleWithCluster = isCommandCompatible(VdcActionType.RebootVm, version, anyDcVersion); boolean guestAgentPresent = !StringHelper.isNullOrEmpty(vm.getVmIp()); boolean acpiEnabled = Boolean.TRUE.equals(vm.getAcpiEnable())); return compatibleWithCluster && (guestAgentPresent || acpiEnabled);</technical_language>

Target:
public boolean isRebootCommandExecutionAllowed(List<VM> vms) { if (vms.isEmpty() || !VdcActionUtils.canExecute(vms, VM.class, VdcActionType.RebootVm)) { return false; } for (VM vm : vms) { Version version = vm.getVdsGroupCompatibilityVersion(); Version anyDcVersion = new Version(); boolean compatibleCluster = isCommandCompatible(VdcActionType.RebootVm, version, anyDcVersion); boolean guestAgentPresent = !StringHelper.isNullOrEmpty(vm.getVmIp()); boolean acpiEnabled = Boolean.FALSE.equals(vm.getAcpiEnable()); if (!(compatibleCluster && (guestAgentPresent || acpiEnabled))) { return false; } } return true; }
Source:
<code>public IBoundaryStrategy getStrategy(){ if (proxy == null) { try { <START> proxy = (IBoundaryStrategy)configElement.createExecutableExtension("class"); <END> } catch (CoreException e) { e.printStackTrace(); } } return proxy; }</code><technical_language>refactor this field longer holds a BoundaryProxy a IBoundaryStrategy</technical_language>

Target:
public IBoundaryStrategy getStrategy(){ if (strategy == null) { try { strategy = (IBoundaryStrategy)configElement.createExecutableExtension("class"); } catch (CoreException e) { e.printStackTrace(); } } return strategy; }
Source:
<code>void sendUnsub(NatsSubscription sub, int after) { <START> ByteArrayBuilder bab = new ByteArrayBuilder(OP_UNSUB_PROTOCOL_LEN + 29) <END> .append(OP_UNSUB_PROTOCOL_BYTES, OP_UNSUB_PROTOCOL_LEN) .append(sub.getSID()); if (after > 0) { bab.appendSpace().append(after); } NatsMessage unsubMsg = new NatsMessage(bab.toByteArray()); queueInternalOutgoing(unsubMsg); }</code><technical_language>This allocate correct buffer size unnecessary allocations/copying</technical_language>

Target:
void sendUnsub(NatsSubscription sub, int after) { ByteArrayBuilder bab = new ByteArrayBuilder(OP_UNSUB_SP_LEN + 29) .append(UNSUB_SP_BYTES) .append(sub.getSID()); if (after > 0) { bab.appendSpace().append(after); } NatsMessage unsubMsg = new NatsMessage(bab.toByteArray()); queueInternalOutgoing(unsubMsg); }
Source:
<code>RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if (firstParent && i > 0 && (c.flags & UNINTERESTING) == 0) <START> break; <END> if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }</code><technical_language>1. this continue? If not, if 2nd parent is uninteresting 3rd parent is, 3rd parent get added. 2. Put braces single-line "if" statements [1]. [1] <LINK_0></technical_language>

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { try { for (;;) { final RevCommit c = pending.next(); if (c == null) { return null; } final boolean produce; if ((c.flags & UNINTERESTING) != 0) produce = false; else { if (filter.requiresCommitBody()) c.parseBody(walker); produce = filter.include(walker, c); } for (int i = 0; i < c.parents.length; i++) { RevCommit p = c.parents[i]; if (firstParent && i > 0 && (c.flags & UNINTERESTING) == 0) { continue; } if ((p.flags & SEEN) != 0) continue; if ((p.flags & PARSED) == 0) p.parseHeaders(walker); p.flags |= SEEN; pending.add(p); } walker.carryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.everbodyHasFlag(UNINTERESTING)) { final RevCommit n = pending.peek(); if (n != null && n.commitTime >= last.commitTime) { overScan = OVER_SCAN; } else if (--overScan == 0) throw StopWalkException.INSTANCE; } else { overScan = OVER_SCAN; } if (canDispose) c.disposeBody(); continue; } if (produce) return last = c; else if (canDispose) c.disposeBody(); } } catch (StopWalkException swe) { pending.clear(); return null; } }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTfRegular = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); mTfLight = Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf"); <START> Log.d("OpenActivity", this.getClass().getName()); <END> }</code><technical_language>I guess is reason for this change (and import)</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTfRegular = Typeface.createFromAsset(getAssets(), "OpenSans-Regular.ttf"); mTfLight = Typeface.createFromAsset(getAssets(), "OpenSans-Light.ttf"); }
Source:
<code>public void testDeleteAction() throws Exception { String courseId = "CCAddUiTest.course1"; <START> coursesPage.getDeleteLink(courseId).click(); <END> coursesPage.waitForConfirmationModalAndClickCancel(); assertNotNull(BackDoor.getCourseAsJson(courseId)); coursesPage.getDeleteLink(courseId).click(); coursesPage.waitForConfirmationModalAndClickOk(); coursesPage.verifyHtmlMainContent("/instructorCoursesDeleteSuccessful.html"); }</code><technical_language>Need click(...) instead of .click()</technical_language>

Target:
public void testDeleteAction() throws Exception { String courseId = "CCAddUiTest.course1"; coursesPage.clickAndCancel(coursesPage.getDeleteLink(courseId)); assertNotNull(BackDoor.getCourseAsJson(courseId)); coursesPage.clickAndConfirm(coursesPage.getDeleteLink(courseId)) .verifyHtmlMainContent("/instructorCoursesDeleteSuccessful.html"); }
Source:
<code>public DynamicTableSink createDynamicTableSink(Context context) { ElasticsearchValidationUtils.validatePrimaryKey(context.getCatalogTable().getSchema()); final FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); final SinkFormat<SerializationSchema<RowData>> format = helper.discoverSinkFormat( SerializationFormatFactory.class, FORMAT_OPTION); helper.validate(); Configuration configuration = new Configuration(); context.getCatalogTable() .getOptions() .forEach(configuration::setString); Elasticsearch6Configuration config = new Elasticsearch6Configuration(configuration, context.getClassLoader()); validate(config, configuration); return new Elasticsearch6DynamicSink( format, config, <START> context.getCatalogTable().getSchema()); <END> }</code><technical_language>a tricky here. TableSchemaUtils.getPhysicalSchema(context.getCatalogTable().getSchema()) get rid of computed columns. TableSchemaUtils.getPhysicalSchema remove primary key information too. primary key in TableSchemaUtils.getPhysicalSchema here</technical_language>

Target:
public DynamicTableSink createDynamicTableSink(Context context) { TableSchema tableSchema = context.getCatalogTable().getSchema(); ElasticsearchValidationUtils.validatePrimaryKey(tableSchema); final FactoryUtil.TableFactoryHelper helper = FactoryUtil.createTableFactoryHelper(this, context); final SinkFormat<SerializationSchema<RowData>> format = helper.discoverSinkFormat( SerializationFormatFactory.class, FORMAT_OPTION); helper.validate(); Configuration configuration = new Configuration(); context.getCatalogTable() .getOptions() .forEach(configuration::setString); Elasticsearch6Configuration config = new Elasticsearch6Configuration(configuration, context.getClassLoader()); validate(config, configuration); return new Elasticsearch6DynamicSink( format, config, TableSchemaUtils.getPhysicalSchema(tableSchema)); }
Source:
<code>private LiteralSuggestion getMgrsSuggestion(String query) { List<String> matches = coordinateStringsFromQuery(query); <START> StringBuilder nameBuilder = new StringBuilder("MGRS: "); <END> matches.forEach(mgrs -> nameBuilder.append("[ ").append(mgrs).append(" ] ")); if (matches.isEmpty()) { return null; } if (matches.size() == 1) { String mgrs = matches.get(0); UsngCoordinate mgrsCoord = parseMgrsString(mgrs); BoundingBox bb = translator.toBoundingBox(mgrsCoord); return new LiteralSuggestion("LITERAL", nameBuilder.toString(), latLonFromBoundingBox(bb)); } List<LatLon> geo = matches .stream() .distinct() .map(this::parseMgrsString) .filter(Objects::nonNull) .map(translator::toLatLon) .map(d -> from(d.getLat(), d.getLon())) .collect(Collectors.toList()); return new LiteralSuggestion("LITERAL", nameBuilder.toString(), geo); }</code><technical_language>I is more performant donew StringBuilder().append("MGRS: ")</technical_language>

Target:
private LiteralSuggestion getMgrsSuggestion(String query) { final List<String> matches = getMgrsCoordinateStrings(query); if (matches.isEmpty()) { LOGGER.debug("No valid MGRS strings were found or could be inferred from query [{}]", query); return null; } final List<UsngCoordinate> mgrsCoordinates = new ArrayList<>(); final StringBuilder nameBuilder = new StringBuilder("MGRS:"); for (String match : matches) { final UsngCoordinate coordinate = parseMgrsString(match); if (coordinate == null || mgrsCoordinates.contains(coordinate)) { continue; } mgrsCoordinates.add(coordinate); nameBuilder.append(" [ ").append(coordinate.toMgrsString()).append(" ]"); } if (mgrsCoordinates.size() == 1) { final UsngCoordinate mgrsCoord = mgrsCoordinates.get(0); final BoundingBox bb = translator.toBoundingBox(mgrsCoord); return new LiteralSuggestion( LITERAL_SUGGESTION_ID, nameBuilder.toString(), latLonFromBoundingBox(bb)); } return new LiteralSuggestion( LITERAL_SUGGESTION_ID, nameBuilder.toString(), mgrsCoordinates .stream() .map(translator::toLatLon) .map(d -> new LatLon(d.getLat(), d.getLon())) .collect(Collectors.toList())); }
Source:
<code>createRecordReader(InputSplit split, TaskAttemptContext taskAttempt) throws IOException, InterruptedException { Configuration conf = taskAttempt.getConfiguration(); if (typeRef == null) { setTypeRef(conf); } Class<?> recordClass = typeRef.getRawClass(); Format fileFormat = determineFileFormat(split, conf); <START> ThriftToPig.LOG.info("XXX " + ((FileSplit)split).getPath() + " == " + fileFormat); <END> if (TBase.class.isAssignableFrom(recordClass)) { switch (fileFormat) { case LZO_BLOCK: return new LzoThriftBlockRecordReader(typeRef); case LZO_B64LINE: return new LzoThriftB64LineRecordReader(typeRef); } } if (Message.class.isAssignableFrom(recordClass)) { switch (fileFormat) { case LZO_BLOCK: return new LzoProtobufBlockRecordReader(typeRef); case LZO_B64LINE: return new LzoProtobufBlockRecordReader(typeRef); } } throw new IOException( "could not determine reader for " + ((FileSplit)split).getPath() + " with class " + recordClass.getName()); }</code><technical_language>Debug</technical_language>

Target:
createRecordReader(InputSplit split, TaskAttemptContext taskAttempt) throws IOException, InterruptedException { Configuration conf = taskAttempt.getConfiguration(); if (typeRef == null) { setTypeRef(conf); } Class<?> recordClass = typeRef.getRawClass(); Format fileFormat = determineFileFormat(split, conf); if (TBase.class.isAssignableFrom(recordClass)) { switch (fileFormat) { case LZO_BLOCK: return new LzoThriftBlockRecordReader(typeRef); case LZO_B64LINE: return new LzoThriftB64LineRecordReader(typeRef); } } if (Message.class.isAssignableFrom(recordClass)) { switch (fileFormat) { case LZO_BLOCK: return new LzoProtobufBlockRecordReader(typeRef); case LZO_B64LINE: return new LzoProtobufBlockRecordReader(typeRef); } } throw new IOException( "could not determine reader for " + ((FileSplit)split).getPath() + " with class " + recordClass.getName()); }
Source:
<code>void initializeShallowCommits() throws IOException { if (shallowCommitsInitialized) <START> throw new IllegalStateException(JGitText.get().outputHasAlreadyBeenStarted); <END> shallowCommitsInitialized = true; if (reader == null) return; for (ObjectId id : reader.getShallowCommits()) lookupCommit(id).parents = RevCommit.NO_PARENTS; }</code><technical_language>shallowCommitsAlreadyInitialized</technical_language>

Target:
void initializeShallowCommits() throws IOException { if (shallowCommitsInitialized) throw new IllegalStateException( JGitText.get().shallowCommitsAlreadyInitialized); shallowCommitsInitialized = true; if (reader == null) return; for (ObjectId id : reader.getShallowCommits()) lookupCommit(id).parents = RevCommit.NO_PARENTS; }
Source:
<code>public void stop() { observers.clear(); try { send("quit"); } catch (NodeJsDebuggerException e) { LOG.warn(e.getMessage()); } executor.shutdown(); try { if (!executor.awaitTermination(10, TimeUnit.SECONDS)) { executor.shutdownNow(); if (!executor.awaitTermination(10, TimeUnit.SECONDS)) { LOG.warn("Unable to terminate main pool."); } } } catch (InterruptedException e) { if (!executor.isShutdown()) { LOG.warn("Unable to terminate main pool."); <START> } <END> } process.destroy(); try { if (!process.waitFor(10, TimeUnit.SECONDS)) { LOG.error("Unable to terminate NodeJs."); } } catch (InterruptedException e) { if (!process.isAlive()) { LOG.error("Unable to terminate NodeJs."); } } try { processWriter.close(); } catch (IOException e) { LOG.warn("Failed to close NodeJs process output stream", e); } }</code><technical_language>Please handle InterruptedException set interrupted flag. interrupt wait 10 seconds below</technical_language>

Target:
public void stop() { boolean interrupted = false; observers.clear(); try { send("quit"); } catch (NodeJsDebuggerException e) { LOG.warn("Failed to execute 'quit' command. " + e.getMessage()); } try { processWriter.close(); } catch (IOException ignored) { } executor.shutdown(); try { if (!executor.awaitTermination(10, TimeUnit.SECONDS)) { executor.shutdownNow(); if (!executor.awaitTermination(10, TimeUnit.SECONDS)) { LOG.error("Unable to terminate pool of NodeJs debugger tasks."); } } } catch (InterruptedException e) { interrupted = true; if (!executor.isShutdown()) { LOG.error("Unable to terminate pool of NodeJs debugger tasks."); } } process.destroy(); try { if (!process.waitFor(10, TimeUnit.SECONDS)) { LOG.error("Unable to terminate NodeJs process."); } } catch (InterruptedException e) { interrupted = true; if (!process.isAlive()) { LOG.error("Unable to terminate NodeJs process."); } } if (interrupted) { Thread.currentThread().interrupt(); } }
Source:
<code>public void testGetInvalidityInfoForEmailContent_null_throwException() { AdminEmailAttributes adminEmailAttributes = new AdminEmailAttributes( subject, addressReceiverListString, groupReceiverListFileKey, null, date); <START> String errorMessage = "Did not throw the expected AssertionError for null Email Content"; <END> try { fieldValidator.getInvalidityInfoForEmailContent(adminEmailAttributes.content); signalFailureToDetectException(errorMessage); } catch (AssertionError e) { ignoreExpectedException(); } }</code><technical_language>this need a variable</technical_language>

Target:
public void testGetInvalidityInfoForEmailContent_null_throwException() { AdminEmailAttributes adminEmailAttributes = new AdminEmailAttributes( subject, addressReceiverListString, groupReceiverListFileKey, null, date); try { fieldValidator.getInvalidityInfoForEmailContent(adminEmailAttributes.content); signalFailureToDetectException("Did not throw the expected AssertionError for null Email Content"); } catch (AssertionError e) { ignoreExpectedException(); } }
Source:
<code>public static OperatorSymbol parse(String string) { <START> Operator operator = Convert.stringToOperator(string); <END> if(operator != null) return new OperatorSymbol(operator); else throw new RuntimeException(MessageFormat.format( "Cannot parse {0} into an OperatorSymbol", string)); }</code><technical_language>Add braces if else blocks maintain consistency rest of code-style :)</technical_language>

Target:
public static OperatorSymbol parse(String string) { Operator operator = Convert.stringToOperator(string); if(operator != null) { return new OperatorSymbol(operator); } else { throw new RuntimeException(MessageFormat.format( "Cannot parse {0} into an OperatorSymbol", string)); } }
Source:
<code>public ProjectileSource getShooter() { <START> if (this.projectileSource != null && this.projectileSource instanceof ProjectileSource) { <END> return (ProjectileSource) this.projectileSource; } else if (this.getThrower() != null && this.getThrower() instanceof ProjectileSource) { return (ProjectileSource) this.getThrower(); } return new UnknownProjectileSource(); }</code><technical_language>need for instanceof checks below</technical_language>

Target:
public ProjectileSource getShooter() { if (this.projectileSource != null) { return this.projectileSource; } else if (this.getThrower() != null && this.getThrower() instanceof ProjectileSource) { return (ProjectileSource) this.getThrower(); } return new UnknownProjectileSource(); }
Source:
<code><START> public long getStartTime(String partitionName) { <END> return _record.getLongField(CustomizedStateProperty.START_TIME.name(), NON_EXIST); }</code><technical_language>set start time end time map fields, this getLongField information simple fields right</technical_language>

Target:
public long getStartTime(String partitionName) { String startTime = getProperty(partitionName, CustomizedStateProperty.START_TIME); return startTime == null ? -1L : Long.parseLong(startTime); }
Source:
<code>protected void removeVmNetwork() { if (getInterfaces() != null) { <START> final MacPoolManagerStrategy macPool = getMacPoolForVm(); <END> for (VmNic iface : getInterfaces()) { macPool.freeMac(iface.getMacAddress()); } } }</code><technical_language>I define this loop, real added value</technical_language>

Target:
protected void removeVmNetwork() { if (getInterfaces() != null) { for (VmNic iface : getInterfaces()) { getMacPool().freeMac(iface.getMacAddress()); } } }
Source:
<code>public UriUploaderResultCode uploadUris() { try { List<Uri> contentUris = new ArrayList<>(); List<String> contentRemotePaths = new ArrayList<>(); int schemeFileCounter = 0; for (Parcelable sourceStream : mUrisToUpload) { Uri sourceUri = (Uri) sourceStream; if (sourceUri != null) { String displayName = UriUtils.getDisplayNameForUri(sourceUri, mActivity); if (displayName == null) { displayName = generateDiplayName(); } String remotePath = mUploadPath + displayName; if (ContentResolver.SCHEME_CONTENT.equals(sourceUri.getScheme())) { contentUris.add(sourceUri); contentRemotePaths.add(remotePath); } else if (ContentResolver.SCHEME_FILE.equals(sourceUri.getScheme())) { requestUpload(sourceUri.getPath(), remotePath); schemeFileCounter++; } } } if (!contentUris.isEmpty()) { copyThenUpload(contentUris.toArray(new Uri[contentUris.size()]), contentRemotePaths.toArray(new String[contentRemotePaths.size()])); } else if (schemeFileCounter == 0) { mCode = UriUploaderResultCode.ERROR_NO_FILE_TO_UPLOAD; } } catch (SecurityException e) { mCode = UriUploaderResultCode.ERROR_READ_PERMISSION_NOT_GRANTED; Log_OC.e(TAG, "Permissions fail", e); } catch (Exception e) { mCode = UriUploaderResultCode.ERROR_UNKNOWN; Log_OC.e(TAG, "Unexpted error", e); } finally { <START> PreferenceManager.setLastUploadPath(mUploadPath, mActivity); <END> } return mCode; }</code><technical_language>This in ReceiveExternalFilesActivity, created for entry point</technical_language>

Target:
public UriUploaderResultCode uploadUris() { try { List<Uri> contentUris = new ArrayList<>(); List<String> contentRemotePaths = new ArrayList<>(); int schemeFileCounter = 0; for (Parcelable sourceStream : mUrisToUpload) { Uri sourceUri = (Uri) sourceStream; if (sourceUri != null) { String displayName = UriUtils.getDisplayNameForUri(sourceUri, mActivity); if (displayName == null) { displayName = generateDiplayName(); } String remotePath = mUploadPath + displayName; if (ContentResolver.SCHEME_CONTENT.equals(sourceUri.getScheme())) { contentUris.add(sourceUri); contentRemotePaths.add(remotePath); } else if (ContentResolver.SCHEME_FILE.equals(sourceUri.getScheme())) { requestUpload(sourceUri.getPath(), remotePath); schemeFileCounter++; } } } if (!contentUris.isEmpty()) { copyThenUpload(contentUris.toArray(new Uri[contentUris.size()]), contentRemotePaths.toArray(new String[contentRemotePaths.size()])); } else if (schemeFileCounter == 0) { mCode = UriUploaderResultCode.ERROR_NO_FILE_TO_UPLOAD; } } catch (SecurityException e) { mCode = UriUploaderResultCode.ERROR_READ_PERMISSION_NOT_GRANTED; Log_OC.e(TAG, "Permissions fail", e); } catch (Exception e) { mCode = UriUploaderResultCode.ERROR_UNKNOWN; Log_OC.e(TAG, "Unexpected error", e); } return mCode; }
Source:
<code>public synchronized void pollAllSources() { try { final Set<Source> sources = Stream.of(connectedSources, federatedSources, catalogProviders, catalogStores) .flatMap(Collection::stream) .collect(Collectors.toSet()); LOGGER.trace("Found sources", sources.size()); final Map<SourceKey, Source> sourceKeyMap = sources .stream() .collect( Collectors.toMap( SourceKey::new, source -> source, (source, anotherSourceWithTheSameSourceKey) -> { LOGGER.warn( "Found different sources with the same SourceKey with id={}. This means that the SourcePoller might not report accurate availability for these sources in the CatalogFramework. Confirm that every source has a unique id, and try restarting.", source.getId()); return source; })); final Set<SourceKey> currentSourceKeys = sourceKeyMap.keySet(); final Set<SourceKey> sourceKeysInTheCache = cache.asMap().keySet(); final Set<SourceKey> sourceKeysToRemove = new HashSet<>(sourceKeysInTheCache); sourceKeysToRemove.removeAll(currentSourceKeys); if (CollectionUtils.isNotEmpty(sourceKeysToRemove)) { LOGGER.debug( "Found SourceKeys to remove from the cache. This is caused by when sources are destroyed or modified in a way that their SourceKey changes. Removing these from the cache now", sourceKeysToRemove.size()); sourceKeysToRemove.forEach(cache::invalidate); } Map<SourceKey, Future<SourceAvailability>> availabilityFutures = startAvailabilityChecks(sourceKeyMap); CacheResults(availabilityFutures); <START> } catch (Throwable throwable) { <END> LOGGER.warn("Scheduled polling of sources failed", throwable); } }</code><technical_language>Catch throw VirtualMachineError. If JVM is in a failed state fail. <LINK_0></technical_language>

Target:
public void pollAllSources() { try { final List<Source> sources = Stream.of(connectedSources, federatedSources, catalogProviders, catalogStores) .flatMap(Collection::stream) .collect(Collectors.toList()); LOGGER.trace("Found sources", sources.size()); final Map<SourceKey, Source> sourceKeyMap = sources .stream() .collect( Collectors.toMap( SourceKey::new, source -> source, (source, anotherSourceWithTheSameSourceKey) -> { LOGGER.warn( "Found different sources with the same SourceKey with id={}. This means that the SourcePoller might not report accurate availability for these sources in the CatalogFramework. Confirm that every source has a unique id, and try restarting.", source.getId()); return source; })); removeExtraneousSourcesFromCache(sourceKeyMap); addMissingSourcesToCache(sourceKeyMap); Map<SourceKey, Future<SourceStatus>> sourceStatusFutures = startAvailabilityChecks(sourceKeyMap); cacheResults(sourceStatusFutures); } catch (VirtualMachineError e) { throw e; } catch (Throwable throwable) { LOGGER.warn("Scheduled polling of sources failed", throwable); } }
Source:
<code><START> private static String uniqueName(final Collection<String> names, final String n) { <END> if (!names.contains(n)) { return n; } int c = 0; while (names.contains(n + "[" + c + "]")) { c++; } return n + "[" + c + "]"; }</code><technical_language>public</technical_language>

Target:
protected static String uniqueName(final Collection<String> names, final String n) { if (!names.contains(n)) { return n; } int c = 0; while (names.contains(n + "[" + c + "]")) { c++; } return n + "[" + c + "]"; }
Source:
<code>protected boolean amendDiskRequested() { if (getNewDisk().getDiskStorageType() == DiskStorageType.IMAGE) { QcowCompat qcowCompat = ((DiskImage) getNewDisk()).getQcowCompat(); DiskImage unmatchedQcowCompatDisk = getDiskImages(getOldDisk().getId()).stream() .filter(disk -> disk.isQcowFormat() && disk.getQcowCompat() <START> == qcowCompat) <END> .findFirst() .get(); return unmatchedQcowCompatDisk != null; } return false; }</code><technical_language>this "!="</technical_language>

Target:
protected boolean amendDiskRequested() { if (getNewDisk().getDiskStorageType() == DiskStorageType.IMAGE) { QcowCompat qcowCompat = ((DiskImage) getNewDisk()).getQcowCompat(); return getDiskImages(getOldDisk().getId()).stream().anyMatch(disk -> disk.isQcowFormat() && disk.getQcowCompat() != qcowCompat); } return false; }
Source:
<code>void resetPlot(boolean forceReset, boolean newPlot) { boolean fixed = getPlotPreferences().getFixed(); setupForPlotDisplayChange(newPlot); setupPlotComponents(); if (fixed && !forceReset) { PlaneAspect existingAspect = getPlotPreferences().getAspect(); <START> if ((getPlotPreferences().getXlog() && existingAspect.getXMin() > 0) <END> && (getPlotPreferences().getYlog() && existingAspect.getYMin() > 0)) { display.setAspect(existingAspect); } } addPlotToDisplay(); validateModelFunctions(); }</code><technical_language>a quick look, but, this break fixing plot for linear scales? getPlotPreferences().getXlog() false if a linear plot, call set aspect happen? setting mins 0 something</technical_language>

Target:
void resetPlot(boolean forceReset, boolean newPlot) { boolean fixed = getPlotPreferences().getFixed(); setupForPlotDisplayChange(newPlot); setupPlotComponents(); if (fixed && !forceReset) { PlaneAspect existingAspect = getPlotPreferences().getAspect(); if ((getPlotPreferences().getXlog() && existingAspect.getXMin() <= 0) || (getPlotPreferences().getYlog() && existingAspect.getYMin() <= 0)) { } else { display.setAspect(existingAspect); } } addPlotToDisplay(); validateModelFunctions(); }
Source:
<code>public void handle(Concept concept, User creator, Date dateCreated, String other) { if (concept.getNames() != null) { for (ConceptName cn : concept.getNames()) { cn.setConcept(concept); } } if (concept.getConceptSets() != null) { for (ConceptSet set : concept.getConceptSets()) { set.setConceptSet(concept); } } if (concept.getAnswers(true) != null) { for (ConceptAnswer ca : concept.getAnswers(true)) { ca.setConcept(concept); } } if (concept.getDescriptions() != null) { for (ConceptDescription cd : concept.getDescriptions()) { <START> if(cd.getLocale()==null) <END> cd.setLocale(Context.getLocale()); if(StringUtils.isEmpty(cd.getDescription())) concept.removeDescription(cd); cd.setConcept(concept); } } if (concept.getConceptMappings() != null) { for (ConceptMap map : concept.getConceptMappings()) { map.setConcept(concept); } } }</code><technical_language>convention is include curly braces if clauses</technical_language>

Target:
public void handle(Concept concept, User creator, Date dateCreated, String other) { if (concept.getNames() != null) { for (ConceptName cn : concept.getNames()) { cn.setConcept(concept); } } if (concept.getConceptSets() != null) { for (ConceptSet set : concept.getConceptSets()) { set.setConceptSet(concept); } } if (concept.getAnswers(true) != null) { for (ConceptAnswer ca : concept.getAnswers(true)) { ca.setConcept(concept); } } if (concept.getDescriptions() != null) { for (ConceptDescription cd : concept.getDescriptions()) { if(cd.getLocale()==null){ cd.setLocale(Context.getLocale()); } if(StringUtils.isBlank(cd.getDescription())){ concept.removeDescription(cd); } cd.setConcept(concept); } } if (concept.getConceptMappings() != null) { for (ConceptMap map : concept.getConceptMappings()) { map.setConcept(concept); } } }
Source:
<code>private String combineAttributes(String patientAttributeProperty, String userAttributeProperty, PERSON_TYPE personType) { <START> StringBuilder result = new StringBuilder(); <END> if (personType == null || personType == PERSON_TYPE.PERSON) { result.append(patientAttributeProperty).append(",").append(userAttributeProperty); } else if (personType == PERSON_TYPE.PATIENT) { result.append(patientAttributeProperty); } else if (personType == PERSON_TYPE.USER) { result.append(userAttributeProperty); } else { log.error(MarkerFactory.getMarker("FATAL"), "Should not be here."); } return result.toString(); }</code><technical_language>@Ankitkumar94 add final in front, signal assigned once, here</technical_language>

Target:
private String combineAttributes(String patientAttributeProperty, String userAttributeProperty, PERSON_TYPE personType) { final StringBuilder result = new StringBuilder(); if (personType == null || personType == PERSON_TYPE.PERSON) { result.append(patientAttributeProperty).append(",").append(userAttributeProperty); } else if (personType == PERSON_TYPE.PATIENT) { result.append(patientAttributeProperty); } else if (personType == PERSON_TYPE.USER) { result.append(userAttributeProperty); } else { log.error(MarkerFactory.getMarker("FATAL"), "Should not be here."); } return result.toString(); }
Source:
<code>public void testIssue244() throws Exception { class P1 class P2 { @Parameter(names = "--hello") private int test; } P1 p1 = new P1(); P2 p2 = new P2(); JCommander j = new JCommander(p1); j.addCommand("wonderful", p2); j.setAllowAbbreviatedOptions(true); j.parse("wond", "--he", "47"); <START> System.out.printf("command %s, test %d\n", j.getParsedCommand(), p2.test); <END> }</code><technical_language>assert here</technical_language>

Target:
public void testIssue244() throws Exception { class P1 class P2 { @Parameter(names = "--hello") private int test; } P1 p1 = new P1(); P2 p2 = new P2(); JCommander j = new JCommander(p1); j.addCommand("wonderful", p2); j.setAllowAbbreviatedOptions(true); j.parse("wond", "--he", "47"); Assert.assertEquals("wonderful", j.getParsedCommand()); Assert.assertEquals(47, p2.test); }
Source:
<code>static void addControls(EClass rootClass, VElement compositeToFill, Set<EStructuralFeature> features, <START> boolean segmentTooling) { <END> if (!VContainer.class.isInstance(compositeToFill) && !VView.class.isInstance(compositeToFill)) { return; } final Map<EClass, EReference> childParentReferenceMap = new HashMap<EClass, EReference>(); Helper.getReferenceMap(rootClass, childParentReferenceMap); for (final EStructuralFeature feature : features) { final VControl control = VViewFactory.eINSTANCE.createControl(); control.setName("Control " + feature.getName()); control.setReadonly(false); final List<EReference> bottomUpPath = Helper.getReferencePath(rootClass, feature.getEContainingClass(), childParentReferenceMap); final VDomainModelReference modelReference = createDmr(feature, bottomUpPath, segmentTooling); control.setDomainModelReference(modelReference); if (VContainer.class.isInstance(compositeToFill)) { ((VContainer) compositeToFill).getChildren().add(control); } else if (VView.class.isInstance(compositeToFill)) { ((VView) compositeToFill).getChildren().add(control); } } }</code><technical_language>cleaner pass a createFunction simple instead of a big if in createDMR method</technical_language>

Target:
static void addControls(EClass rootClass, VElement compositeToFill, Set<EStructuralFeature> features, boolean segmentTooling) { if (!VContainer.class.isInstance(compositeToFill) && !VView.class.isInstance(compositeToFill)) { return; } final Map<EClass, EReference> childParentReferenceMap = new HashMap<EClass, EReference>(); Helper.getReferenceMap(rootClass, childParentReferenceMap); for (final EStructuralFeature feature : features) { final VControl control = VViewFactory.eINSTANCE.createControl(); control.setName("Control " + feature.getName()); control.setReadonly(false); final List<EReference> bottomUpPath = Helper.getReferencePath(rootClass, feature.getEContainingClass(), childParentReferenceMap); final VDomainModelReference modelReference = segmentTooling ? createSegmentDmr(feature, bottomUpPath) : createLegacyDmr(feature, bottomUpPath); control.setDomainModelReference(modelReference); if (VContainer.class.isInstance(compositeToFill)) { ((VContainer) compositeToFill).getChildren().add(control); } else if (VView.class.isInstance(compositeToFill)) { ((VView) compositeToFill).getChildren().add(control); } } }
Source:
<code><START> private boolean isValidRadioField(FieldForm fieldForm, ActionRequest req){ <END> boolean isValid = true; final int EVEN_NUMBER = 2; String dataType = fieldForm.getDataType(); String values = fieldForm.getValues(); String temp = values.replaceAll("\r\n","|"); String[] tempVals = StringUtil.split(temp.trim(), "|"); if (tempVals.length % EVEN_NUMBER == 1){ SessionMessages.add(req, "error", "message.structure.missingdatavalue"); return false; } else if(dataType.equals(DataTypes.BOOL.toString())){ for(int i=1;i<tempVals.length;i+= 2){ if(!DbConnectionFactory.isDBBoolean(tempVals[i])){ String message = "message.structure.invaliddataboolean"; SessionMessages.add(req, "error", message); return false; } } } else if(dataType.equals(DataTypes.FLOAT.toString())){ try { for(int i=1;i<tempVals.length;i+= 2){ Float.parseFloat(tempVals[i]); } }catch (NumberFormatException e) { String message = "message.structure.invaliddata"; SessionMessages.add(req, "error", message); return false; } } else if(dataType.equals(DataTypes.INTEGER.toString())){ try { for(int i=1;i<tempVals.length;i+= 2) { Integer.parseInt(tempVals[i]); } }catch (NumberFormatException e) { String message = "message.structure.invaliddata"; SessionMessages.add(req, "error", message); return false; } } return isValid; }</code><technical_language>![CRITICAL](<LINK_1> 'Severity: CRITICAL') Refactor this method reduce Cognitive Complexity 17 15 allowed. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private boolean isValidRadioField(FieldForm fieldForm, ActionRequest req){ boolean isValid = true; final int EVEN_NUMBER = 2; final int ADD_NUMBER = 2; String dataType = fieldForm.getDataType(); String values = fieldForm.getValues(); String temp = values.replaceAll("\r\n","|"); String[] tempVals = StringUtil.split(temp.trim(), "|"); if (tempVals.length % EVEN_NUMBER == 1){ SessionMessages.add(req, ERROR, MISSING_DATA_VALUE_MESSAGE); isValid = false; } else if(dataType.equals(DataTypes.BOOL.toString())){ for(int i=1;i<tempVals.length;i+= ADD_NUMBER){ if(!DbConnectionFactory.isDBBoolean(tempVals[i])){ SessionMessages.add(req, ERROR, INVALIDATE_DATA_BOOLEAN_MESSAGE); isValid = false; } } } else if(dataType.equals(DataTypes.FLOAT.toString())){ try { for(int i=1;i<tempVals.length;i+= ADD_NUMBER){ Float.parseFloat(tempVals[i]); } }catch (NumberFormatException e) { SessionMessages.add(req, ERROR, INVALIDATE_DATA_MESSAGE); isValid = false; } } else if(dataType.equals(DataTypes.INTEGER.toString())){ try { for(int i=1;i<tempVals.length;i+= ADD_NUMBER) { Integer.parseInt(tempVals[i]); } }catch (NumberFormatException e) { SessionMessages.add(req, ERROR, INVALIDATE_DATA_MESSAGE); isValid = false; } } return isValid; }