auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean exists() { try { getWrappedElement().isDisplayed(); <START> return true; <END> } catch (NoSuchElementException ignored) { return false; } }</code><technical_language>do return true end of method</technical_language>

Target:
public boolean exists() { try { getWrappedElement().isDisplayed(); } catch (NoSuchElementException ignored) { return false; } return true; }
Source:
<code>protected NonEmptyImmutableList(@Nonnull T head, @Nonnull final ImmutableList<T> tail) { super(tail.length + 1); this.head = head; this.tail = tail; <START> this.hashCode = HashCodeBuilder.put(tail.hashCode(), head); <END> }</code><technical_language>compute this lazily hashCode is called, cache in instance field</technical_language>

Target:
protected NonEmptyImmutableList(@Nonnull T head, @Nonnull final ImmutableList<T> tail) { super(tail.length + 1); this.head = head; this.tail = tail; }
Source:
<code>public IncompleteFormListAdapter(Context context, AndroidCommCarePlatform platform, FormRecordLoaderTask loader) { this.context = context; this.filter = null; this.loader = loader; observers = new ArrayList<>(); names = new Hashtable<>(); loader.addListener(this); for (Suite s : platform.getInstalledSuites()) { for (Enumeration en = s.getEntries().elements(); en.hasMoreElements(); ) { Entry entry = (Entry) en.nextElement(); <START> if (entry instanceof FormEntry) { <END> String namespace = ((FormEntry)entry).getXFormNamespace(); if(namespace != null) { names.put(namespace, entry.getText()); } } } } }</code><technical_language>This line if (!entry.isView()) {</technical_language>

Target:
public IncompleteFormListAdapter(Context context, AndroidCommCarePlatform platform, FormRecordLoaderTask loader) { this.context = context; this.filter = null; this.loader = loader; observers = new ArrayList<>(); names = new Hashtable<>(); loader.addListener(this); for (Suite s : platform.getInstalledSuites()) { for (Enumeration en = s.getEntries().elements(); en.hasMoreElements(); ) { Entry entry = (Entry) en.nextElement(); if (!entry.isView()) { String namespace = ((FormEntry)entry).getXFormNamespace(); if(namespace != null) { names.put(namespace, entry.getText()); } } } } }
Source:
<code>public void testNullFieldMetadataDebugLogging() throws NoSuchFieldException, IllegalAccessException, IOException { Path testFile = new Path("target/test/metadata_debug_log_bug.parquet"); Configuration conf = new Configuration(); deleteFile(testFile, conf); createTestFile(testFile, conf); Field debugFlag = Log.class.getField("DEBUG"); Field modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); <START> modifiersField.setInt(debugFlag, debugFlag.getModifiers() & ~Modifier.FINAL); <END> debugFlag.set(null, true); ParquetReader<Group> reader = ParquetReader.builder(new GroupReadSupport(), testFile).withConf(conf).build(); deleteFile(testFile, conf); }</code><technical_language>Is necessary turn debug logging this? test method call is failing? I is conversion of Parquet metadata object JSON. simplify this test avoid reflection changes</technical_language>

Target:
public void testNullFieldMetadataDebugLogging() throws NoSuchFieldException, IllegalAccessException, IOException { MessageType schema = parseMessageType("message test { optional binary some_null_field; }"); org.apache.parquet.hadoop.metadata.FileMetaData fileMetaData = new org.apache.parquet.hadoop.metadata.FileMetaData(schema, new HashMap<String, String>(), null); List<BlockMetaData> blockMetaDataList = new ArrayList<BlockMetaData>(); BlockMetaData blockMetaData = new BlockMetaData(); blockMetaData.addColumn(createColumnChunkMetaData()); blockMetaDataList.add(blockMetaData); ParquetMetadata metadata = new ParquetMetadata(fileMetaData, blockMetaDataList); ParquetMetadata.toJSON(metadata); }
Source:
<code>public CustomFormModel(final String modelId, final CustomFormModelStatus modelStatus, final OffsetDateTime requestedOn, final OffsetDateTime completedOn, final List<CustomFormSubmodel> submodels, final List<FormRecognizerError> modelError, final List<TrainingDocumentInfo> trainingDocuments) { this.modelId = modelId; this.modelStatus = modelStatus; this.requestedOn = requestedOn; this.completedOn = completedOn; <START> this.submodels = submodels == null ? null : Collections.unmodifiableList(new ArrayList<>(submodels)); this.modelError = modelError == null ? null : Collections.unmodifiableList(new ArrayList<>(modelError)); this.trainingDocuments = trainingDocuments == null ? null : Collections.unmodifiableList(new ArrayList<>(trainingDocuments)); <END> }</code><technical_language>create a new ArrayList. Do in other places too</technical_language>

Target:
public CustomFormModel(final String modelId, final CustomFormModelStatus modelStatus, final OffsetDateTime requestedOn, final OffsetDateTime completedOn, final List<CustomFormSubmodel> submodels, final List<FormRecognizerError> modelError, final List<TrainingDocumentInfo> trainingDocuments) { this.modelId = modelId; this.modelStatus = modelStatus; this.requestedOn = requestedOn; this.completedOn = completedOn; this.submodels = submodels == null ? null : Collections.unmodifiableList(submodels); this.modelError = modelError == null ? null : Collections.unmodifiableList(modelError); this.trainingDocuments = trainingDocuments == null ? null : Collections.unmodifiableList(trainingDocuments); }
Source:
<code>protected void deactivate() { if (modelRepo != null) { <START> modelRepo.removeModelRepositoryChangeListener(this); <END> } }</code><technical_language>nice clear sitemapModelCache well</technical_language>

Target:
protected void deactivate() { if (modelRepo != null) { modelRepo.removeModelRepositoryChangeListener(this); } sitemapModelCache.clear(); }
Source:
<code>private void setupXForwardedHeaders(Swagger swagger, Map<String, Object> headers) { String host = (String) headers.get(HEADER_HOST); if(host != null && host.length() > 0) { swagger.setHost(host); } String forwardedPrefix = (String) headers.get(HEADER_X_FORWARDED_PREFIX); if (forwardedPrefix != null && forwardedPrefix.length() > 0) { <START> swagger.setBasePath("/" + forwardedPrefix.replace("/", "") + swagger.getBasePath()); <END> } String forwardedHost = (String) headers.get(HEADER_X_FORWARDED_HOST); if(forwardedHost != null && forwardedHost.length() > 0) { swagger.setHost(forwardedHost); } String proto = (String) headers.get(HEADER_X_FORWARDED_PROTO); if(proto != null && proto.length() > 0) { String[] schemes = proto.split(","); List<Scheme> schs = new ArrayList<>(); for(String scheme : schemes) { String trimmedScheme = scheme.trim(); schs.add(Scheme.forValue(trimmedScheme)); } swagger.setSchemes(schs); } else { swagger.setSchemes(null); } }</code><technical_language>I this lead issues if forwardedPrefix is "a/b" basePath set "ab" is want. logic is idea resulting basePath equal X-Forwarded-Prefix + basePath? like: java String prefixedBasePath = "/" + URISupport.stripPrefix(forwardedPrefix, "/") + "/" URISupport.stripPrefix(swagger.getBasePath(), "/");</technical_language>

Target:
private void setupXForwardedHeaders(Swagger swagger, Map<String, Object> headers) { String host = (String) headers.get(HEADER_HOST); if(ObjectHelper.isNotEmpty(host)) { swagger.setHost(host); } String forwardedPrefix = (String) headers.get(HEADER_X_FORWARDED_PREFIX); if (ObjectHelper.isNotEmpty(forwardedPrefix)) { String prefixedBasePath = "/" + URISupport.stripPrefix(forwardedPrefix, "/") + (!forwardedPrefix.endsWith("/") ? "/" : "") + URISupport.stripPrefix(swagger.getBasePath(), "/"); swagger.setBasePath(prefixedBasePath); } String forwardedHost = (String) headers.get(HEADER_X_FORWARDED_HOST); if(ObjectHelper.isNotEmpty(forwardedHost)) { swagger.setHost(forwardedHost); } String proto = (String) headers.get(HEADER_X_FORWARDED_PROTO); if(ObjectHelper.isNotEmpty(proto)) { String[] schemes = proto.split(","); List<Scheme> schs = new ArrayList<>(); for(String scheme : schemes) { String trimmedScheme = scheme.trim(); schs.add(Scheme.forValue(trimmedScheme)); } swagger.setSchemes(schs); } else { swagger.setSchemes(null); } }
Source:
<code>public synchronized void postModelChanged(IModelDelta delta, boolean select) { if (isDisposed()) { return; } Widget viewerControl = getViewer().getControl(); if (viewerControl == null) { return; } if (select) { for (Iterator<DeltaInfo> itr = fPendingDeltas.iterator(); itr.hasNext();) { if ( itr.next().fSelect ) { itr.remove(); } } } fPendingDeltas.add(new DeltaInfo(select, delta)); if (fFireModelChangedJob == null) { fFireModelChangedJob = new WorkbenchJob(viewerControl.getDisplay(), "Select Breakpoint Job") { { setSystem(true); } @Override public IStatus runInUIThread(IProgressMonitor monitor) { Object[] deltas; synchronized(BreakpointManagerProxy.this) { deltas = fPendingDeltas.toArray(); fPendingDeltas.clear(); fFireModelChangedJob = null; } for (Object <START> delta2 : <END> deltas) { fireModelChanged( ((DeltaInfo)delta2).fDelta ); } return Status.OK_STATUS; } }; fFireModelChangedJob.schedule(); } }</code><technical_language>rename pendingDelta</technical_language>

Target:
public synchronized void postModelChanged(IModelDelta delta, boolean select) { if (isDisposed()) { return; } Widget viewerControl = getViewer().getControl(); if (viewerControl == null) { return; } if (select) { for (Iterator<DeltaInfo> itr = fPendingDeltas.iterator(); itr.hasNext();) { if ( itr.next().fSelect ) { itr.remove(); } } } fPendingDeltas.add(new DeltaInfo(select, delta)); if (fFireModelChangedJob == null) { fFireModelChangedJob = new WorkbenchJob(viewerControl.getDisplay(), "Select Breakpoint Job") { { setSystem(true); } @Override public IStatus runInUIThread(IProgressMonitor monitor) { Object[] deltas; synchronized(BreakpointManagerProxy.this) { deltas = fPendingDeltas.toArray(); fPendingDeltas.clear(); fFireModelChangedJob = null; } for (Object pendingDelta : deltas) { fireModelChanged( ((DeltaInfo)pendingDelta).fDelta ); } return Status.OK_STATUS; } }; fFireModelChangedJob.schedule(); } }
Source:
<code>public String fetchTopSuggestions( @RequestParam(value = "query") String query, @RequestParam(value = "species", required = false, defaultValue = "") String species, @RequestParam(value = "suggestCount", required = false, defaultValue = "20") int suggestCount) { String[] splitSpecies = species.split(","); return GSON.toJson( <START> Arrays.stream(splitSpecies) <END> .map(speciesFactory::create) .flatMap(speciesObject -> suggesterService.fetchBioentitySuggestions( query, speciesObject, suggestCount / splitSpecies.length) .stream()) .collect(toImmutableList())); }</code><technical_language>pass multiple species suggesterService Solr handle processing, in controller</technical_language>

Target:
public String fetchTopSuggestions( @RequestParam(value = "query") String query, @RequestParam(value = "species", required = false, defaultValue = "") String species, @RequestParam(value = "suggestCount", required = false, defaultValue = "20") int suggestCount) { return GSON.toJson(suggesterService.fetchBioentitySuggestions(query, suggestCount, species.split(","))); }
Source:
<code>public BulkLightblueResponse bulkData(AbstractBulkLightblueRequest<AbstractLightblueDataRequest> request) throws LightblueException { <START> long t1 = new Date().getTime(); <END> try { String responseBody = httpTransport.executeRequest(request, configuration.getDataServiceURI()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Response received from service: " + responseBody); long t2 = new Date().getTime(); LOGGER.debug("Call took " + (t2 - t1) + "ms"); } return new BulkLightblueResponse(responseBody, request); } catch (IOException e) { LOGGER.error("There was a problem calling the lightblue service", e); throw new LightblueException("There was a problem calling the lightblue service", null, e); } catch (LightblueResponseParseException e) { throw new LightblueException("There was a problem parsing the response", null, e); } }</code><technical_language>new Date().getTime() -> System.currentTimeMillis()</technical_language>

Target:
public BulkLightblueResponse bulkData(AbstractBulkLightblueRequest<AbstractLightblueDataRequest> request) throws LightblueException { long t1 = System.currentTimeMillis(); try { String responseBody = httpTransport.executeRequest(request, configuration.getDataServiceURI()); LOGGER.debug("Response received from service: {}", responseBody); long t2 = new Date().getTime(); LOGGER.debug("Call took {}ms", t2 - t1); return new BulkLightblueResponse(responseBody, request); } catch (IOException e) { LOGGER.error("There was a problem calling the lightblue service", e); throw new LightblueException("There was a problem calling the lightblue service", null, e); } catch (LightblueResponseParseException e) { throw new LightblueException("There was a problem parsing the response", null, e); } }
Source:
<code><START> public UriPrefixingClientHttpRequestFactory(ClientHttpRequestFactory factory, String hostname, int port, String protocol) { <END> this(factory, UriComponentsBuilder.newInstance().scheme(protocol).host(hostname).port(port).build().toUri()); }</code><technical_language>more need for public, I guess</technical_language>

Target:
UriPrefixingClientHttpRequestFactory(ClientHttpRequestFactory factory, String hostname, int port, String protocol) { this(factory, UriComponentsBuilder.newInstance().scheme(protocol).host(hostname).port(port).build().toUri()); }
Source:
<code>private static BindAxisEvent createNewBindAxisEvent(BindAxisEvent originalEvent) { BindAxisEvent newEvent = null; Class c = originalEvent.getClass(); if (c.equals(ForwardsMovementAxis.class)) { newEvent = new ForwardsMovementAxis(); } else if (c.equals(ForwardsRealMovementAxis.class)) { newEvent = new ForwardsRealMovementAxis(); } else if (c.equals(RotationPitchAxis.class)) { newEvent = new RotationPitchAxis(); } else if (c.equals(RotationYawAxis.class)) { newEvent = new RotationYawAxis(); } else if (c.equals(StrafeMovementAxis.class)) { newEvent = new StrafeMovementAxis(); } else if (c.equals(StrafeRealMovementAxis.class)) { newEvent = new StrafeRealMovementAxis(); } else if (c.equals(VerticalMovementAxis.class)) { newEvent = new VerticalMovementAxis(); } else if (c.equals(VerticalRealMovementAxis.class)) { newEvent = new VerticalRealMovementAxis(); } else { logger.error("ERROR!!! Event not Identified"); <START> } <END> return newEvent; }</code><technical_language>constructor pattern above, class.newInstance instead</technical_language>

Target:
private BindAxisEvent createNewBindAxisEvent(BindAxisEvent originalEvent) { BindAxisEvent newEvent = null; Class eventClass = originalEvent.getClass(); if (eventClass.equals(ForwardsMovementAxis.class)) { newEvent = new ForwardsMovementAxis(); } else if (eventClass.equals(ForwardsRealMovementAxis.class)) { newEvent = new ForwardsRealMovementAxis(); } else if (eventClass.equals(RotationPitchAxis.class)) { newEvent = new RotationPitchAxis(); } else if (eventClass.equals(RotationYawAxis.class)) { newEvent = new RotationYawAxis(); } else if (eventClass.equals(StrafeMovementAxis.class)) { newEvent = new StrafeMovementAxis(); } else if (eventClass.equals(StrafeRealMovementAxis.class)) { newEvent = new StrafeRealMovementAxis(); } else if (eventClass.equals(VerticalMovementAxis.class)) { newEvent = new VerticalMovementAxis(); } else if (eventClass.equals(VerticalRealMovementAxis.class)) { newEvent = new VerticalRealMovementAxis(); } else { logger.error("ERROR!!! Event not Identified"); } return newEvent; }
Source:
<code>boolean removeDelegate(final DataStoreProvider ds) { return delegates.remove(ds); <START> } <END></code><technical_language>sense CompositeDataStoreDelegate DataStoreProvider parameters for add/removeDelegate methods</technical_language>

Target:
boolean removeDelegate(final DataStoreProvider ds) { LOG.info("Removing delegate with role \"{}\"", ds.getRole()); rolesForDelegates.remove(ds.getDataStore()); return delegateHandler.removeDataStore(ds); }
Source:
<code>public HighScores(int[] highScores) { <START> this.highScores = highScores; <END> }</code><technical_language>practice: a defensive copy. suggestion this.highScores = highScores.clone();</technical_language>

Target:
public HighScores(int[] highScores) { this.highScores = highScores.clone(); }
Source:
<code>public boolean isSecretSocketSupported() { <START> return this.newerThanEquals(SPARK_2_3_1) || this.equals(SparkVersion.fromVersionString("2.1.2")); <END> }</code><technical_language>I hardcode this? newerThanEquals(SPARK_2_1_2)</technical_language>

Target:
public boolean isSecretSocketSupported() { return this.newerThanEquals(SPARK_2_3_1); }
Source:
<code>public static <T> Predicate<Location> isChildOf(final Location parent) { return new Predicate<Location>() { @Override <START> public boolean apply(@Nullable Location input) { <END> return Objects.equal(input.getParent(), parent); } }; }</code><technical_language>this _isn't_ @Nullable remove annotation add a guard returns false</technical_language>

Target:
public static <T> Predicate<Location> isChildOf(final Location parent) { return new Predicate<Location>() { @Override public boolean apply(@Nullable Location input) { return (input != null) && Objects.equal(input.getParent(), parent); } }; }
Source:
<code>public String extractPasswordValue(String value) throws IOException { String password = null; <START> if (StringUtils.isNotBlank(value) && value.equals(INTERACTIVE_MODE)) { <END> password = EngineConfigLogic.startPasswordDialog(null); } else { password = EngineConfigLogic.getPassFromFile((StringUtils.isNotBlank(value)) ? value : parser.getAdminPassFile()); } return password; }</code><technical_language>If "equalsIgnoreCase" more user friendly</technical_language>

Target:
public String extractPasswordValue(String value) throws IOException { String password = null; if (StringUtils.isNotBlank(value) && value.equalsIgnoreCase(INTERACTIVE_MODE)) { password = EngineConfigLogic.startPasswordDialog(null); } else { password = EngineConfigLogic.getPassFromFile((StringUtils.isNotBlank(value)) ? value : parser.getAdminPassFile()); } return password; }
Source:
<code>public static void makeInstance() { <START> if (instance == null) { <END> instance = new CameraManager(); } }</code><technical_language>I agree original implementation is counterintuitive, constructor some work & unnecessary do for camera permission. But: stage relies CameraManager a clean state time scene is restarted. implementation do that. Example: Imagine a simple program: started -> Wait 10 sec -> Turn camera start wait camera is turned (CameraManager.wasRunning is set true) restart scene press button pause, resume -> camera is turned instantly wasRunning a false state. more of those, easier implementation completely refactor thing</technical_language>

Target:
public static void makeInstance() { instance = new CameraManager(); }
Source:
<code>private Consul(String url, ClientBuilder builder, ObjectMapper mapper) { if (!builder.getConfiguration().getClasses().stream() <START> .filter(c -> JacksonJaxbJsonProvider.class.isAssignableFrom(c)).findAny().isPresent()) { <END> builder.register(JacksonJaxbJsonProvider.class); } final Client client = builder .register(new ObjectMapperContextResolver(mapper)) .build(); this.agentClient = new AgentClient(client.target(url).path("v1").path("agent")); this.healthClient = new HealthClient(client.target(url).path("v1").path("health")); this.keyValueClient = new KeyValueClient(client.target(url).path("v1").path("kv")); this.catalogClient = new CatalogClient(client.target(url).path("v1").path("catalog")); this.statusClient = new StatusClient(client.target(url).path("v1").path("status")); this.sessionClient = new SessionClient(client.target(url).path("v1").path("session")); this.eventClient = new EventClient(client.target(url).path("v1").path("event")); agentClient.ping(); }</code><technical_language>Yeah, 7 some of applications Orbitz stuck 7</technical_language>

Target:
private Consul(String url, ClientBuilder builder, ObjectMapper mapper) { if (!FluentIterable.from(builder.getConfiguration().getClasses()) .filter(new Predicate<Class<?>>() { @Override public boolean apply(final Class<?> clazz) { return JacksonJaxbJsonProvider.class.isAssignableFrom(clazz); } }).first().isPresent()) { builder.register(JacksonJaxbJsonProvider.class); } final Client client = builder .register(new ObjectMapperContextResolver(mapper)) .build(); this.agentClient = new AgentClient(client.target(url).path("v1").path("agent")); this.healthClient = new HealthClient(client.target(url).path("v1").path("health")); this.keyValueClient = new KeyValueClient(client.target(url).path("v1").path("kv")); this.catalogClient = new CatalogClient(client.target(url).path("v1").path("catalog")); this.statusClient = new StatusClient(client.target(url).path("v1").path("status")); this.sessionClient = new SessionClient(client.target(url).path("v1").path("session")); this.eventClient = new EventClient(client.target(url).path("v1").path("event")); agentClient.ping(); }
Source:
<code>protected Optional<Integer> getVal(Entity container) { if (container instanceof EntityCreeper) { EntityCreeper creeper = (EntityCreeper) container; <START> return Optional.of(creeper.fuseTime); <END> } else if (container instanceof EntityFireworkRocket) { EntityFireworkRocket fireworkRocket = (EntityFireworkRocket) container; return Optional.of(fireworkRocket.lifetime); } else if (container instanceof EntityMinecartTNT) { EntityMinecartTNT tntMinecart = (EntityMinecartTNT) container; return Optional.of(tntMinecart.minecartTNTFuse); } else if (container instanceof EntityTNTPrimed) { EntityTNTPrimed primedTNT = (EntityTNTPrimed) container; return Optional.of(primedTNT.fuse); } return Optional.empty(); }</code><technical_language>This correct, timeSinceIgnited counts _up_ fuse values for creepers. current code, creepers show fuse value, while ignited</technical_language>

Target:
protected Optional<Integer> getVal(Entity container) { if (container instanceof EntityCreeper) { EntityCreeper creeper = (EntityCreeper) container; return Optional.of(creeper.fuseTime - creeper.timeSinceIgnited); } else if (container instanceof EntityFireworkRocket) { EntityFireworkRocket fireworkRocket = (EntityFireworkRocket) container; return Optional.of(fireworkRocket.lifetime - fireworkRocket.fireworkAge); } else if (container instanceof EntityMinecartTNT) { EntityMinecartTNT tntMinecart = (EntityMinecartTNT) container; return Optional.of(tntMinecart.minecartTNTFuse); } else if (container instanceof EntityTNTPrimed) { EntityTNTPrimed primedTNT = (EntityTNTPrimed) container; return Optional.of(primedTNT.fuse); } return Optional.empty(); }
Source:
<code>private ClientRegistration createClientBuilder(String id, AuthorizationProperties authz) { ClientRegistration.Builder result = createClientBuilder(id); List<String> scopes = authz.getScopes(); if (authz.isOnDemand()) { if (!scopes.contains("openid")) { scopes.add("openid"); } if (!scopes.contains("profile")) { scopes.add("profile"); } <START> } <END> result.scope(authz.getScopes()); return result.build(); }</code><technical_language>This is updated yet</technical_language>

Target:
private ClientRegistration createClientBuilder(String id, AuthorizationProperties authz) { ClientRegistration.Builder result = createClientBuilder(id); List<String> scopes = authz.getScopes(); if (authz.isOnDemand()) { if (!scopes.contains("openid")) { scopes.add("openid"); } if (!scopes.contains("profile")) { scopes.add("profile"); } } result.scope(scopes); return result.build(); }
Source:
<code>public void deleteBlob(String blobIdString) throws CoordinatorException { try { logger.trace("deleteBlob. " + blobIdString); long startTimeInMs = System.currentTimeMillis(); BlobId blobId = getBlobIdFromString(blobIdString); DeleteOperation deleteOperation = new DeleteOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs); deleteOperation.execute(); notificationSystem.onBlobDeleted(blobIdString); coordinatorMetrics.deleteBlobOperationRate.mark(); coordinatorMetrics.deleteBlobOperationLatencyInMs.update(System.currentTimeMillis() - startTimeInMs); } catch (CoordinatorException e) { <START> logger.error("deleteBlob re-throwing CoordinatorException" + e); <END> coordinatorMetrics.countError(CoordinatorMetrics.CoordinatorOperationType.DeleteBlob, e.getErrorCode()); throw e; } }</code><technical_language>this log exception twice? Also, want ",e" instead of "+e"</technical_language>

Target:
public void deleteBlob(String blobIdString) throws CoordinatorException { try { logger.trace("deleteBlob. " + blobIdString); long startTimeInMs = System.currentTimeMillis(); BlobId blobId = getBlobIdFromString(blobIdString); DeleteOperation deleteOperation = new DeleteOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs); deleteOperation.execute(); notificationSystem.onBlobDeleted(blobIdString); coordinatorMetrics.deleteBlobOperationRate.mark(); coordinatorMetrics.deleteBlobOperationLatencyInMs.update(System.currentTimeMillis() - startTimeInMs); } catch (CoordinatorException e) { logger.trace("deleteBlob re-throwing CoordinatorException", e); coordinatorMetrics.countError(CoordinatorMetrics.CoordinatorOperationType.DeleteBlob, e.getErrorCode()); throw e; } }
Source:
<code>long gtk_draw (long widget, long cairo) { boolean haveBoundsChanged = boundsChangedSinceLastDraw; boundsChangedSinceLastDraw = false; if ((state & OBSCURED) != 0) return 0; if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0)) { <START> if (hooks (SWT.MeasureItem) || hooks (SWT.PaintItem) || hooks (SWT.EraseItem)) { <END> if (haveBoundsChanged) { GTK.gtk_widget_queue_draw(handle); return 0; } } } drawInheritedBackground (0, cairo); return super.gtk_draw (widget, cairo); }</code><technical_language>I quicker ownerDraw boolean here. If in Table._addListener(), ownerDraw is set true of listeners hooked. merge GTK version check listener check if statement</technical_language>

Target:
long gtk_draw (long widget, long cairo) { boolean haveBoundsChanged = boundsChangedSinceLastDraw; boundsChangedSinceLastDraw = false; if ((state & OBSCURED) != 0) return 0; if (GTK.GTK_VERSION >= OS.VERSION(3, 14, 0) && ownerDraw && haveBoundsChanged) { GTK.gtk_widget_queue_draw(handle); return 0; } drawInheritedBackground (0, cairo); return super.gtk_draw (widget, cairo); }
Source:
<code><START> private PathChildrenCache setupCacheSync(final CuratorFramework zkClient) throws Exception { <END> try { zkClient.create() .creatingParentsIfNeeded() .withMode(CreateMode.PERSISTENT) .forPath(ZKNODE_PATH); } catch (KeeperException.NodeExistsException expected) { } final PathChildrenCache cacheSync = new PathChildrenCache(zkClient, ZKNODE_PATH, false); cacheSync.start(); cacheSync.getListenable().addListener((curator, event) -> this.onZkEvent(event)); return cacheSync; }</code><technical_language>I changed this, sense throw more specific Exception</technical_language>

Target:
private static PathChildrenCache setupCacheSync(final CuratorFramework zkClient) throws Exception { try { zkClient.create() .creatingParentsIfNeeded() .withMode(CreateMode.PERSISTENT) .forPath(ZKNODE_PATH); } catch (final KeeperException.NodeExistsException expected) { } final PathChildrenCache cacheSync = new PathChildrenCache(zkClient, ZKNODE_PATH, false); cacheSync.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); return cacheSync; }
Source:
<code>public Parts( Optional<StatisticAggregations> finalAggregation, Optional<StatisticAggregations> intermediateAggregation, StatisticAggregations partialAggregation) { this.finalAggregation = requireNonNull(finalAggregation, "finalAggregation is null"); this.intermediateAggregation = requireNonNull(intermediateAggregation, "intermediateAggregation is null"); <START> this.partialAggregation = requireNonNull(partialAggregation, "partialAggregation is null"); <END> }</code><technical_language>check of intermediateAggregation finalAggregation is presented</technical_language>

Target:
public Parts( Optional<StatisticAggregations> finalAggregation, Optional<StatisticAggregations> intermediateAggregation, StatisticAggregations partialAggregation) { this.finalAggregation = requireNonNull(finalAggregation, "finalAggregation is null"); this.intermediateAggregation = requireNonNull(intermediateAggregation, "intermediateAggregation is null"); checkArgument( finalAggregation.isPresent() ^ intermediateAggregation.isPresent(), "only final or only intermediate aggregation is expected to be present"); this.partialAggregation = requireNonNull(partialAggregation, "partialAggregation is null"); }
Source:
<code>public void testNotificationOnStartProcess() { <START> getStartProcessFormDisplayer().setNewProcessInstanceEvent(newProcessInstanceEvent); <END> getStartProcessFormDisplayer().setNotificationEvent(notificationEvent); getStartProcessFormDisplayer().setProcessService(processServiceCaller); getStartProcessFormDisplayer().setParentProcessInstanceId(0L); getStartProcessFormDisplayer().startProcess(new HashMap<String, Object>()); verify(newProcessInstanceEvent).fire(any(NewProcessInstanceEvent.class)); ArgumentCaptor<NotificationEvent> argument = ArgumentCaptor.forClass(NotificationEvent.class); verify(notificationEvent).fire(argument.capture()); assertEquals(NotificationEvent.NotificationType.SUCCESS, argument.getValue().getType()); }</code><technical_language>set service methods in _setupMocks_ method</technical_language>

Target:
public void testNotificationOnStartProcess() { getStartProcessFormDisplayer().setParentProcessInstanceId(0L); getStartProcessFormDisplayer().startProcess(new HashMap<String, Object>()); verify(newProcessInstanceEvent).fire(any(NewProcessInstanceEvent.class)); ArgumentCaptor<NotificationEvent> argument = ArgumentCaptor.forClass(NotificationEvent.class); verify(notificationEvent).fire(argument.capture()); assertEquals(NotificationEvent.NotificationType.SUCCESS, argument.getValue().getType()); }
Source:
<code>public Command prepareLocal(String sql) { if (closed) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "session closed"); } Command command; if (queryCache != null) { <START> synchronized (queryCache) { <END> long newModificationMetaID = database.getModificationMetaId(); if (newModificationMetaID != modificationMetaID) { queryCache.clear(); modificationMetaID = newModificationMetaID; } command = queryCache.get(sql); if (command != null && command.canReuse()) { command.reuse(); return command; } } } Parser parser = new Parser(this); try { command = parser.prepareCommand(sql); } finally { subQueryIndexCache = null; } command.prepareJoinBatch(); if (queryCache != null && command.isCacheable()) { synchronized (queryCache) { queryCache.put(sql, command); } } return command; }</code><technical_language>do need synchronize here? Surely this point hold Database object Session object locked already</technical_language>

Target:
public Command prepareLocal(String sql) { if (closed) { throw DbException.get(ErrorCode.CONNECTION_BROKEN_1, "session closed"); } Command command; if (queryCacheSize > 0) { if (queryCache == null) { queryCache = SmallLRUCache.newInstance(queryCacheSize); modificationMetaID = database.getModificationMetaId(); } else { long newModificationMetaID = database.getModificationMetaId(); if (newModificationMetaID != modificationMetaID) { queryCache.clear(); modificationMetaID = newModificationMetaID; } command = queryCache.get(sql); if (command != null && command.canReuse()) { command.reuse(); return command; } } } Parser parser = new Parser(this); try { command = parser.prepareCommand(sql); } finally { subQueryIndexCache = null; } command.prepareJoinBatch(); if (queryCache != null) { if (command.isCacheable()) { queryCache.put(sql, command); } } return command; }
Source:
<code>public <T extends Comparable<T>> Boolean visit(NotEq<T> notEq) { Column<T> filterColumn = notEq.getColumn(); T value = notEq.getValue(); ColumnChunkMetaData columnChunk = getColumnChunk(filterColumn.getColumnPath()); Statistics<T> stats = columnChunk.getStatistics(); if (stats.isEmpty()) { return false; } if (value == null) { return isAllNulls(columnChunk); } if (hasNulls(columnChunk)) { return false; } if (isAllNulls(columnChunk)) { return false; <START> } <END> return value.compareTo(stats.genericGetMin()) == 0 && value.compareTo(stats.genericGetMax()) == 0; }</code><technical_language>comparing null else null drop it. right</technical_language>

Target:
public <T extends Comparable<T>> Boolean visit(NotEq<T> notEq) { Column<T> filterColumn = notEq.getColumn(); T value = notEq.getValue(); ColumnChunkMetaData columnChunk = getColumnChunk(filterColumn.getColumnPath()); Statistics<T> stats = columnChunk.getStatistics(); if (stats.isEmpty()) { return false; } if (value == null) { return isAllNulls(columnChunk); } if (hasNulls(columnChunk)) { return false; } return value.compareTo(stats.genericGetMin()) == 0 && value.compareTo(stats.genericGetMax()) == 0; }
Source:
<code><START> public List<Container> getAllContainers() { <END> return Collections.unmodifiableList(new ArrayList<>(containerIdToContainerMap.values())); }</code><technical_language>Do need a list in this case? If want a collection, do Collections.unmodifiableCollection(containerIdToContainerMap.values()) prevent extra copy. However, this changes map issues iterating containers</technical_language>

Target:
public Collection<Container> getAllContainers() { return Collections.unmodifiableCollection(containerIdToContainerMap.values()); }
Source:
<code>public void set_project_with_branch() { <START> IssueChangeNotification result = notification.setProject("MyService", "My Service", "feature1", ""); <END> assertThat(result.getFieldValue("projectKey")).isEqualTo("MyService"); assertThat(result.getFieldValue("projectName")).isEqualTo("My Service"); assertThat(result.getFieldValue("branch")).isEqualTo("feature1"); }</code><technical_language>a test of field "projectUuid' missing here</technical_language>

Target:
public void set_project_with_branch() { IssueChangeNotification result = notification.setProject("MyService", "My Service", "feature1", "uuid2"); assertThat(result.getFieldValue("projectKey")).isEqualTo("MyService"); assertThat(result.getFieldValue("projectUuid")).isEqualTo("uuid2"); assertThat(result.getFieldValue("projectName")).isEqualTo("My Service"); assertThat(result.getFieldValue("branch")).isEqualTo("feature1"); }
Source:
<code>public static boolean isLoggingEnabled() { SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences(); return !properties.contains(LOGS_ENABLED) || <START> properties.getString(ENABLE_SAVED_FORMS, LOGS_ENABLED_YES).equals(LOGS_ENABLED_YES); <END> }</code><technical_language>I assume ENABLE_SAVED_FORMS LOGS_ENABLED</technical_language>

Target:
public static boolean isLoggingEnabled() { if (CommCareApplication.instance().getCurrentApp() == null) { return true; } SharedPreferences properties = CommCareApplication.instance().getCurrentApp().getAppPreferences(); return !properties.contains(LOGS_ENABLED) || properties.getString(LOGS_ENABLED, LOGS_ENABLED_YES).equals(LOGS_ENABLED_YES); }
Source:
<code>public void canCRUD() { DeveloperClient client = developer.getSession().getDeveloperClient(); ResourceList<Subpopulation> subpops = client.getAllSubpopulations(); int initialCount = subpops.getTotal(); assertNotNull(findByName(subpops.getItems(), "Default Consent Group")); Subpopulation subpop = new Subpopulation(); subpop.setName("Later Consent Group"); subpop.setMinAppVersion(10); GuidVersionHolder keys = client.createSubpopulation(subpop); subpop.setHolder(keys); Subpopulation retrieved = client.getSubpopulation(subpop.getGuid()); assertEquals(subpop, retrieved); retrieved.setDescription("Adding a description"); retrieved.setMinAppVersion(8); keys = client.updateSubpopulation(retrieved); retrieved.setHolder(keys); subpops = client.getAllSubpopulations(); assertEquals(initialCount+1, subpops.getTotal()); assertNotNull(findByName(subpops.getItems(), "Default Consent Group")); assertNotNull(findByName(subpops.getItems(), "Later Consent Group")); client.deleteSubpopulation(retrieved.getGuid()); assertEquals(initialCount, client.getAllSubpopulations().getTotal()); try { Subpopulation defaultSubpop = findByName(subpops.getItems(), "Default Consent Group"); client.deleteSubpopulation(defaultSubpop.getGuid()); fail("Should have thrown an exception."); } catch(BadRequestException e) { assertEquals("Cannot delete the default subpopulation for a study.", e.getMessage()); } <START> admin.getSession().getAdminClient().deleteSubpopulationPermanently(retrieved.getGuid()); <END> }</code><technical_language>move this a try-finally method. Otherwise, if Subpop test fails, clean subpops. This cascading failures line</technical_language>

Target:
public void canCRUD() { DeveloperClient client = developer.getSession().getDeveloperClient(); ResourceList<Subpopulation> subpops = client.getAllSubpopulations(); int initialCount = subpops.getTotal(); assertNotNull(findByName(subpops.getItems(), "Default Consent Group")); Subpopulation subpop = new Subpopulation(); subpop.setName("Later Consent Group"); subpop.setMinAppVersion(10); GuidVersionHolder keys = client.createSubpopulation(subpop); subpop.setHolder(keys); guid = subpop.getGuid(); Subpopulation retrieved = client.getSubpopulation(subpop.getGuid()); assertEquals(subpop, retrieved); retrieved.setDescription("Adding a description"); retrieved.setMinAppVersion(8); keys = client.updateSubpopulation(retrieved); retrieved.setHolder(keys); subpops = client.getAllSubpopulations(); assertEquals(initialCount+1, subpops.getTotal()); assertNotNull(findByName(subpops.getItems(), "Default Consent Group")); assertNotNull(findByName(subpops.getItems(), "Later Consent Group")); client.deleteSubpopulation(retrieved.getGuid()); assertEquals(initialCount, client.getAllSubpopulations().getTotal()); try { Subpopulation defaultSubpop = findByName(subpops.getItems(), "Default Consent Group"); client.deleteSubpopulation(defaultSubpop.getGuid()); fail("Should have thrown an exception."); } catch(BadRequestException e) { assertEquals("Cannot delete the default subpopulation for a study.", e.getMessage()); } }
Source:
<code>public Mono<byte[]> getSessionState() { if (!isSessionEnabled) { return monoError(logger, new IllegalStateException("Cannot get session state for non-session management node")); } return isAuthorized(ManagementConstants.OPERATION_GET_SESSION_STATE).then(createChannel.flatMap(channel -> { final Message message = createManagementMessage(ManagementConstants.OPERATION_GET_SESSION_STATE, null); final Map<String, Object> body = new HashMap<>(); body.put(ManagementConstants.SESSION_ID, sessionId); message.setBody(new AmqpValue(body)); return sendWithVerify(channel, message); })).flatMap(response -> { final Object value = ((AmqpValue) response.getBody()).getValue(); if (!(value instanceof Map)) { return monoError(logger, Exceptions.propagate(new AmqpException(false, String.format( "Body not expected when renewing session. Id: %s. Value: %s", sessionId, value), getErrorContext()))); } @SuppressWarnings("unchecked") final Map<String, Object> map = (Map<String, Object>) value; final Object sessionState = map.get(ManagementConstants.SESSION_STATE); if (!map.containsKey(ManagementConstants.SESSION_STATE) || sessionState == null) { <START> logger.info("sessionId[{}]. Does not have a session state.", sessionId); <END> return Mono.empty(); } final byte[] state = ((Binary) sessionState).getArray(); return Mono.just(state); }); }</code><technical_language>check map.containsKey(ManagementConstants.SESSION_STATE) : if do try get sessionState. this check required sessionState == null sufficient</technical_language>

Target:
public Mono<byte[]> getSessionState() { if (!isSessionEnabled) { return monoError(logger, new IllegalStateException("Cannot get session state for non-session management node")); } return isAuthorized(ManagementConstants.OPERATION_GET_SESSION_STATE).then(createChannel.flatMap(channel -> { final Message message = createManagementMessage(ManagementConstants.OPERATION_GET_SESSION_STATE, null); final Map<String, Object> body = new HashMap<>(); body.put(ManagementConstants.SESSION_ID, sessionId); message.setBody(new AmqpValue(body)); return sendWithVerify(channel, message); })).flatMap(response -> { final Object value = ((AmqpValue) response.getBody()).getValue(); if (!(value instanceof Map)) { return monoError(logger, Exceptions.propagate(new AmqpException(false, String.format( "Body not expected when renewing session. Id: %s. Value: %s", sessionId, value), getErrorContext()))); } @SuppressWarnings("unchecked") final Map<String, Object> map = (Map<String, Object>) value; final Object sessionState = map.get(ManagementConstants.SESSION_STATE); if (sessionState == null) { logger.info("sessionId[{}]. Does not have a session state.", sessionId); return Mono.empty(); } final byte[] state = ((Binary) sessionState).getArray(); return Mono.just(state); }); }
Source:
<code>protected void executeCommand() { storage_pool storagePool = getStoragePool(); <START> getStoragePoolDAO().updatePartial(storagePool); <END> if (storagePool.getstatus() != StoragePoolStatus.Up) { setSucceeded(true); return; } String spName = storagePool.getname(); if (!StringHelper.EqOp(_oldStoragePool.getname(), spName)) { VDSBrokerFrontend resourceManager = Backend.getInstance() .getResourceManager(); Guid spId = storagePool.getId(); SetStoragePoolDescriptionVDSCommandParameters parameters = new SetStoragePoolDescriptionVDSCommandParameters(spId, spName); resourceManager.RunVdsCommand( VDSCommandType.SetStoragePoolDescription, parameters); } setSucceeded(true); }</code><technical_language>updatePartial update? name is descriptive (I care how, I care more what)</technical_language>

Target:
protected void executeCommand() { if ((_oldStoragePool.getQuotaEnforcementType() == QuotaEnforcmentTypeEnum.DISABLED) && (getStoragePool().getQuotaEnforcementType() != QuotaEnforcmentTypeEnum.DISABLED)) { QuotaHelper.getInstance().setDefaultQuotaAsRegularQuota(_oldStoragePool); } storage_pool storagePool = getStoragePool(); getStoragePoolDAO().updatePartial(storagePool); if (storagePool.getstatus() != StoragePoolStatus.Up) { setSucceeded(true); return; } String spName = storagePool.getname(); if (!StringHelper.EqOp(_oldStoragePool.getname(), spName)) { VDSBrokerFrontend resourceManager = Backend.getInstance() .getResourceManager(); Guid spId = storagePool.getId(); SetStoragePoolDescriptionVDSCommandParameters parameters = new SetStoragePoolDescriptionVDSCommandParameters(spId, spName); resourceManager.RunVdsCommand( VDSCommandType.SetStoragePoolDescription, parameters); } setSucceeded(true); }
Source:
<code>public void close() throws IOException { if (!closed) { closed = true; if (stream != null) { try { stream.close(); } catch (IOException e) { <START> LOGGER.debug("Error closing stream", e); <END> } } completed.countDown(); } }</code><technical_language>sounds set error level</technical_language>

Target:
public void close() throws IOException { if (!closed) { closed = true; try { if (stream != null) { stream.close(); } } finally { completed.countDown(); } } }
Source:
<code><START> public void setActive(boolean isActive) { <END> mIsActive = isActive; if (!mIsActive) { synchronized (mActionLock) { if (mPendingZoomRatioCompleter != null) { mPendingZoomRatioCompleter.setException( new OperationCanceledException("Camera is not active.")); mPendingZoomRatioCompleter = null; } } setLiveDataValue(mZoomRatioLiveData, DEFAULT_ZOOM_RATIO); setLiveDataValue(mMaxZoomRatioLiveData, getMaxDigitalZoom()); setLiveDataValue(mMinZoomRatioLiveData, MIN_ZOOM); setLiveDataValue(mZoomPercentageLiveData, 0f); } }</code><technical_language>thread is this other setters called on? If this is called camera thread setZoomRatioInternal() is called main thread, mActive set false while in middle of setZoomRatioInternal</technical_language>

Target:
void setActive(boolean isActive) { CallbackToFutureAdapter.Completer<Void> completerToSetException = null; boolean toResetDefault = false; synchronized (mActiveLock) { mIsActive = isActive; if (!mIsActive) { synchronized (mCompleterLock) { if (mPendingZoomRatioCompleter != null) { completerToSetException = mPendingZoomRatioCompleter; mPendingZoomRatioCompleter = null; } } toResetDefault = true; } } if (toResetDefault) { setLiveDataValue(mZoomRatioLiveData, DEFAULT_ZOOM_RATIO); setLiveDataValue(mMaxZoomRatioLiveData, getMaxDigitalZoom()); setLiveDataValue(mMinZoomRatioLiveData, MIN_ZOOM); setLiveDataValue(mZoomPercentageLiveData, 0f); } if (completerToSetException != null) { completerToSetException .setException(new OperationCanceledException("Camera is not active.")); } }
Source:
<code>public boolean isNodeConstant(OgnlContext context) throws OgnlException { boolean result = false; Exception reason = null; try { Class c = OgnlRuntime.classForName(context, className); if (fieldName.equals("class")) { result = true; } else if (OgnlRuntime.isJdk15() && c.isEnum()) { result = true; } else { final int fModifiers; Field f; try { f = c.getField(fieldName); <START> } catch (NoSuchFieldException nsfe) { <END> f = OgnlRuntime.getField(c, fieldName); if (f == null) { throw new NoSuchFieldException(fieldName); } } fModifiers = f.getModifiers(); if (!Modifier.isStatic(fModifiers)) throw new OgnlException("Field " + fieldName + " of class " + className + " is not static"); result = Modifier.isFinal(fModifiers); } } catch (ClassNotFoundException e) { reason = e; } catch (NoSuchFieldException e) { reason = e; } catch (SecurityException e) { reason = e; } if (reason != null) throw new OgnlException("Could not get static field " + fieldName + " from class " + className, reason); return result; }</code><technical_language>change this</technical_language>

Target:
public boolean isNodeConstant(OgnlContext context) throws OgnlException { boolean result = false; Exception reason = null; try { Class c = OgnlRuntime.classForName(context, className); if (fieldName.equals("class")) { result = true; } else if (OgnlRuntime.isJdk15() && c.isEnum()) { result = true; } else { Field f; try { f = c.getField(fieldName); } catch (NoSuchFieldException nsfe) { f = OgnlRuntime.getField(c, fieldName); if (f == null) { throw new NoSuchFieldException(fieldName); } } final int fModifiers = f.getModifiers(); if (!Modifier.isStatic(fModifiers)) throw new OgnlException("Field " + fieldName + " of class " + className + " is not static"); result = Modifier.isFinal(fModifiers); } } catch (ClassNotFoundException e) { reason = e; } catch (NoSuchFieldException e) { reason = e; } catch (SecurityException e) { reason = e; } if (reason != null) throw new OgnlException("Could not get static field " + fieldName + " from class " + className, reason); return result; }