auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isOrderDeterministic(boolean orderIsDeterministic) { CompiledPlan plan = getBestCostPlan(); if (plan != null) { return orderIsDeterministic && plan.isOrderDeterministic(); <START> } else { <END> return orderIsDeterministic; } }</code><technical_language>BTW this style is considered unnecessary else is a compiler error/warning in eclipse I other java compilers</technical_language>

Target:
public boolean isOrderDeterministic(boolean orderIsDeterministic) { CompiledPlan plan = getBestCostPlan(); if (plan != null) { return orderIsDeterministic && plan.isOrderDeterministic(); } return orderIsDeterministic; }
Source:
<code>public void testMultilineSupport() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(RegexpMultilineCheck.class); checkConfig.addAttribute("format", "abc.*def"); checkConfig.addAttribute("matchAcrossLines", "true"); final String[] expected = { "5: " + getCheckMessage(MSG_REGEXP_EXCEEDED, "abc.*def"), <START> }; <END> verify(checkConfig, getPath("InputRegexpMultilineMultilineSupport.java"), expected); }</code><technical_language>I violation</technical_language>

Target:
public void testMultilineSupport() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(RegexpMultilineCheck.class); checkConfig.addAttribute("format", "abc.*def"); checkConfig.addAttribute("matchAcrossLines", "true"); final String[] expected = { "9: " + getCheckMessage(MSG_REGEXP_EXCEEDED, "abc.*def"), }; verify(checkConfig, getPath("InputRegexpMultilineMultilineSupport.java"), expected); }
Source:
<code>public void throwIfNonAdminOrMatchingOwner(User owner) throws IOException, AuthorizationException { User currentUser = getCurrentUser(); <START> if (owner == null) return; <END> if (!(currentUser.isAdmin() || currentUser.getUserId().equals(owner.getUserId()))) { throw new AuthorizationException("Current user is not admin or owner"); } }</code><technical_language>This is unintended grant of permissions users. If owner exist, this instead call throwIfNonAdmin</technical_language>

Target:
public void throwIfNonAdminOrMatchingOwner(User owner) throws IOException, AuthorizationException { if (owner == null) { throwIfNonAdmin(); } else { User currentUser = getCurrentUser(); if (!(currentUser.isAdmin() || currentUser.getUserId().equals(owner.getUserId()))) { throw new AuthorizationException("Current user is not admin or owner"); } } }
Source:
<code>public void setValues() { fontOverrideProperty.setValue(initialAppearancePreferences.shouldOverrideDefaultFontSize()); fontSizeProperty.setValue(String.valueOf(initialAppearancePreferences.getMainFontSize())); <START> String currentTheme = initialAppearancePreferences.getPathToTheme(); <END> if (ThemeLoader.DARK_CSS.equals(currentTheme)) { themeLightProperty.setValue(false); themeDarkProperty.setValue(true); themeCustomProperty.setValue(false); } else if (ThemeLoader.MAIN_CSS.equals(currentTheme) || currentTheme.isBlank()) { themeLightProperty.setValue(true); themeDarkProperty.setValue(false); themeCustomProperty.setValue(false); } else { themeLightProperty.setValue(false); themeDarkProperty.setValue(false); themeCustomProperty.setValue(true); customPathToThemeProperty.setValue(initialAppearancePreferences.getPathToTheme()); } }</code><technical_language>if this clearer, wanted throw idea in: enum for kinds of themes (light / dark / custom), additional Path getPathToCustomTheme in case "custom" enum option is chosen. Right feels getPathToTheme is mixing aspects</technical_language>

Target:
public void setValues() { fontOverrideProperty.setValue(initialAppearancePreferences.shouldOverrideDefaultFontSize()); fontSizeProperty.setValue(String.valueOf(initialAppearancePreferences.getMainFontSize())); Theme currentTheme = initialAppearancePreferences.getTheme(); if (currentTheme.getType() == Theme.Type.LIGHT) { themeLightProperty.setValue(true); themeDarkProperty.setValue(false); themeCustomProperty.setValue(false); } else if (currentTheme.getType() == Theme.Type.DARK) { themeLightProperty.setValue(false); themeDarkProperty.setValue(true); themeCustomProperty.setValue(false); } else { themeLightProperty.setValue(false); themeDarkProperty.setValue(false); themeCustomProperty.setValue(true); customPathToThemeProperty.setValue(currentTheme.getPath().toString()); } }
Source:
<code>public static void start(Properties conf) { System.setProperty("java.awt.headless", "true"); configProxy(conf); ConsoleProxyServerFactory factory = getHttpServerFactory(); if (factory == null) { s_logger.error("Unable to load console proxy server factory"); System.exit(1); } if (httpListenPort != 0) { <START> startServerForNoVNC(); <END> } else { s_logger.error("A valid HTTP server port is required to be specified, please check your consoleproxy.httpListenPort settings"); System.exit(1); } if (httpCmdListenPort > 0) { startupHttpCmdPort(); } else { s_logger.info("HTTP command port is disabled"); } ConsoleProxyGCThread cthread = new ConsoleProxyGCThread(connectionMap); cthread.setName("Console Proxy GC Thread"); cthread.start(); }</code><technical_language>startupHttpMain function move logic of startServerForNoVNC startupHttpMain longer VNC, ajax jetty service</technical_language>

Target:
public static void start(Properties conf) { System.setProperty("java.awt.headless", "true"); configProxy(conf); ConsoleProxyServerFactory factory = getHttpServerFactory(); if (factory == null) { s_logger.error("Unable to load console proxy server factory"); System.exit(1); } if (httpListenPort != 0) { startupHttpMain(); } else { s_logger.error("A valid HTTP server port is required to be specified, please check your consoleproxy.httpListenPort settings"); System.exit(1); } if (httpCmdListenPort > 0) { startupHttpCmdPort(); } else { s_logger.info("HTTP command port is disabled"); } ConsoleProxyGCThread cthread = new ConsoleProxyGCThread(connectionMap); cthread.setName("Console Proxy GC Thread"); cthread.start(); }
Source:
<code>BaseClass getPageLayoutPropertiesClass() throws XWikiException { XWikiDocument doc; boolean needsUpdate = false; DocumentReference pageLayoutPropertiesClassRef = cellsClassConfig.getPageLayoutPropertiesClassRef( getContext().getDatabase()); doc = modelAccess.getOrCreateDocument(pageLayoutPropertiesClassRef); BaseClass bclass = doc.getXClass(); bclass.setDocumentReference(pageLayoutPropertiesClassRef); needsUpdate |= bclass.addTextField("prettyname", "Layout Pretty Name", 30); needsUpdate |= bclass.addBooleanField("isActive", "is active", "yesno"); needsUpdate |= bclass.addTextField("authors", "Authors", 30); needsUpdate |= bclass.addTextAreaField("license", "License", 15, 30); needsUpdate |= bclass.addTextField("version", "Version", 30); <START> needsUpdate |= bclass.addStaticListField("doctype", "Doctype", 1, false, <END> ICellsClassConfig.DOCTYPE_XHTML_VALUE + "|" + ICellsClassConfig.DOCTYPE_HTML_5_VALUE, "select"); needsUpdate |= bclass.addStaticListField(ICellsClassConfig.LAYOUT_TYPE_FIELD, "Layout Type", 1, false, ICellsClassConfig.PAGE_LAYOUT_VALUE + "|" + ICellsClassConfig.EDITOR_LAYOUT_VALUE, "select"); if (!"internal".equals(bclass.getCustomMapping())) { needsUpdate = true; bclass.setCustomMapping("internal"); } LOGGER.debug("getPageLayoutPropertiesClass for db '" + getContext().getDatabase() + "' needs update '" + needsUpdate + "'."); setContentAndSaveClassDocument(doc, needsUpdate); return bclass; }</code><technical_language>new constant ICellsClassConfig.LAYOUT_DOCTYPE_FIELD instead of string literal</technical_language>

Target:
BaseClass getPageLayoutPropertiesClass() throws XWikiException { XWikiDocument doc; boolean needsUpdate = false; DocumentReference pageLayoutPropertiesClassRef = cellsClassConfig.getPageLayoutPropertiesClassRef( getContext().getDatabase()); doc = modelAccess.getOrCreateDocument(pageLayoutPropertiesClassRef); BaseClass bclass = doc.getXClass(); bclass.setDocumentReference(pageLayoutPropertiesClassRef); needsUpdate |= bclass.addTextField("prettyname", "Layout Pretty Name", 30); needsUpdate |= bclass.addBooleanField("isActive", "is active", "yesno"); needsUpdate |= bclass.addTextField("authors", "Authors", 30); needsUpdate |= bclass.addTextAreaField("license", "License", 15, 30); needsUpdate |= bclass.addTextField("version", "Version", 30); needsUpdate |= bclass.addStaticListField(ICellsClassConfig.LAYOUT_DOCTYPE_FIELD, "Doctype", 1, false, HtmlDoctype.XHTML + "|" + HtmlDoctype.HTML5, "select"); needsUpdate |= bclass.addStaticListField(ICellsClassConfig.LAYOUT_TYPE_FIELD, "Layout Type", 1, false, ICellsClassConfig.PAGE_LAYOUT_VALUE + "|" + ICellsClassConfig.EDITOR_LAYOUT_VALUE, "select"); if (!"internal".equals(bclass.getCustomMapping())) { needsUpdate = true; bclass.setCustomMapping("internal"); } LOGGER.debug("getPageLayoutPropertiesClass for db '" + getContext().getDatabase() + "' needs update '" + needsUpdate + "'."); setContentAndSaveClassDocument(doc, needsUpdate); return bclass; }
Source:
<code>public void setup(OperatorContext context) { super.setup(context); spinMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); execute = true; cause = new AtomicReference<Throwable>(); emitQueue = new ArrayBlockingQueue<List<T>>(queueCapacity); this.context = context; operatorId = context.getId(); try { <START> if (ps == null) { <END> if (getRangeQueryPair().getValue() != null) { ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildRangeQuery(getTableName(), getKey(), rangeQueryPair.getKey(), rangeQueryPair.getValue()), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); } else { ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildPollableQuery(getTableName(), getKey(), rangeQueryPair.getKey()), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); isPollable = true; } } } catch (SQLException e) { LOG.error("Exception in initializing the range query for a given partition", e); } windowManager.setup(context); LOG.debug("super setup done..."); }</code><technical_language>is ps null</technical_language>

Target:
public void setup(OperatorContext context) { super.setup(context); spinMillis = context.getValue(Context.OperatorContext.SPIN_MILLIS); execute = true; cause = new AtomicReference<Throwable>(); emitQueue = new ArrayBlockingQueue<List<T>>(queueCapacity); this.context = context; operatorId = context.getId(); try { if (getRangeQueryPair().getValue() != null) { ps = store.getConnection() .prepareStatement( JdbcMetaDataUtility.buildRangeQuery(getTableName(), getKey(), rangeQueryPair.getKey(), rangeQueryPair.getValue()), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); } else { ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildPollableQuery(getTableName(), getKey(), rangeQueryPair.getKey()), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); isPollable = true; } } catch (SQLException e) { LOG.error("Exception in initializing the range query for a given partition", e); throw new RuntimeException(e); } windowManager.setup(context); LOG.debug("super setup done..."); }
Source:
<code>private Set<Privileges> immuteRepositoryPrivileges(final Set<Privileges> set) { <START> return set != null ? Collections.unmodifiableSet(set) <END> : Collections.emptySet(); }</code><technical_language>ImmutableSet.copyOf instead of Collections.unmodifiableSet</technical_language>

Target:
private Set<Privileges> immuteRepositoryPrivileges(final Set<Privileges> set) { return set != null ? ImmutableSet.copyOf(set) : Collections.emptySet(); }
Source:
<code>public Integer size() { ensureSearchEntityLoaded(); SearchCoordinatorSvcImpl.verifySearchHasntFailedOrThrowInternalErrorException(mySearchEntity); Integer size = mySearchEntity.getTotalCount(); if (size != null) { <START> return Math.max(0, size); <END> } if (mySearchEntity.getSearchType() == SearchTypeEnum.HISTORY) { return null; } else { return mySearchCoordinatorSvc.getSearchTotalFromRunningSearchIfExists(myUuid).orElse(null); } }</code><technical_language>size negative?</technical_language>

Target:
public Integer size() { ensureSearchEntityLoaded(); SearchCoordinatorSvcImpl.verifySearchHasntFailedOrThrowInternalErrorException(mySearchEntity); Integer size = mySearchEntity.getTotalCount(); if (size != null) { return Math.max(0, size); } if (mySearchEntity.getSearchType() == SearchTypeEnum.HISTORY) { return null; } else { return mySearchCoordinatorSvc.getSearchTotal(myUuid).orElse(null); } }
Source:
<code>public void <START> deleteDraft() throws RestApiException { <END> try { deleteDraftPatchSet.get().apply(revision, null); } catch (OrmException e) { throw new RestApiException("Cannot delete draft ps", e); } catch (IOException e) { throw new RestApiException("Cannot delete draft ps", e); } }</code><technical_language>nit: remove line break</technical_language>

Target:
public void deleteDraft() throws RestApiException { try { deleteDraft.get().apply(revision, null); } catch (OrmException e) { throw new RestApiException("Cannot delete draft ps", e); } catch (IOException e) { throw new RestApiException("Cannot delete draft ps", e); } }
Source:
<code>public boolean check() { final Method[] accessibleMethods = getAccessibleMethods(); for (Method method : accessibleMethods) { final Class[] parameterTypes = method.getParameterTypes(); final String methodName = method.getName(); <START> final boolean isExcluded = excludedMethods.contains(methodName); <END> final boolean arePrimitives = primitiveValues.containsAll(Arrays.asList(parameterTypes)); final boolean skipIteration = isExcluded || parameterTypes.length == 0 || arePrimitives; if (skipIteration) { continue; } final Object[] parameterValues = getParameterValues(parameterTypes); final boolean isCorrect = invokeAndCheck(method, parameterValues, parameterTypes); if (!isCorrect) { return false; } } return true; }</code><technical_language>excluded. isExcluded is name for a getter</technical_language>

Target:
public boolean check() { final DefaultValueProvider valuesProvider = new DefaultValueProvider(defaultValues); final Iterable<Method> accessibleMethods = getAccessibleMethods(targetClass); final String targetClassName = targetClass.getName(); for (Method method : accessibleMethods) { final Class[] parameterTypes = method.getParameterTypes(); final String methodName = method.getName(); final boolean excluded = excludedMethods.contains(methodName); final boolean primitivesOnly = allPrimitiveTypes().containsAll(Arrays.asList(parameterTypes)); final boolean skipMethod = excluded || parameterTypes.length == 0 || primitivesOnly; if (skipMethod) { continue; } final MethodChecker methodChecker = new MethodChecker(method, targetClassName, valuesProvider); final boolean passed = methodChecker.check(); if (!passed) { return false; } } return true; }
Source:
<code>public void simpleOnHeapToString() throws Exception { File root = new File("build/tmp/EhcacheManagerToStringTest"); root.mkdirs(); cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .with(new CacheManagerPersistenceConfiguration(root)) .withCache("cache-1", CacheConfigurationBuilder.newCacheConfigurationBuilder( String.class, String.class, newResourcePoolsBuilder() .heap(10, EntryUnit.ENTRIES) .offheap(1, MemoryUnit.MB) .disk(2, MemoryUnit.MB, true)) .withLoaderWriter(new SampleLoaderWriter<String, String>()) .add(WriteBehindConfigurationBuilder .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3) .queueSize(3) .concurrencyLevel(1) .enableCoalescing()) .withEvictionAdvisor(new EvictionAdvisor<String, String>() { @Override public boolean adviseAgainstEviction(String key, String value) { return false; } }) .build()) .build(true); String readableString = ((HumanReadable) cacheManager.getRuntimeConfiguration()).readableString(); System.out.println(readableString); <START> Yaml yaml = new Yaml(); <END> Object actual = yaml.load(readableString); Object expected = yaml.load(this.getClass().getResourceAsStream("/simpleConfiguration.yml")); applySortingOnLists(actual); applySortingOnLists(expected); Assert.assertThat(actual, equalTo(expected)); }</code><technical_language>in HumanReadable.readableString() string yaml-parseable</technical_language>

Target:
public void simpleOnHeapToString() throws Exception { File root = new File("build/tmp/EhcacheManagerToStringTest"); root.mkdirs(); cacheManager = CacheManagerBuilder.newCacheManagerBuilder() .with(new CacheManagerPersistenceConfiguration(root)) .withCache("cache-1", CacheConfigurationBuilder.newCacheConfigurationBuilder( String.class, String.class, newResourcePoolsBuilder() .heap(10, EntryUnit.ENTRIES) .offheap(1, MemoryUnit.MB) .disk(2, MemoryUnit.MB, true)) .withLoaderWriter(new SampleLoaderWriter<String, String>()) .add(WriteBehindConfigurationBuilder .newBatchedWriteBehindConfiguration(1, TimeUnit.SECONDS, 3) .queueSize(3) .concurrencyLevel(1) .enableCoalescing()) .withEvictionAdvisor(new EvictionAdvisor<String, String>() { @Override public boolean adviseAgainstEviction(String key, String value) { return false; } }) .build()) .build(true); String actual = ((HumanReadable) cacheManager.getRuntimeConfiguration()).readableString(); String expected = read("/simpleConfiguration.txt"); Assert.assertThat( actual.substring(actual.indexOf("resourcePools")).replace(" ", "").replace("\n", ""), equalTo( expected.substring(expected.indexOf("resourcePools")).replace(" ", "").replace("\n", "") ) ); }
Source:
<code>public void checkCallsForWellFormedness() throws AvroRemoteException { final long start = 50; final long end = 100; <START> final SearchVariantSetsRequest req = <END> SearchVariantSetsRequest.newBuilder() .setDatasetId(TestData.getDatasetId()) .build(); final SearchVariantSetsResponse resp = client.variants.searchVariantSets(req); final List<VariantSet> variantSets = resp.getVariantSets(); assertThat(variantSets).isNotEmpty(); final String id = variantSets.get(0).getId(); final SearchVariantsRequest vReq = SearchVariantsRequest.newBuilder() .setVariantSetId(id) .setReferenceName(TestData.REFERENCE_NAME) .setStart(start).setEnd(end) .build(); final SearchVariantsResponse vResp = client.variants.searchVariants(vReq); final List<Variant> searchVariants = vResp.getVariants(); searchVariants.stream().forEach(v -> v.getCalls().stream() .forEach(c -> assertThat(c.getGenotype()).isNotNull() .isNotEmpty())); searchVariants.stream().forEach(v -> v.getCalls().stream() .forEach(c -> assertThat(c.getGenotypeLikelihood()) .isNotNull())); searchVariants.stream().forEach(v -> v.getCalls().stream().forEach(c -> { assertThat(c.getInfo()).isNotNull(); c.getInfo().keySet().stream().forEach(key -> { assertThat(key).isNotNull(); assertThat(c.getInfo().get(key)).isNotNull(); }); })); }</code><technical_language>This extracted a helper / Utils, repeated in of test cases</technical_language>

Target:
public void checkCallsForWellFormedness() throws AvroRemoteException { final long start = 50; final long end = 100; final SearchVariantSetsRequest req = SearchVariantSetsRequest.newBuilder() .setDatasetId(TestData.getDatasetId()) .build(); final SearchVariantSetsResponse resp = client.variants.searchVariantSets(req); final List<VariantSet> variantSets = resp.getVariantSets(); assertThat(variantSets).isNotEmpty(); final String id = variantSets.get(0).getId(); final SearchVariantsRequest vReq = SearchVariantsRequest.newBuilder() .setVariantSetId(id) .setReferenceName(TestData.REFERENCE_NAME) .setStart(start).setEnd(end) .build(); final SearchVariantsResponse vResp = client.variants.searchVariants(vReq); final List<Variant> searchVariants = vResp.getVariants(); checkAllCalls(searchVariants, c -> assertThat(c.getGenotype()).isNotNull().isNotEmpty()); checkAllCalls(searchVariants, c -> assertThat(c.getGenotypeLikelihood()).isNotNull()); checkAllCalls(searchVariants, c -> { assertThat(c.getInfo()).isNotNull(); c.getInfo().keySet().stream().forEach(key -> { assertThat(key).isNotNull(); assertThat(c.getInfo().get(key)).isNotNull(); }); }); }
Source:
<code>public void findCapabilities() throws Exception { CapabilityList capabilities = new CapabilityList(Lists.newArrayList(new Capability(256, "ANQP Query List"), new Capability(257, "ANQP Capability list"))); Venue venue = newVenueBuilder().names(new VenueName("Info", new Language("en"))).build(); GeoLocation location = new GeoLocation(24.3456789, 45.5678934); Object operatorId = operatorRepository.create(new NewOperator("name1", ACTIVE, "description1", "domainName1", "friendlyName1", "emergencyNumber1", PUBLIC)); NewAccessPoint ap = new NewAccessPoint(new ID(operatorId), "ip1", new MacAddress("aa:bb:cc:dd:ee:ff"), "sn1", "model1", venue, location, capabilities); Object id = repository.create(ap); CapabilityList actual = repository.findCapabilityList(new ID(id)); <START> CapabilityList expected = new CapabilityList(Lists.newArrayList(new Capability(256, "ANQP Query List"), new Capability(257, "ANQP Capability list"))); <END> assertThat(actual, deepEquals(expected)); }</code><technical_language>this object is capabilities</technical_language>

Target:
public void findCapabilities() throws Exception { CapabilityList capabilities = new CapabilityList(Lists.newArrayList(new Capability(256, "ANQP Query List"), new Capability(257, "ANQP Capability list"))); CivicLocation civic = new CivicLocation("country", "city", "street", "number", "postCode"); GeoLocation geo = new GeoLocation(22.22222, 33.333333); Venue venue = newVenueBuilder().names(new VenueName("Info", new Language("en"))).build(); NewOperator operator = newOperator().build(); Object operatorId = operatorRepository.create(operator); NewAccessPoint ap = new NewAccessPoint(new ID(operatorId), "ip1", new MacAddress("aa:bb:cc:dd:ee:ff"), "sn1", "model1", venue, geo, civic, capabilities); Object id = repository.create(ap); CapabilityList actual = repository.findCapabilityList(new ID(id)); assertThat(actual, deepEquals(capabilities)); }
Source:
<code>public void makeOnCreationCallbackListBoxSingleSelect() { setupMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS, false); final Callback callback = CallbackFactory.makeOnCreationCallback(factory, cell, enumLookups); callback.callback(multiValueDOMElement); <START> <END> verifyMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS); }</code><technical_language>chance add verify(multiValueWidget, never()).setVisibleItemCount(anyInt());</technical_language>

Target:
public void makeOnCreationCallbackListBoxSingleSelect() { setupMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS, false); final Callback callback = CallbackFactory.makeOnCreationCallback(factory, cell, enumLookups); callback.callback(multiValueDOMElement); verifyMultipleSelectTest(CallbackFactory.MAX_VISIBLE_ROWS); verify(multiValueWidget, never()).setVisibleItemCount(anyInt()); }
Source:
<code>public void testHeaderAmountAndHeaderRowCountsMatch() { LOG.info("testHeaderAmountAndHeaderRowCountsMatch"); ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.GOOD_FILE.createConcurRequestExtractFile(); ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData(); assertTrue("Expected Result: Header amount SHOULD match sum of row amounts from file.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData)); LOG.info(reportData.getHeaderValidationErrors()); System.out.println(""); <START> reportData = null; <END> }</code><technical_language>is this null set needed</technical_language>

Target:
public void testHeaderAmountAndHeaderRowCountsMatch() { LOG.info("testHeaderAmountAndHeaderRowCountsMatch"); ConcurRequestExtractFile testFile = ConcurRequestExtractFileFixture.GOOD_FILE.createConcurRequestExtractFile(); ConcurRequestExtractBatchReportData reportData = new ConcurRequestExtractBatchReportData(); assertTrue("Expected Result: Header amount SHOULD match sum of row amounts from file.", concurRequestExtractFileValidationService.requestExtractHeaderRowValidatesToFileContents(testFile, reportData)); LOG.info(reportData.getHeaderValidationErrors()); LOG.info(KFSConstants.NEWLINE); reportData = null; }
Source:
<code>protected void executeVmCommand() { vmHandler.warnMemorySizeLegal(getParameters().getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (!canAddVm(destStorages.values())) { log.error("Failed to add VM. The reasons are: {}", String.join(",", getReturnValue().getValidationMessages())); return; } <START> if (!setEmptyLeaseToBootableSD()) { <END> return; } TransactionSupport.executeInNewTransaction(() -> { addVmStatic(); addVmDynamic(); addVmNetwork(); addVmNumaNodes(); addVmStatistics(); addActiveSnapshot(); addVmPermission(); addVmInit(); addVmRngDevice(); addAffinityLabels(); getCompensationContext().stateChanged(); return null; }); if (addVmImages()) { TransactionSupport.executeInNewTransaction(() -> { copyDiskVmElements(); copyVmDevices(); addDiskPermissions(); addVmPayload(); updateSmartCardDevices(); addVmWatchdog(); addGraphicsDevice(); getVmDeviceUtils().updateVirtioScsiController(getVm().getStaticData(), getParameters().isVirtioScsiEnabled()); setActionReturnValue(getVm().getId()); setSucceeded(true); return null; }); } if (getParameters().getPoolId() != null) { addVmToPool(); } discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmId()); }</code><technical_language>"Empty Lease" mean? please rephrase....I kind of addVmLease....something addDefaultVmLease()</technical_language>

Target:
protected void executeVmCommand() { vmHandler.warnMemorySizeLegal(getParameters().getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (!canAddVm(destStorages.values())) { log.error("Failed to add VM. The reasons are: {}", String.join(",", getReturnValue().getValidationMessages())); return; } if (!addDefaultVmLease()) { return; } TransactionSupport.executeInNewTransaction(() -> { addVmStatic(); addVmDynamic(); addVmNetwork(); addVmNumaNodes(); addVmStatistics(); addActiveSnapshot(); addVmPermission(); addVmInit(); addVmRngDevice(); addAffinityLabels(); getCompensationContext().stateChanged(); return null; }); if (addVmImages()) { TransactionSupport.executeInNewTransaction(() -> { copyDiskVmElements(); copyVmDevices(); addDiskPermissions(); addVmPayload(); updateSmartCardDevices(); addVmWatchdog(); addGraphicsDevice(); getVmDeviceUtils().updateVirtioScsiController(getVm().getStaticData(), getParameters().isVirtioScsiEnabled()); setActionReturnValue(getVm().getId()); setSucceeded(true); return null; }); } if (getParameters().getPoolId() != null) { addVmToPool(); } discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmId()); }
Source:
<code>private Object loadFromSecondLevelCache( final LoadEvent event, final EntityPersister persister, final EntityKey entityKey) { final SessionImplementor source = event.getSession(); final boolean skipCache = ( ! persister.canReadFromCache() ) || ( ! source.getCacheMode().isGetEnabled() ) <START> || ( ! event.getLockMode().lessThan( LockMode.READ ) ); <END> if ( skipCache ) { return null; } final Object ce = getFromSharedCache( event, persister, source ); if ( ce == null ) { return null; } return processCachedEntry( event, persister, ce, source, entityKey ); }</code><technical_language>I missing something; I understand change difference performance-wise. this change more readable, improve performance</technical_language>

Target:
private Object loadFromSecondLevelCache( final LoadEvent event, final EntityPersister persister, final EntityKey entityKey) { final SessionImplementor source = event.getSession(); final boolean useCache = persister.canReadFromCache() && source.getCacheMode().isGetEnabled() && event.getLockMode().lessThan( LockMode.READ ); if ( !useCache ) { return null; } final Object ce = getFromSharedCache( event, persister, source ); if ( ce == null ) { return null; } return processCachedEntry( event, persister, ce, source, entityKey ); }
Source:
<code><START> public String toString() { <END> return getToStringBuilder().toString(); }</code><technical_language>this method final</technical_language>

Target:
public final String toString() { return getToStringBuilder().toString(); }
Source:
<code>public void onBackgroundTabSelected() { setItemMenuEnabled(true); <START> runScenarioMenuItem.setEnabled(false); <END> scenarioBackgroundGridWidget.clearSelections(); scenarioBackgroundGridWidget.select(); scenarioMainGridWidget.deselect(); populateRightDocks(TestToolsPresenter.IDENTIFIER); }</code><technical_language>Please enable run button in background tab</technical_language>

Target:
public void onBackgroundTabSelected() { setItemMenuEnabled(true); scenarioBackgroundGridWidget.clearSelections(); scenarioBackgroundGridWidget.select(); scenarioMainGridWidget.deselect(); populateRightDocks(TestToolsPresenter.IDENTIFIER); }
Source:
<code><START> public Matrix removeColumn(int j, Factory factory) { <END> if (j >= this.columns || j < 0) { throw new IllegalArgumentException("Illegal row number, must be 0.." + (this.columns - 1)); } Matrix that = factory.createMatrix(this.rows, this.columns - 1); for (int jj = 0; jj < j; jj++) { that.setColumn(jj, this.getColumn(jj)); } for (int jj = j + 1; jj < this.columns; jj++) { that.setRow(jj - 1, this.getRow(jj)); } return that; }</code><technical_language>issues in removeRow</technical_language>

Target:
public Matrix removeColumn(int j, Factory factory) { if (j >= columns || j < 0) { throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + (columns - 1)); } Matrix result = factory.createMatrix(rows, columns - 1); for (int jj = 0; jj < j; jj++) { result.setColumn(jj, getColumn(jj)); } for (int jj = j + 1; jj < columns; jj++) { result.setColumn(jj - 1, getColumn(jj)); } return result; }
Source:
<code>public MailjetRequest parseToEmail(EmailWrapper wrapper) { MailjetRequest request = new MailjetRequest(Email.resource); request.property(Email.FROMEMAIL, wrapper.getSenderEmail()); if (wrapper.getSenderName() != null && !wrapper.getSenderName().isEmpty()) { request.property(Email.FROMNAME, wrapper.getSenderName()); } request.property(Email.RECIPIENTS, new JSONArray().put(new JSONObject().put("Email", wrapper.getRecipient()))); if (wrapper.getBcc() != null && !wrapper.getBcc().isEmpty()) { <START> request.property(Email.BCC, new JSONArray().put(new JSONObject().put("Email", wrapper.getBcc()))); <END> } request.property(Email.HEADERS, new JSONObject().put("Reply-To", wrapper.getReplyTo())); request.property(Email.SUBJECT, wrapper.getSubject()); request.property(Email.HTMLPART, wrapper.getContent()); request.property(Email.TEXTPART, Jsoup.parse(wrapper.getContent()).text()); return request; }</code><technical_language>certain, <LINK_0>, for mailjet, bcc in conjunction recipients</technical_language>

Target:
public MailjetRequest parseToEmail(EmailWrapper wrapper) { MailjetRequest request = new MailjetRequest(Email.resource); request.property(Email.FROMEMAIL, wrapper.getSenderEmail()); if (wrapper.getSenderName() != null && !wrapper.getSenderName().isEmpty()) { request.property(Email.FROMNAME, wrapper.getSenderName()); } request.property(Email.RECIPIENTS, new JSONArray().put(new JSONObject().put("Email", wrapper.getRecipient()))); if (wrapper.getBcc() != null && !wrapper.getBcc().isEmpty()) { request.append(Email.RECIPIENTS, new JSONObject().put("Email", wrapper.getBcc())); } request.property(Email.HEADERS, new JSONObject().put("Reply-To", wrapper.getReplyTo())); request.property(Email.SUBJECT, wrapper.getSubject()); request.property(Email.HTMLPART, wrapper.getContent()); request.property(Email.TEXTPART, Jsoup.parse(wrapper.getContent()).text()); return request; }
Source:
<code>for (final String prefix : ArrayUtils.toArray("@p", "@a", "@r", "@e")) { selectorHandlers.put(prefix, vanillaHandler); <START> registeringMods.put(prefix, "Minecraft"); <END> }</code><technical_language>Minecraft lowercase</technical_language>

Target:
for (final String prefix : ArrayUtils.toArray("@p", "@a", "@r", "@e")) { selectorHandlers.put(prefix, vanillaHandler); registeringMods.put(prefix, "minecraft"); }
Source:
<code>private boolean skipToNextSegment(boolean deleteCurrent) throws IOException { PBDSegmentReader<M> segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } m_numRead += m_segment.getNumEntries() - segmentReader.readIndex(); segmentReader.markAllReadAndDiscarded(); Map.Entry<Long, PBDSegment<M>> entry = m_segments.higherEntry(m_segment.segmentIndex()); if (entry == null) { if (canDeleteSegmentsBefore(m_segment, 1)) { PBDSegment<M> deleteBefore = m_segment; <START> m_deferredDeleter.execute(() -> deleteSegmentsBefore(deleteBefore)); <END> } return false; } PBDSegment<M> oldSegment = m_segment; m_segment = entry.getValue(); PBDSegment<M> segmentToDeleteBefore = deleteCurrent ? m_segment : oldSegment; if (canDeleteSegmentsBefore(segmentToDeleteBefore, 1)) { m_deferredDeleter.execute(() -> deleteSegmentsBefore(segmentToDeleteBefore)); } return true; }</code><technical_language>If m_deferredDeleter needs I create a deleteSegmentsBefore(PBDSegment, int) basically canDeleteSegmentsBefore check call m_deferredDeleter.execute(() -> deleteSegmentsBefore(deleteBefore)); remove canDeleteSegmentsBefore(PBDSegment, int)</technical_language>

Target:
private boolean skipToNextSegment(boolean deleteCurrent) throws IOException { PBDSegmentReader<M> segmentReader = m_segment.getReader(m_cursorId); if (segmentReader == null) { segmentReader = m_segment.openForRead(m_cursorId); } m_numRead += m_segment.getNumEntries() - segmentReader.readIndex(); segmentReader.markAllReadAndDiscarded(); Map.Entry<Long, PBDSegment<M>> entry = m_segments.higherEntry(m_segment.segmentIndex()); if (entry == null) { callDeleteSegmentsBefore(m_segment, 1); return false; } PBDSegment<M> oldSegment = m_segment; m_segment = entry.getValue(); PBDSegment<M> segmentToDeleteBefore = deleteCurrent ? m_segment : oldSegment; callDeleteSegmentsBefore(segmentToDeleteBefore, 1); return true; }
Source:
<code>public void testCreateTableWithUnsupportedType() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); try { metadata.createTable(SESSION, getOrdersTableWithUnsupportedType(ImmutableMap.of()), false); assert (false); <START> } <END> catch (PrestoException pe) { assertEquals(pe.getErrorCode(), NOT_SUPPORTED.toErrorCode()); } }</code><technical_language>nit: fail() instead of assert(false). a chance put in error message. Please check other examples in file</technical_language>

Target:
public void testCreateTableWithUnsupportedType() { assertNull(metadata.getTableHandle(SESSION, DEFAULT_TEST_ORDERS)); ConnectorTableMetadata raptorMetadata = buildTable(ImmutableMap.of(), tableMetadataBuilder(DEFAULT_TEST_ORDERS) .column("orderkey", BIGINT) .column("rowtype", RowType.withDefaultFieldNames(ImmutableList.of(BIGINT)))); try { metadata.createTable(SESSION, raptorMetadata, false); fail(); } catch (PrestoException e) { assertEquals(e.getErrorCode(), NOT_SUPPORTED.toErrorCode()); } }
Source:
<code>public Builder config(@NonNull Bitmap.Config config) { if (config == null) { <START> throw new IllegalArgumentException("tag == null"); <END> } this.config = config; return this; }</code><technical_language>wrong message</technical_language>

Target:
public Builder config(@NonNull Bitmap.Config config) { if (config == null) { throw new IllegalArgumentException("config == null"); } this.config = config; return this; }
Source:
<code><START> public void testCopyWithoutCompaction() throws Exception { <END> command.repoURI = repoUri; command.noCompaction = true; command.datasets = Lists.newArrayList(source, dest); int rc = command.run(); Assert.assertEquals("Should return success", 0, rc); DatasetRepository repo = DatasetRepositories.open("repo:" + repoUri); int size = DatasetTestUtilities.datasetSize(repo.load(dest)); Assert.assertEquals("Should contain copied records", 6, size); verify(console).info("Added records to \"{}\"", 6l, dest); verifyNoMoreInteractions(console); }</code><technical_language>test test expected number of files created in target dataset. This test check is one, testCopyWithNumWriters check three, testPartitionedCopyWithNumWriters check (the number of partitions). I noticed test is MemPipeline - switch run in parallel test this correctly</technical_language>

Target:
public void testCopyWithoutCompaction() throws Exception { command.repoURI = repoUri; command.noCompaction = true; command.datasets = Lists.newArrayList(source, dest); int rc = command.run(); Assert.assertEquals("Should return success", 0, rc); DatasetRepository repo = DatasetRepositories.open("repo:" + repoUri); FileSystemDataset<GenericData.Record> ds = (FileSystemDataset<GenericData.Record>) repo.<GenericData.Record> load(dest); int size = DatasetTestUtilities.datasetSize(ds); Assert.assertEquals("Should contain copied records", 6, size); Assert.assertEquals("Should produce 1 files", 1, Iterators.size(ds.pathIterator())); verify(console).info("Added records to \"{}\"", 6l, dest); verifyNoMoreInteractions(console); }
Source:
<code>protected ImmutableValue<DyeColor> constructImmutableValue(DyeColor value) { <START> return constructValue(value).asImmutable(); <END> }</code><technical_language>new ImmutableSpongeValue<>(this.key, DyeColors.PURPLE, value)</technical_language>

Target:
protected ImmutableValue<DyeColor> constructImmutableValue(DyeColor value) { return ImmutableSpongeValue.cachedOf(Keys.DYE_COLOR, DyeColors.PURPLE, value); }
Source:
<code>public BlobServiceClient createBlobStorageClient(CloudConfig cloudConfig, AzureCloudConfig azureCloudConfig) <START> throws MalformedURLException, InterruptedException, ExecutionException { <END> validateABSAuthConfigs(azureCloudConfig); Configuration storageConfiguration = new Configuration(); ProxyOptions proxyOptions = (cloudConfig.vcrProxyHost == null) ? null : new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort)); if (proxyOptions != null) { logger.info("Using proxy: {}:{}", cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort); } HttpClient client = new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build(); RequestRetryOptions noRetries = new RequestRetryOptions(RetryPolicyType.FIXED, 1, null, null, null, null); return buildBlobServiceClient(client, storageConfiguration, noRetries, azureCloudConfig); }</code><technical_language>introducing new checked exceptions AzureBlobDataAccessor needs about, catch rethrow IllegalStateException similar AzureCloudDestinationFactory.getCloudDestination()</technical_language>

Target:
public BlobServiceClient createBlobStorageClient(CloudConfig cloudConfig, AzureCloudConfig azureCloudConfig) { validateABSAuthConfigs(azureCloudConfig); Configuration storageConfiguration = new Configuration(); ProxyOptions proxyOptions = (cloudConfig.vcrProxyHost == null) ? null : new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort)); if (proxyOptions != null) { logger.info("Using proxy: {}:{}", cloudConfig.vcrProxyHost, cloudConfig.vcrProxyPort); } HttpClient client = new NettyAsyncHttpClientBuilder().proxy(proxyOptions).build(); RequestRetryOptions noRetries = new RequestRetryOptions(RetryPolicyType.FIXED, 1, null, null, null, null); try { return buildBlobServiceClient(client, storageConfiguration, noRetries, azureCloudConfig); } catch (MalformedURLException | InterruptedException | ExecutionException ex) { logger.error("Error building ABS blob service client: {}", ex.getMessage()); throw new IllegalStateException(ex); } }
Source:
<code>public void shouldCloseWrappedStoreAfterErrorDuringCacheFlush() { setUpCloseTests(); cache.flush(CACHE_NAMESPACE); EasyMock.expectLastCall().andThrow(new NullPointerException("Simulating an error on flush")); EasyMock.replay(cache); EasyMock.reset(keyValueStore); keyValueStore.close(); EasyMock.replay(keyValueStore); try { store.close(); } catch (final NullPointerException npe) { <START> EasyMock.verify(keyValueStore); <END> } }</code><technical_language>verify of NPE</technical_language>

Target:
public void shouldCloseWrappedStoreAfterErrorDuringCacheFlush() { setUpCloseTests(); cache.flush(CACHE_NAMESPACE); EasyMock.expectLastCall().andThrow(new NullPointerException("Simulating an error on flush")); EasyMock.replay(cache); EasyMock.reset(underlyingStore); underlyingStore.close(); EasyMock.replay(underlyingStore); try { store.close(); } catch (final RuntimeException exception) { EasyMock.verify(underlyingStore); } }
Source:
<code>private void loadInitialState(ITmfStateProvider provider) { for (ITmfStateSystem ss : getStateSystems()) { if (ss instanceof ITmfStateSystemBuilder) { ITmfStateSystemBuilder ssb = (ITmfStateSystemBuilder) ss; final ITmfTrace trace = getTrace(); if (trace == null) { throw new IllegalStateException(); } final long startTime = trace.getStartTime().toNanos(); StateSnapshot snapshot = StateSnapshot.read(Paths.get(trace.getPath()), ss.getSSID()); if (snapshot == null || provider.getVersion() != snapshot.getVersion()) { continue; } for (Entry<List<String>, ITmfStateInterval> attributeSnapshot : snapshot.getStates().entrySet()) { List<String> attributePath = Objects.requireNonNull(attributeSnapshot.getKey()); int quark = ssb.getQuarkAbsoluteAndAdd(attributePath.toArray(new String[attributePath.size()])); Object initialState = Objects.requireNonNull(attributeSnapshot.getValue()).getValue(); <START> ssb.modifyAttribute(startTime, initialState, quark); <END> } } } }</code><technical_language>Do need snapshot corresponds start time? snapshot needs store snapshot time</technical_language>

Target:
private void loadInitialState(ITmfStateProvider provider) { for (ITmfStateSystem ss : getStateSystems()) { if (ss instanceof ITmfStateSystemBuilder) { ITmfStateSystemBuilder ssb = (ITmfStateSystemBuilder) ss; final ITmfTrace trace = getTrace(); if (trace == null) { throw new IllegalStateException(); } final long startTime = trace.getStartTime().toNanos(); StateSnapshot snapshot = StateSnapshot.read(Paths.get(trace.getPath()), ss.getSSID()); if (snapshot == null || provider.getVersion() != snapshot.getVersion()) { continue; } for (Entry<List<String>, ITmfStateInterval> attributeSnapshot : snapshot.getStates().entrySet()) { List<String> attributePath = Objects.requireNonNull(attributeSnapshot.getKey()); int quark = ssb.getQuarkAbsoluteAndAdd(attributePath.toArray(new String[attributePath.size()])); ITmfStateInterval interval = Objects.requireNonNull(attributeSnapshot.getValue()); Object initialState = interval.getValue(); ssb.modifyAttribute(Math.max(interval.getStartTime(), ssb.getStartTime()), initialState, quark); } } } }
Source:
<code>public String getResponseString() { if (response == null) <START> return ""; <END> return HexUtils.byteArrayToHexString(response).replace("\n", ""); }</code><technical_language>answer null if response is null</technical_language>

Target:
public String getResponseString() { if (response == null) return null; return HexUtils.byteArrayToHexString(response).replace("\n", ""); }
Source:
<code>public static int[] calculateWrapOffsets(final String line, final int maxLineLength) { if (line.length() == 0) return null; IntList wrapOffsets = new IntList(); int wordStart = 0; int lineStart = 0; boolean wasSpace = true; for (int i = 0; i < line.length(); i++) { char ch = line.charAt(i); if (ch == ' ') { wasSpace = true; } else if (ch == '\r' || ch == '\n') { lineStart = i + 1; wordStart = i + 1; wasSpace = false; } else { if (wasSpace) { wasSpace = false; wordStart = i; } if (i >= lineStart + maxLineLength) { if (wordStart != lineStart) { wrapOffsets.add(wordStart); lineStart = wordStart; } } } } int size = wrapOffsets.size(); if (size == 0) { return null; } else { int[] result = new int[size]; <START> for (int i= 0; i < size; i++) { <END> result[i] = wrapOffsets.get(i); } return result; } }</code><technical_language>Style nit: int i = 0 (missing space)</technical_language>

Target:
public static int[] calculateWrapOffsets(final String line, final int maxLineLength) { if (line.length() == 0) return null; IntList wrapOffsets = new IntList(); int wordStart = 0; int lineStart = 0; boolean lastWasSpace = true; boolean onlySpaces = true; for (int i = 0; i < line.length(); i++) { char ch = line.charAt(i); if (ch == ' ') { lastWasSpace = true; } else if (ch == '\n') { lineStart = i + 1; wordStart = i + 1; lastWasSpace = true; onlySpaces = true; } else { if (lastWasSpace) { lastWasSpace = false; if (!onlySpaces) { wordStart = i; } } else { onlySpaces = false; } if (i >= lineStart + maxLineLength) { if (wordStart != lineStart) { wrapOffsets.add(wordStart); lineStart = wordStart; onlySpaces = true; } } } } int size = wrapOffsets.size(); if (size == 0) { return null; } else { int[] result = new int[size]; for (int i = 0; i < size; i++) { result[i] = wrapOffsets.get(i); } return result; } }
Source:
<code>public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { BigDecimal result = null; for (int i=0; i<children.size(); i++) { Expression childExpr = children.get(i); if (!childExpr.evaluate(tuple, ptr) || ptr.getLength() == 0) { return false; } PDataType childType = children.get(i).getDataType(); BigDecimal bd= (BigDecimal)PDataType.DECIMAL.toObject(ptr, childType); if (result == null) { result = bd; maxLength = childExpr.getMaxLength(); scale = childExpr.getScale(); } else { result = result.divide(bd, NumberUtil.DEFAULT_MATH_CONTEXT); if (maxLength != null && scale != null && childExpr.getMaxLength() != null & childExpr.getScale() != null) { int desiredPrecision = NumberUtil.getDecimalPrecision(NumericOperators.DIVIDE, maxLength, childExpr.getMaxLength(), scale, childExpr.getScale()); int desiredScale = NumberUtil.getDecimalScale(NumericOperators.DIVIDE, <START> maxLength, childExpr.getMaxLength(), scale, childExpr.getScale()); <END> result = NumberUtil.setDecimalWidthAndScale(result, desiredPrecision, desiredScale); if (result == null) { return false; } maxLength = desiredPrecision; scale = desiredScale; } } } ptr.set(PDataType.DECIMAL.toBytes(result)); return true; }</code><technical_language>for other arithmetic expressions</technical_language>

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { BigDecimal result = null; for (int i=0; i<children.size(); i++) { Expression childExpr = children.get(i); if (!childExpr.evaluate(tuple, ptr)) { return false; } if (ptr.getLength() == 0) { return true; } PDataType childType = children.get(i).getDataType(); BigDecimal bd= (BigDecimal)PDataType.DECIMAL.toObject(ptr, childType); if (result == null) { result = bd; } else { result = result.divide(bd, PDataType.DEFAULT_MATH_CONTEXT); } } if (maxLength != null && scale != null) { result = NumberUtil.setDecimalWidthAndScale(result, maxLength, scale); } if (result == null) { return false; } ptr.set(PDataType.DECIMAL.toBytes(result)); return true; }
Source:
<code>protected LogSubmitOutcomes doInBackground(Void... params) { try { SqlStorage<DeviceReportRecord> storage = CommCareApplication._().getUserStorage(DeviceReportRecord.class); <START> if (serializeCurrentLogs) { <END> if (!serializeLogs(storage)) { return LogSubmitOutcomes.Error; } } int numberOfLogsToSubmit = storage.getNumRecords(); if (numberOfLogsToSubmit == 0) { return LogSubmitOutcomes.Submitted; } this.beginSubmissionProcess(numberOfLogsToSubmit); ArrayList<Integer> submittedSuccesfullyIds = new ArrayList<>(); ArrayList<DeviceReportRecord> submittedSuccesfully = new ArrayList<>(); submitReports(storage, submittedSuccesfullyIds, submittedSuccesfully); if (!removeLocalReports(storage, submittedSuccesfullyIds, submittedSuccesfully)) { return LogSubmitOutcomes.Serialized; } return checkSubmissionResult(numberOfLogsToSubmit, submittedSuccesfully); } catch (UserStorageClosedException e) { return LogSubmitOutcomes.Error; } }</code><technical_language>nitpicky this 1 if statement</technical_language>

Target:
protected LogSubmitOutcomes doInBackground(Void... params) { try { SqlStorage<DeviceReportRecord> storage = CommCareApplication._().getUserStorage(DeviceReportRecord.class); if (serializeCurrentLogs && !serializeLogs(storage)) { return LogSubmitOutcomes.Error; } int numberOfLogsToSubmit = storage.getNumRecords(); if (numberOfLogsToSubmit == 0) { return LogSubmitOutcomes.Submitted; } this.beginSubmissionProcess(numberOfLogsToSubmit); ArrayList<Integer> submittedSuccesfullyIds = new ArrayList<>(); ArrayList<DeviceReportRecord> submittedSuccesfully = new ArrayList<>(); submitReports(storage, submittedSuccesfullyIds, submittedSuccesfully); if (!removeLocalReports(storage, submittedSuccesfullyIds, submittedSuccesfully)) { return LogSubmitOutcomes.Serialized; } return checkSubmissionResult(numberOfLogsToSubmit, submittedSuccesfully); } catch (UserStorageClosedException e) { return LogSubmitOutcomes.Error; } }