auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void performMerge() { CompletableFuture<StateRequestCommand> blockedStateRequest = createStateRequestFuture(); for (String key : ALL_KEYS) { assertCacheGet(key, PARTITION_0_VAL, p0.getNodes()); assertCacheGet(key, PARTITION_1_VAL, p1.getNodes()); } partition(0).merge(partition(1), false); try { blockedStateRequest.get(60, TimeUnit.SECONDS); } catch (ExecutionException | InterruptedException | TimeoutException e) { <START> throw new IllegalStateException(e); <END> } if (trace) log.trace("crashCacheManager(2)"); TestingUtil.crashCacheManagers(manager(2)); TestingUtil.waitForNoRebalance(cache(0), cache(1), cache(3)); }</code><technical_language>Rethrowing is longer necessary</technical_language>

Target:
protected void performMerge() throws Exception { CompletableFuture<StateRequestCommand> blockedStateRequest = createStateRequestFuture(); for (String key : ALL_KEYS) { assertCacheGet(key, PARTITION_0_VAL, p0.getNodes()); assertCacheGet(key, PARTITION_1_VAL, p1.getNodes()); } partition(0).merge(partition(1), false); blockedStateRequest.get(60, TimeUnit.SECONDS); if (trace) log.trace("crashCacheManager(2)"); TestingUtil.crashCacheManagers(manager(2)); TestingUtil.waitForNoRebalance(cache(0), cache(1), cache(3)); }
Source:
<code>private void checkJobExecution(final int documentationId, final String id) { final RestDocumentationFilter getResultFilter = RestAssuredRestDocumentation.document( "{class-name}/" + documentationId + "/getJobExecution/", Snippets.ID_PATH_PARAM, Snippets.HAL_CONTENT_TYPE_HEADER, Snippets.getJobExecutionResponsePayload(), Snippets.JOB_EXECUTION_LINKS ); final ValidatableResponse validatableResponse = RestAssured .given(this.getRequestSpecification()) .filter(getResultFilter) .when() .port(this.port) .get(JOBS_API + "/{id}/execution", id) .then() .statusCode(Matchers.is(HttpStatus.OK.value())) .contentType(Matchers.is(MediaTypes.HAL_JSON_UTF8_VALUE)) .body(ID_PATH, Matchers.is(id)) .body(CREATED_PATH, Matchers.notNullValue()) .body(UPDATED_PATH, Matchers.notNullValue()); if (this.agentExecution) { validatableResponse .body(HOST_NAME_PATH, Matchers.notNullValue()) .body(PROCESS_ID_PATH, Matchers.nullValue()) .body(CHECK_DELAY_PATH, Matchers.nullValue()) .body(EXIT_CODE_PATH, Matchers.nullValue()); } else { validatableResponse <START> .body(HOST_NAME_PATH, Matchers.is(this.genieHostInfo.getHostname())) <END> .body(PROCESS_ID_PATH, Matchers.notNullValue()) .body(CHECK_DELAY_PATH, Matchers.is((int) CHECK_DELAY)) .body(EXIT_CODE_PATH, Matchers.is(JobExecution.SUCCESS_EXIT_CODE)); } }</code><technical_language>I thought captured process id? is null tests passing for me</technical_language>

Target:
private void checkJobExecution(final int documentationId, final String id) { final RestDocumentationFilter getResultFilter = RestAssuredRestDocumentation.document( "{class-name}/" + documentationId + "/getJobExecution/", Snippets.ID_PATH_PARAM, Snippets.HAL_CONTENT_TYPE_HEADER, Snippets.getJobExecutionResponsePayload(), Snippets.JOB_EXECUTION_LINKS ); final ValidatableResponse validatableResponse = RestAssured .given(this.getRequestSpecification()) .filter(getResultFilter) .when() .port(this.port) .get(JOBS_API + "/{id}/execution", id) .then() .statusCode(Matchers.is(HttpStatus.OK.value())) .contentType(Matchers.is(MediaTypes.HAL_JSON_UTF8_VALUE)) .body(ID_PATH, Matchers.is(id)) .body(CREATED_PATH, Matchers.notNullValue()) .body(UPDATED_PATH, Matchers.notNullValue()) .body(HOST_NAME_PATH, Matchers.is(this.genieHostInfo.getHostname())); if (this.agentExecution) { validatableResponse .body(PROCESS_ID_PATH, Matchers.nullValue()) .body(CHECK_DELAY_PATH, Matchers.nullValue()) .body(EXIT_CODE_PATH, Matchers.nullValue()); } else { validatableResponse .body(PROCESS_ID_PATH, Matchers.notNullValue()) .body(CHECK_DELAY_PATH, Matchers.is((int) CHECK_DELAY)) .body(EXIT_CODE_PATH, Matchers.is(JobExecution.SUCCESS_EXIT_CODE)); } }
Source:
<code>public void setTemporaryFileSuffix(String temporaryFileSuffix) { <START> Assert.hasText(temporaryFileSuffix, "Temporary file suffix provided is non null, non empty"); <END> if(!temporaryFileSuffix.startsWith(".")) { temporaryFileSuffix = "." + temporaryFileSuffix; } this.temporaryFileSuffix = temporaryFileSuffix; }</code><technical_language>Change **The temporary file suffix null empty**</technical_language>

Target:
public void setTemporaryFileSuffix(String temporaryFileSuffix) { Assert.hasText(temporaryFileSuffix, "The temporary file suffix must not be null or empty"); if(!temporaryFileSuffix.startsWith(".")) { temporaryFileSuffix = "." + temporaryFileSuffix; } this.temporaryFileSuffix = temporaryFileSuffix; }
Source:
<code><START> private void initializeCommonFields() { <END> supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); AndroidBeam.disable(this); res = this.getResources(); app = (CgeoApplication) this.getApplication(); Cookies.restoreCookieStore(Settings.getCookieStore()); ActivityMixin.onCreate(this, keepScreenOn); }</code><technical_language>If re-purpose method, change name</technical_language>

Target:
private void initializeCommonFields() { res = this.getResources(); app = (CgeoApplication) this.getApplication(); Cookies.restoreCookieStore(Settings.getCookieStore()); ActivityMixin.onCreate(this, keepScreenOn); }
Source:
<code>public Response registerCronJob(@PathParam("noteId") String noteId, String message) throws IOException, IllegalArgumentException { LOG.info("Register cron job note={} request cron msg={}", noteId, message); ZeppelinConfiguration conf = notebook.getConf(); <START> if (conf.isZeppelinNotebookCronEnable()) { <END> CronRequest request = CronRequest.fromJson(message); Note note = notebook.getNote(noteId); checkIfNoteIsNotNull(note); checkIfUserCanRun(noteId, "Insufficient privileges you cannot set a cron job for this note"); if (!CronExpression.isValidExpression(request.getCronString())) { return new JsonResponse<>(Status.BAD_REQUEST, "wrong cron expressions.").build(); } Map<String, Object> config = note.getConfig(); config.put("cron", request.getCronString()); note.setConfig(config); notebook.refreshCron(note.getId()); return new JsonResponse<>(Status.OK).build(); } else { throw new ForbiddenException("Cron is not enabled from Zeppelin server"); } }</code><technical_language>log a warning I if cron is disabled is register</technical_language>

Target:
public Response registerCronJob(@PathParam("noteId") String noteId, String message) throws IOException, IllegalArgumentException { LOG.info("Register cron job note={} request cron msg={}", noteId, message); CronRequest request = CronRequest.fromJson(message); Note note = notebook.getNote(noteId); checkIfNoteIsNotNull(note); checkIfUserCanRun(noteId, "Insufficient privileges you cannot set a cron job for this note"); checkIfNoteSupportsCron(note); if (!CronExpression.isValidExpression(request.getCronString())) { return new JsonResponse<>(Status.BAD_REQUEST, "wrong cron expressions.").build(); } Map<String, Object> config = note.getConfig(); config.put("cron", request.getCronString()); note.setConfig(config); notebook.refreshCron(note.getId()); return new JsonResponse<>(Status.OK).build(); }
Source:
<code>public CommandAssociatedEntity(Guid commandId, VdcObjectType entityType, Guid entityId) { <START> this.commandId = commandId; <END> setEntityType(entityType); setEntityId(entityId); }</code><technical_language>this c'tor implies entity is immutable. Please assumption for SubjectEntity class introduce a c'tor expect entityType entityId instead of setters</technical_language>

Target:
public CommandAssociatedEntity(Guid commandId, VdcObjectType entityType, Guid entityId) { super(entityType, entityId); this.commandId = commandId; }
Source:
<code>private static <E> View<E> load(JobContext jobContext) { Configuration conf = Hadoop.JobContext.getConfiguration.invoke(jobContext); @SuppressWarnings("unchecked") <START> Class<E> type = (Class<E>)conf.getClass(KITE_TYPE, Object.class); <END> String outputUri = conf.get(KITE_OUTPUT_URI); if (outputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(outputUri, type); }</code><technical_language>This default. is error if user code is expecting object loaded</technical_language>

Target:
private static <E> View<E> load(JobContext jobContext) { Configuration conf = Hadoop.JobContext.getConfiguration.invoke(jobContext); Class<E> type = getType(jobContext); String outputUri = conf.get(KITE_OUTPUT_URI); if (outputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(outputUri, type); }
Source:
<code>private static void extractZipFileToFolder(File zipFile, File destinationFolder) { try { ZipFile zip = new ZipFile(zipFile); destinationFolder.mkdir(); Enumeration zipFileEntries = zip.entries(); while (zipFileEntries.hasMoreElements()) { ZipEntry entry = (ZipEntry) zipFileEntries.nextElement(); String currentEntry = entry.getName(); File destFile = new File(destinationFolder, currentEntry); File destinationParent = destFile.getParentFile(); destinationParent.mkdirs(); if (!entry.isDirectory()) { <START> BufferedInputStream bufferedInputStream = new BufferedInputStream(zip.getInputStream(entry)); <END> int currentByte; byte data[] = new byte[BUFFER_SIZE]; FileOutputStream fileOutputStream = new FileOutputStream(destFile); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream, BUFFER_SIZE); while ((currentByte = bufferedInputStream.read(data, 0, BUFFER_SIZE)) != -1) { bufferedOutputStream.write(data, 0, currentByte); } bufferedOutputStream.flush(); bufferedOutputStream.close(); bufferedInputStream.close(); } } } catch (Exception e) { logger.error(e.getMessage()); } }</code><technical_language>Streams other closeable object (bufferedInputStream, fileOutputStream bufferedOutputStream in this block) handled a [try-with-resources-statement](<LINK_0></technical_language>

Target:
private static void extractZipFileToFolder(File zipFile, File destinationFolder) { try { ZipFile zip = new ZipFile(zipFile); destinationFolder.mkdir(); Enumeration zipFileEntries = zip.entries(); while (zipFileEntries.hasMoreElements()) { ZipEntry entry = (ZipEntry) zipFileEntries.nextElement(); String currentEntry = entry.getName(); File destFile = new File(destinationFolder, currentEntry); File destinationParent = destFile.getParentFile(); destinationParent.mkdirs(); if (!entry.isDirectory()) { int currentByte; byte data[] = new byte[BUFFER_SIZE]; try(BufferedInputStream bufferedInputStream = new BufferedInputStream(zip.getInputStream(entry)); FileOutputStream fileOutputStream = new FileOutputStream(destFile); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(fileOutputStream, BUFFER_SIZE)) { while ((currentByte = bufferedInputStream.read(data, 0, BUFFER_SIZE)) != -1) { bufferedOutputStream.write(data, 0, currentByte); } } } } } catch (Exception e) { logger.error(e.getMessage()); } }
Source:
<code>public void testInvalidUserValidate() throws BugzillaRestException { RepositoryLocation location = new RepositoryLocation(); location.setUrl(actualFixture.getRepositoryUrl()); location.setProxy(null); location.setCredentialsStore(new InMemoryCredentialsStore()); location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("wrong", "wrong")); thrown.expect(BugzillaRestException.class); thrown.expectMessage("Unauthorized"); BugzillaRestClient client; client = new BugzillaRestClient(location, connector); assertNotNull(client.getClient()); <START> assertEquals(true, client.validate(new NullOperationMonitor())); <END> }</code><technical_language>assertTrue</technical_language>

Target:
public void testInvalidUserValidate() throws BugzillaRestException { RepositoryLocation location = new RepositoryLocation(); location.setUrl(actualFixture.getRepositoryUrl()); location.setProxy(null); location.setCredentialsStore(new InMemoryCredentialsStore()); location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("wrong", "wrong")); thrown.expect(BugzillaRestException.class); thrown.expectMessage("Unauthorized"); BugzillaRestClient client; client = new BugzillaRestClient(location, connector); assertNotNull(client.getClient()); assertTrue(client.validate(new NullOperationMonitor())); }
Source:
<code>public void testInetAddressQuery() throws ErrnoException { for (Network network : getTestableNetworks()) { CountDownLatch <START> latch = <END> new CountDownLatch(1); final int TIMEOUT_MS = 12_000; final String dname = "www.google.com"; final AtomicReference<List<InetAddress>> answers = new AtomicReference<>(); mDns.query(network, dname, FLAG_NO_CACHE_LOOKUP, mHandler, answerList -> { answers.set(answerList); for (InetAddress addr : answerList) { Log.d(TAG, "Reported addr:" + addr.toString()); } latch.countDown(); } ); String msg = "InetAddress query " + dname + " but no valid answer after " + TIMEOUT_MS + "ms."; try { assertTrue(msg, latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); assertNotNull("Query for " + dname + " timed out after " + TIMEOUT_MS + "ms", answers.get()); assertGreaterThan("Query for " + dname + " returned 0 results ", answers.get().size(), 0); } catch (InterruptedException e) { } } }</code><technical_language>final? for other places</technical_language>

Target:
public void testInetAddressQuery() throws ErrnoException { final String dname = "www.google.com"; final String msg = "InetAddress query " + dname; for (Network network : getTestableNetworks()) { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<List<InetAddress>> answers = new AtomicReference<>(); mDns.query(network, dname, FLAG_NO_CACHE_LOOKUP, mHandler, answerList -> { answers.set(answerList); for (InetAddress addr : answerList) { Log.d(TAG, "Reported addr:" + addr.toString()); } latch.countDown(); } ); try { assertTrue(msg + " but no valid answer after " + TIMEOUT_MS + "ms.", latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); assertGreaterThan(msg + " returned 0 result", answers.get().size(), 0); } catch (InterruptedException e) { } } }
Source:
<code>public ReadingListPageDiskRow(@NonNull ReadingListPage row) { super(row.key(), row); <START> filename = null; <END> }</code><technical_language>filename is derived page title. considered calling new constructor this(row, filenameAlgorithm(row.title)</technical_language>

Target:
public ReadingListPageDiskRow(@NonNull ReadingListPage row) { super(row.key(), row, null); }
Source:
<code>private static RexNode stripCastFromString(RexNode node, SqlDialect dialect) { switch (node.getKind()) { case EQUALS: case IS_NOT_DISTINCT_FROM: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: final RexCall call = (RexCall) node; final RexNode o0 = call.operands.get(0); final RexNode o1 = call.operands.get(1); if (o0.getKind() == SqlKind.CAST && o1.getKind() != SqlKind.CAST) { if (dialect.castRequiredForStringOperand((RexCall) o0)) { <START> return node; <END> } final RexNode o0b = ((RexCall) o0).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0b, o1)); } if (o1.getKind() == SqlKind.CAST && o0.getKind() != SqlKind.CAST) { if (dialect.castRequiredForStringOperand((RexCall) o1)) { return node; } final RexNode o1b = ((RexCall) o1).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0, o1b)); } } return node; }</code><technical_language>considering if introduce a method SqlDialect#supportImplicitCast, castRequiredForStringOperand a related sql contexts. kinds of sql contexts for implicit type coercion, for STRING type</technical_language>

Target:
private static RexNode stripCastFromString(RexNode node, SqlDialect dialect) { switch (node.getKind()) { case EQUALS: case IS_NOT_DISTINCT_FROM: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: final RexCall call = (RexCall) node; final RexNode o0 = call.operands.get(0); final RexNode o1 = call.operands.get(1); if (o0.getKind() == SqlKind.CAST && o1.getKind() != SqlKind.CAST) { if (!dialect.supportsImplicitTypeCoercion((RexCall) o0)) { return node; } final RexNode o0b = ((RexCall) o0).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0b, o1)); } if (o1.getKind() == SqlKind.CAST && o0.getKind() != SqlKind.CAST) { if (!dialect.supportsImplicitTypeCoercion((RexCall) o1)) { return node; } final RexNode o1b = ((RexCall) o1).getOperands().get(0); return call.clone(call.getType(), ImmutableList.of(o0, o1b)); } } return node; }
Source:
<code>protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); <START> if (getParameters().isDetailRequired() && StringUtils.isNotEmpty(volumeName)) { <END> executeAndSetReturnValue(volumeName); return; } VDSReturnValue nfsReturnValue = null; VDSReturnValue replicateReturnValue = null; GlusterVolumeEntity nfsReplicateVolume = getNfsReplicateVolume(getParameters().getClusterId()); if (nfsReplicateVolume != null) { executeAndSetReturnValue(nfsReplicateVolume.getName()); return; } GlusterVolumeEntity nfsVolume = getNfsVolume(getParameters().getClusterId()); GlusterVolumeEntity replicateVolume = getReplicateVolume(getParameters().getClusterId()); if (nfsVolume == null && replicateVolume == null) { log.error("To get service details, no Nfs or Replicated volumes found in the cluster."); getQueryReturnValue().setReturnValue(new GlusterVolumeAdvancedDetails()); return; } if (nfsVolume != null) { nfsReturnValue = executeCommand(nfsVolume.getName()); } if (replicateVolume != null) { replicateReturnValue = executeCommand(replicateVolume.getName()); } if (nfsReturnValue != null && replicateReturnValue != null) { GlusterVolumeAdvancedDetails volumeAdvancedDetailsForNfs = (GlusterVolumeAdvancedDetails) nfsReturnValue.getReturnValue(); GlusterVolumeAdvancedDetails volumeAdvancedDetailsForShd = (GlusterVolumeAdvancedDetails) replicateReturnValue.getReturnValue(); volumeAdvancedDetailsForNfs.getServiceInfo().addAll(volumeAdvancedDetailsForShd.getServiceInfo()); getQueryReturnValue().setReturnValue(volumeAdvancedDetailsForNfs); } else if (nfsReturnValue == null && replicateReturnValue != null) { getQueryReturnValue().setReturnValue(replicateReturnValue.getReturnValue()); } else if (nfsReturnValue != null && replicateVolume == null) { getQueryReturnValue().setReturnValue(nfsReturnValue.getReturnValue()); } }</code><technical_language>if caller sets isDetailsRequired() = false, I fetch service details of volume return it. I this if condition need check for getParameters().isDetailRequired()</technical_language>

Target:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); if (StringUtils.isNotEmpty(volumeName)) { fetchAdvancedDetails(volumeName); return; } getServiceInfo(); }
Source:
<code>public List<DataType> create(final DataType record, final DataType reference, final CreationType creationType) { switch (creationType) { case ABOVE: return dataTypeCreateHandler.insertAbove(record, reference, itemDefinitionCreateHandler.insertItemDefinitionAbove(reference)); case BELOW: return dataTypeCreateHandler.insertBelow(record, reference, itemDefinitionCreateHandler.insertItemDefinitionBelow(reference)); case NESTED: return dataTypeCreateHandler.insertNested(record, reference, itemDefinitionCreateHandler.insertNestedItemDefinition(reference)); default: <START> throw new UnsupportedOperationException("The 'CreationType' " + creationType + " is not supported"); <END> } }</code><technical_language>covered this case</technical_language>

Target:
public List<DataType> create(final DataType record, final DataType reference, final CreationType creationType) { if (creationType == NESTED) { final ItemDefinition nestedItemDefinition = itemDefinitionCreateHandler.insertNestedItemDefinition(reference); return dataTypeCreateHandler.insertNested(record, reference, nestedItemDefinition); } else { final ItemDefinition itemDefinition = itemDefinitionCreateHandler.insertItemDefinition(reference, creationType); return dataTypeCreateHandler.insert(record, reference, creationType, itemDefinition); } }
Source:
<code>public Builder withTeam(String team) { <START> studentAttributes.team = team; <END> return this; }</code><technical_language>Similar question: is null parameter handled here</technical_language>

Target:
public Builder withTeam(String team) { if (team != null) { studentAttributes.team = team; } return this; }
Source:
<code>private void setLocation(final String location) { if (location != null) { try { this.location = PointType.valueOf(location); } catch (IllegalArgumentException e) { <START> logger.warn("Could not set new location, keeping old one: ", e); <END> } } }</code><technical_language>stacktrace is pretty boring. left out intentionally (although due missing placeholder wrong). nice user great: java logger.warn("Could set new location {}, keeping one: {}", location, e.getMessage());</technical_language>

Target:
private void setLocation(final String location) { if (location != null) { try { this.location = PointType.valueOf(location); } catch (IllegalArgumentException e) { logger.warn("Could not set new location, keeping old one: ", location, e.getMessage()); } } }
Source:
<code>@Override public boolean isDisposed() { <START> return inner == null; <END> }</code><technical_language>get(). (Btw is plain, this check end hoisted turning null)</technical_language>

Target:
@Override public boolean isDisposed() { return get(); }
Source:
<code>private void returnToSiteList() { try { Intent intent = new Intent(this, Class.forName("com.dozuki.ifixit.ui.dozuki.SiteListActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } catch (ClassNotFoundException e) { <START> Log.e("BaseMenuDrawerActivity", "Cannot start SiteListActivity", e); <END> } }</code><technical_language>I throw a toast user if this happens. shouldn't, if good notify</technical_language>

Target:
private void returnToSiteList() { try { Intent intent = new Intent(this, Class.forName("com.dozuki.ifixit.ui.dozuki.SiteListActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } catch (ClassNotFoundException e) { Toast.makeText(this, "Failed to return to site list.", Toast.LENGTH_SHORT).show(); Log.e("BaseMenuDrawerActivity", "Cannot start SiteListActivity", e); } }
Source:
<code>public OriginIdElement(String id) { <START> this.id = id; <END> }</code><technical_language>Missing StringUtils.isNotNullOrEmpty() check</technical_language>

Target:
public OriginIdElement(String id) { super(id); }
Source:
<code>public void initialise() { WidgetUtil.trySubscribe(this, "close", button -> triggerBackAnimation() ); WidgetUtil.trySubscribe(this, "play", button -> { GameManifest gameManifest = new GameManifest(); gameManifest.setTitle(universeWrapper.getGameName()); DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry()); ResolutionResult result = resolver.resolve(config.getDefaultModSelection().listModules()); if (!result.isSuccess()) { MessagePopup errorMessagePopup = getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class); if (errorMessagePopup != null) { errorMessagePopup.setMessage("Invalid Module Selection", "Please review your module seleciton and try again"); } return; } for (Module module : result.getModules()) { gameManifest.addModule(module.getId(), module.getVersion()); } SimpleUri uri = world.getWorldGeneratorInfo().getUri(); <START> float timeOffset = 0.25f + 0.025f; <END> WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, world.getWorldGenerator().getWorldSeed(), (long) (WorldTime.DAY_LENGTH * timeOffset), uri); gameManifest.addWorld(worldInfo); gameEngine.changeState(new StateLoading(gameManifest, (universeWrapper.getLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE)); }); }</code><technical_language>Magic numbers? idea extract info a constant explain number means</technical_language>

Target:
public void initialise() { WidgetUtil.trySubscribe(this, "close", button -> triggerBackAnimation() ); WidgetUtil.trySubscribe(this, "play", button -> { GameManifest gameManifest = new GameManifest(); gameManifest.setTitle(universeWrapper.getGameName()); DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry()); ResolutionResult result = resolver.resolve(config.getDefaultModSelection().listModules()); if (!result.isSuccess()) { MessagePopup errorMessagePopup = getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class); if (errorMessagePopup != null) { errorMessagePopup.setMessage("Invalid Module Selection", "Please review your module seleciton and try again"); } return; } for (Module module : result.getModules()) { gameManifest.addModule(module.getId(), module.getVersion()); } SimpleUri uri = world.getWorldGeneratorInfo().getUri(); float timeOffset = 0.50f; WorldInfo worldInfo = new WorldInfo(TerasologyConstants.MAIN_WORLD, world.getWorldGenerator().getWorldSeed(), (long) (WorldTime.DAY_LENGTH * timeOffset), uri); gameManifest.addWorld(worldInfo); gameEngine.changeState(new StateLoading(gameManifest, (universeWrapper.getLoadingAsServer()) ? NetworkMode.DEDICATED_SERVER : NetworkMode.NONE)); }); }
Source:
<code>public <R extends HttpRequest> R bindToRequest(R request, Object input) { <START> Set<String> tags = Set.class.cast(checkNotNull(input, "parameters")); <END> request.setPayload(buildJson(tags)); return request; }</code><technical_language>Do need a checkArgument input here, do a set? checkNotNull(input, "input")</technical_language>

Target:
public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(input instanceof Set); Set<String> tags = Set.class.cast(checkNotNull(input, "input")); request.setPayload(buildJson(tags)); return request; }
Source:
<code>public static List<File> compile(List<File> files, File outDir, boolean includeDebugInfo) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (compiler == null) { <START> LOG.error("Can not find compiler, please use JDK instead"); <END> return Collections.emptyList(); } StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files); StaticFileManager staticFileManager = new StaticFileManager(fileManager, outDir); List<String> options = new ArrayList<>(); options.add(includeDebugInfo ? "-g" : "-g:none"); options.addAll(COMMON_ARGS); CompilationTask task = compiler.getTask(null, staticFileManager, null, options, null, compilationUnits); Boolean result = task.call(); fileManager.close(); if (Boolean.TRUE.equals(result)) { return staticFileManager.outputFiles(); } return Collections.emptyList(); }</code><technical_language>Please throw exception instead of logging, assert error raise a reason</technical_language>

Target:
public static List<File> compile(List<File> files, File outDir, boolean includeDebugInfo) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); if (compiler == null) { throw new IllegalStateException("Can not find compiler, please use JDK instead"); } StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(files); StaticFileManager staticFileManager = new StaticFileManager(fileManager, outDir); List<String> options = new ArrayList<>(); options.add(includeDebugInfo ? "-g" : "-g:none"); options.addAll(COMMON_ARGS); CompilationTask task = compiler.getTask(null, staticFileManager, null, options, null, compilationUnits); Boolean result = task.call(); fileManager.close(); if (Boolean.TRUE.equals(result)) { return staticFileManager.outputFiles(); } return Collections.emptyList(); }
Source:
<code>private void handleWidgetDispose(Event e) { <START> if (e.widget == widget) { <END> if (action.getStyle() == IAction.AS_DROP_DOWN_MENU && menuCreatorCalled) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { mc.dispose(); } } action.removePropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.removePropertyChangeListener(commandId, actionTextListener); } } widget = null; disposeOldImages(); } }</code><technical_language>here? if (e.widget != widget) { return; // for us. } I occur</technical_language>

Target:
private void handleWidgetDispose(Event e) { if (e.widget != widget) { return; } if (action.getStyle() == IAction.AS_DROP_DOWN_MENU && menuCreatorCalled) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { mc.dispose(); } } action.removePropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager.getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.removePropertyChangeListener(commandId, actionTextListener); } } widget = null; disposeOldImages(); }
Source:
<code><START> public ChangedLines changedLines(Provider<ReviewDb> db, <END> PatchListCache cache) throws OrmException { if (currentFiles == null) { Change c = change(db); if (c == null) { return null; } PatchSet ps = currentPatchSet(db); if (ps == null) { return null; } changedLines = new ChangedLines(); PatchList p; try { p = cache.get(c, ps); } catch (PatchListNotAvailableException e) { return changedLines; } for (PatchListEntry e : p.getPatches()) { if (Patch.COMMIT_MSG.equals(e.getNewName())) { continue; } changedLines.insertions += e.getInsertions(); changedLines.deletions += e.getDeletions(); } } return changedLines; }</code><technical_language>this cheaper serialize ChangedLines secondary index other properties stored for Change. This open idea of index operators for size of change search for changes impacting < 500 lines for example. I find operator useful I 10 minutes for a code review for "cheap" work on</technical_language>

Target:
public ChangedLines changedLines(Provider<ReviewDb> db, PatchListCache cache) throws OrmException { if (changedLines == null) { Change c = change(db); if (c == null) { return null; } PatchSet ps = currentPatchSet(db); if (ps == null) { return null; } PatchList p; try { p = cache.get(c, ps); } catch (PatchListNotAvailableException e) { return null; } changedLines = new ChangedLines(p.getInsertions(), p.getDeletions()); for (PatchListEntry e : p.getPatches()) { if (Patch.COMMIT_MSG.equals(e.getNewName())) { continue; } } } return changedLines; }
Source:
<code>private void readRecoveredChannelState() throws IOException, InterruptedException { ChannelStateReader reader = getEnvironment().getTaskStateManager().getChannelStateReader(); if (!reader.hasChannelStates()) { requestPartitions(); return; } ResultPartitionWriter[] writers = getEnvironment().getAllWriters(); if (writers != null) { for (ResultPartitionWriter writer : writers) { if (writer instanceof CheckpointedResultPartition) { ((CheckpointedResultPartition) writer).readRecoveredState(reader); } else { throw new IllegalStateException( "Cannot restore state to a non-checkpointable partition type: " + writer); } } <START> if (!recordWriter.isAvailable()) { MailboxDefaultAction.Suspension suspendedDefaultAction = mailboxProcessor.suspendDefaultAction(); getInputOutputJointFuture(InputStatus.NOTHING_AVAILABLE).thenRun(suspendedDefaultAction::resume); } <END> } InputGate[] inputGates = getEnvironment().getAllInputGates(); if (inputGates != null && inputGates.length > 0) { CompletableFuture[] futures = new CompletableFuture[inputGates.length]; for (int i = 0; i < inputGates.length; i++) { futures[i] = inputGates[i].readRecoveredState(channelIOExecutor, reader); } CompletableFuture.allOf(futures).thenRun(() -> mainMailboxExecutor.execute( this::requestPartitions, "Input gates request partitions")); } }</code><technical_language>purpose of this change? Is working? if getInputOutputJointFuture returns completed future, unavailable input recovery? Also, missing a test coverage</technical_language>

Target:
private void readRecoveredChannelState() throws IOException, InterruptedException { ChannelStateReader reader = getEnvironment().getTaskStateManager().getChannelStateReader(); if (!reader.hasChannelStates()) { requestPartitions(); return; } ResultPartitionWriter[] writers = getEnvironment().getAllWriters(); if (writers != null) { for (ResultPartitionWriter writer : writers) { if (writer instanceof CheckpointedResultPartition) { ((CheckpointedResultPartition) writer).readRecoveredState(reader); } else { throw new IllegalStateException( "Cannot restore state to a non-checkpointable partition type: " + writer); } } } InputGate[] inputGates = getEnvironment().getAllInputGates(); if (inputGates != null && inputGates.length > 0) { CompletableFuture[] futures = new CompletableFuture[inputGates.length]; for (int i = 0; i < inputGates.length; i++) { futures[i] = inputGates[i].readRecoveredState(channelIOExecutor, reader); } CompletableFuture.allOf(futures).thenRun(() -> mainMailboxExecutor.execute( this::requestPartitions, "Input gates request partitions")); } }
Source:
<code><START> public static String getClientIp(final String ip, final String xff) { <END> if (xff == null || xff.isEmpty() || xff.equals("-")) { return ip; } else { String[] proxiedIps = (xff + "," + ip).split(","); String lastKnownGoodIp = ""; for (int i=proxiedIps.length-1;i>=0;i--) { String proxiedIp = proxiedIps[i].trim(); if (InetAddressValidator.getInstance().isValid(proxiedIp)) { lastKnownGoodIp = proxiedIp; if ((! isSpecialAddress(proxiedIp)) && (! isTrustedProxy(proxiedIp))) { return lastKnownGoodIp; } } else { return lastKnownGoodIp; } } return lastKnownGoodIp; } }</code><technical_language>This method returns scattered place. This increases control flow complexity unneededly</technical_language>

Target:
public static String getClientIp(final String ip, final String xff) { String ret = null; String sanitizedIp = sanitizeIp(ip); if (sanitizedIp != null) { ret = sanitizedIp; if (isTrustedProxy(ret) && xff != null) { String[] xffIps = xff.split(","); Collections.reverse(Arrays.asList(xffIps)); for (String xffIp : xffIps) { sanitizedIp = sanitizeIp(xffIp); if (sanitizedIp == null) { break; } ret = sanitizedIp; if (!isTrustedProxy(ret)) { break; } } } } return ret; }
Source:
<code><START> public List<Integer> getLineToOffset() { <END> return lineToOffset; }</code><technical_language>public? package-private if this is test-only</technical_language>

Target:
List<Integer> getLineToOffset() { return lineToOffset; }
Source:
<code>private void updatePath() { mPath.reset(); mBorderPath.reset(); mTempRect.set(getBounds()); mTempRect.inset(mBorderWidth/2, mBorderWidth/2); if (mIsCircle) { <START> mBorderPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), Math.min(mTempRect.width(), mTempRect.height())/2, Path.Direction.CW); <END> } else { mBorderRadii[0] = mRadii[0] + mPadding - mBorderWidth/2; mBorderRadii[1] = mRadii[1] + mPadding - mBorderWidth/2; mBorderRadii[2] = mRadii[2] + mPadding - mBorderWidth/2; mBorderRadii[3] = mRadii[3] + mPadding - mBorderWidth/2; mBorderRadii[4] = mRadii[4] + mPadding - mBorderWidth/2; mBorderRadii[5] = mRadii[5] + mPadding - mBorderWidth/2; mBorderRadii[6] = mRadii[6] + mPadding - mBorderWidth/2; mBorderRadii[7] = mRadii[7] + mPadding - mBorderWidth/2; mBorderPath.addRoundRect(mTempRect, mBorderRadii, Path.Direction.CW); } mTempRect.inset(-mBorderWidth/2, -mBorderWidth/2); mTempRect.inset(mPadding, mPadding); if (mIsCircle) { float radius = Math.min(mTempRect.width(), mTempRect.height())/2; mPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), radius, Path.Direction.CW); } else { mPath.addRoundRect(mTempRect, mRadii, Path.Direction.CW); } mTempRect.inset(-mPadding, -mPadding); }</code><technical_language>If fit 100 characters, argument in a separate line please. Alternatively, I find more readable a temporary variable (float radius) below</technical_language>

Target:
private void updatePath() { mPath.reset(); mBorderPath.reset(); mTempRect.set(getBounds()); mTempRect.inset(mBorderWidth/2, mBorderWidth/2); if (mIsCircle) { float radius = Math.min(mTempRect.width(), mTempRect.height())/2; mBorderPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), radius, Path.Direction.CW); } else { for (int i = 0; i < mBorderRadii.length; i++) { mBorderRadii[i] = mRadii[i] + mPadding - mBorderWidth/2; } mBorderPath.addRoundRect(mTempRect, mBorderRadii, Path.Direction.CW); } mTempRect.inset(-mBorderWidth/2, -mBorderWidth/2); mTempRect.inset(mPadding, mPadding); if (mIsCircle) { float radius = Math.min(mTempRect.width(), mTempRect.height())/2; mPath.addCircle(mTempRect.centerX(), mTempRect.centerY(), radius, Path.Direction.CW); } else { mPath.addRoundRect(mTempRect, mRadii, Path.Direction.CW); } mTempRect.inset(-mPadding, -mPadding); }
Source:
<code>public Hosts list() { if (isFiltered()) { <START> throw new WebApplicationException(Response.Status.FORBIDDEN); <END> } ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (appMode == ApplicationMode.GlusterOnly) { return listGlusterOnly(); } else { return listAll(); } }</code><technical_language>1. this error is needed removed (VdcQueryAuthType.User) GetAllHosts query 2. please remove this exception BackendHostResource.get() GetVdsByVdsId admin-only thanks</technical_language>

Target:
public Hosts list() { ApplicationMode appMode = getCurrent().get(ApplicationMode.class); if (appMode == ApplicationMode.GlusterOnly) { return listGlusterOnly(); } else { return listAll(); } }
Source:
<code>protected void runTask() { UpdateProgress progress = UpdateProgress.START; DateTime start = new DateTime().withZone(DateTimeZone.UTC).minus(back); DateTime end = new DateTime().withZone(DateTimeZone.UTC).plus(forward); <START> while (end.isAfter(start.plusDays(1))) { <END> progress = progress.reduce(equivalateSchedule(start, start.plusDays(1))); start = start.plusDays(1); } progress = progress.reduce(equivalateSchedule(start, end)); reportStatus(String.format("Finished. %d Items processed, %d failed", progress.getProcessed(), progress.getFailures())); }</code><technical_language>consider a DayRangeGenerator</technical_language>

Target:
protected void runTask() { UpdateProgress progress = UpdateProgress.START; DayRange range = new DayRangeGenerator() .withLookBack(back) .withLookAhead(forward) .generate(new LocalDate()); Iterator<LocalDate> dayIterator = range.iterator(); LocalDate start, end; while(dayIterator.hasNext()) { start = dayIterator.next(); end = start.plusDays(1); progress = progress.reduce(equivalateSchedule(start, end)); } reportStatus(String.format("Finished. %d Items processed, %d failed", progress.getProcessed(), progress.getFailures())); }
Source:
<code>private void deactivate() { if (activePatchSetId != -1) { PatchSetComplexDisclosurePanel patchSetPanel = patchSetPanels.get(activePatchSetId); <START> if (patchSetPanel != null) { <END> patchSetPanel.setActive(false); } activePatchSetId = -1; } }</code><technical_language>I reproduce this failure. update commit message explain condition a panel, should</technical_language>

Target:
private void deactivate() { if (activePatchSetId != -1) { PatchSetComplexDisclosurePanel patchSetPanel = patchSetPanels.get(activePatchSetId); patchSetPanel.setActive(false); activePatchSetId = -1; } }
Source:
<code>protected void loadInterstitial(Context context, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> map0, Map<String, String> serverExtras) { try { mMoPubListener = customEventInterstitialListener; sHandler = new Handler(Looper.getMainLooper()); if (context instanceof Activity) { String applicationKey = ""; <START> if (serverExtras.get("applicationKey") != null) { <END> applicationKey = serverExtras.get("applicationKey"); } else if (serverExtras.get("appKey") != null) { applicationKey = serverExtras.get("appKey"); } if (serverExtras.get("isTestEnabled") != null) { isTestEnabled = Boolean.valueOf(serverExtras.get("isTestEnabled")); } if (serverExtras.get("placementName") != null) { placementName = serverExtras.get("placementName"); } onLog("server extras: " + Arrays.toString(serverExtras.entrySet().toArray())); if (!TextUtils.isEmpty(applicationKey)) { initISIronSourceSDK(((Activity) context), applicationKey); if (initState == INIT_SUCCEEDED) { loadISIronSourceSDK(); } } } else { onLog("loadInterstitial must be called on an Activity context"); sHandler.post(new Runnable() { @Override public void run() { if (mMoPubListener != null) { mMoPubListener.onInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } } }); } } catch (Exception e) { onLog(e.toString()); sHandler.post(new Runnable() { @Override public void run() { if (mMoPubListener != null) { mMoPubListener.onInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } } }); } }</code><technical_language>@artemkuzmenko serverExtras null here</technical_language>

Target:
protected void loadInterstitial(Context context, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> map0, Map<String, String> serverExtras) { try { mMoPubListener = customEventInterstitialListener; sHandler = new Handler(Looper.getMainLooper()); if (!(context instanceof Activity)) { onLog("loadInterstitial must be called on an Activity context"); sendMoPubInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); return; } String applicationKey = ""; mInstanceId = "0"; if (serverExtras != null) { if (serverExtras.get(APPLICATION_KEY) != null) { applicationKey = serverExtras.get(APPLICATION_KEY); } else if (serverExtras.get(APP_KEY) != null) { applicationKey = serverExtras.get(APP_KEY); } if (serverExtras.get(TEST_ENABLED_KEY) != null) { mIsTestEnabled = Boolean.valueOf(serverExtras.get(TEST_ENABLED_KEY)); } if (serverExtras.get(PLACEMENT_KEY) != null) { mPlacementName = serverExtras.get(PLACEMENT_KEY); } if (serverExtras.get(INSTANCE_ID_KEY) != null) { mInstanceId = serverExtras.get(INSTANCE_ID_KEY); } onLog("server extras: " + Arrays.toString(serverExtras.entrySet().toArray())); } if (!TextUtils.isEmpty(applicationKey)) { initIronSourceSDK(((Activity) context), applicationKey); if (mInitInterstitialSuccessfully) { loadInterstitial(); } } else { onLog("Initialization Failed, make sure that 'applicationKey' server parameter is added"); sendMoPubInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } } catch (Exception e) { onLog(e.toString()); sendMoPubInterstitialFailed(MoPubErrorCode.INTERNAL_ERROR); } }
Source:
<code><START> private SortedMap<LockDescriptor, LockMode> generateDescriptorMap(int numLocks, int descriptorSize) { <END> ImmutableSortedMap.Builder<LockDescriptor, LockMode> builder = ImmutableSortedMap.naturalOrder(); generateDescriptors(numLocks, descriptorSize).forEach(descriptor -> builder.put(descriptor, LockMode.WRITE)); return builder.build(); }</code><technical_language>a fan</technical_language>

Target:
private SortedMap<LockDescriptor, LockMode> generateDescriptorMap(int numLocks, int descriptorSize) { return generateDescriptors(numLocks, descriptorSize).collect(ImmutableSortedMap .toImmutableSortedMap(Comparator.naturalOrder(), descriptor -> descriptor, no -> LockMode.WRITE)); }
Source:
<code>protected int doWork() { IOUtil.assertFileIsWritable(UMI_METRICS_FILE); final int retval = super.doWork(); final MetricsFile<UmiMetrics, Double> metricsFile = getMetricsFile(); <START> for (final Map.Entry<String, UmiMetrics> metric : metrics.entrySet()) { <END> metricsFile.addMetric(metric.getValue()); } metricsFile.write(UMI_METRICS_FILE); return retval; }</code><technical_language>before, metrics.values() entry's key used</technical_language>

Target:
protected int doWork() { IOUtil.assertFileIsWritable(UMI_METRICS_FILE); final int retval = super.doWork(); final MetricsFile<UmiMetrics, Double> metricsFile = getMetricsFile(); for (final UmiMetrics metric : metrics.values()) { metricsFile.addMetric(metric); } metricsFile.write(UMI_METRICS_FILE); return retval; }
Source:
<code>private EC2 mockEnvironment() { final Work work = Mockito.mock(Work.class); final Wallet wallet = Mockito.mock(Wallet.class); final EC2Client client = Mockito.mock(EC2Client.class); final AmazonEC2 aws = Mockito.mock(AmazonEC2.class); final RunInstancesResult result = Mockito.mock(RunInstancesResult.class); final Reservation reservation = Mockito.mock(Reservation.class); final Instance instance = Mockito.mock(Instance.class); <START> final List<Instance> instances = <END> Arrays.asList(instance); Mockito.when( client.get() ).thenReturn(aws); Mockito.when( aws.runInstances( Mockito.any(RunInstancesRequest.class) ) ).thenReturn(result); Mockito.when( result.getReservation() ).thenReturn(reservation); Mockito.when(reservation.getInstances()) .thenReturn(instances); Mockito.when( instance.getInstanceId() ).thenReturn("InstanceId"); Mockito.when( work.unit() ).thenReturn("Unit"); Mockito.when( work.owner() ).thenReturn(new URN()); Mockito.when( work.scheduled() ).thenReturn(new Time()); final EC2 envs = new EC2(work, wallet, "type", "image", "group", "par", client); return envs; }</code><technical_language>I formatting of this line lines below. breaking multiple lines while fit line? code unreadable</technical_language>

Target:
private EC2 mockEnvironment() { final Work work = Mockito.mock(Work.class); final Wallet wallet = Mockito.mock(Wallet.class); final EC2Client client = Mockito.mock(EC2Client.class); final AmazonEC2 aws = Mockito.mock(AmazonEC2.class); final RunInstancesResult result = Mockito.mock(RunInstancesResult.class); final Reservation reservation = Mockito.mock(Reservation.class); final Instance instance = Mockito.mock(Instance.class); final List<Instance> instances = Arrays.asList(instance); Mockito.when(client.get()).thenReturn(aws); Mockito.when(aws.runInstances(Mockito.any(RunInstancesRequest.class))) .thenReturn(result); Mockito.when(result.getReservation()).thenReturn(reservation); Mockito.when(reservation.getInstances()).thenReturn(instances); Mockito.when(instance.getInstanceId()).thenReturn("InstanceId"); Mockito.when(work.owner()).thenReturn(new URN()); Mockito.when(work.scheduled()).thenReturn(new Time()); final EC2 envs = new EC2( work, wallet, "type", "ami-ef9f2f1e", "group", "par", "eu-west-123t", client); return envs; }
Source:
<code>private void copyDataToTmpTable(SQLiteDatabase db, Cursor c, int version) { if (c != null) { while (c.moveToNext()) { ContentValues cv = new ContentValues(); copyApnValuesV17(cv, c); if <START> (version > 23) { <END> getNetworkTypeBitmaskFromCursor(cv, c); } try { db.insertWithOnConflict(CARRIERS_TABLE_TMP, null, cv, SQLiteDatabase.CONFLICT_ABORT); if (VDBG) { log("dbh.copyPreservedApnsToNewTable: db.insert returned >= 0; " + "insert successful for cv " + cv); } } catch (SQLException e) { if (VDBG) log("dbh.copyPreservedApnsToNewTable insertWithOnConflict exception " + e + " for cv " + cv); } } } }</code><technical_language>Why? This done independent of version db is newly created columns, no</technical_language>

Target:
private void copyDataToTmpTable(SQLiteDatabase db, Cursor c, int version) { if (c != null) { while (c.moveToNext()) { ContentValues cv = new ContentValues(); copyApnValuesV17(cv, c); getNetworkTypeBitmaskFromCursor(cv, c); try { db.insertWithOnConflict(CARRIERS_TABLE_TMP, null, cv, SQLiteDatabase.CONFLICT_ABORT); if (VDBG) { log("dbh.copyPreservedApnsToNewTable: db.insert returned >= 0; " + "insert successful for cv " + cv); } } catch (SQLException e) { if (VDBG) log("dbh.copyPreservedApnsToNewTable insertWithOnConflict exception " + e + " for cv " + cv); } } } }