auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void scanFile(SensorContext sensorContext, InputFile inputFile, List<TreeVisitor> visitors, ScriptTree scriptTree) { JavaScriptVisitorContext context = new JavaScriptVisitorContext(scriptTree, inputFile.file(), settings); highlightSymbols(sensorContext.newSymbolTable().onFile(inputFile), context); <START> sensorContext.newSymbolTable(); <END> List<Issue> fileIssues = new ArrayList<>(); for (TreeVisitor visitor : visitors) { if (visitor instanceof CharsetAwareVisitor) { ((CharsetAwareVisitor) visitor).setCharset(fileSystem.encoding()); } if (visitor instanceof JavaScriptCheck) { fileIssues.addAll(((JavaScriptCheck) visitor).scanFile(context)); } else { visitor.scanTree(context); } } saveFileIssues(sensorContext, fileIssues, inputFile); }</code><technical_language>@vilchik-elena do need line</technical_language>

Target:
private void scanFile(SensorContext sensorContext, InputFile inputFile, List<TreeVisitor> visitors, ScriptTree scriptTree) { JavaScriptVisitorContext context = new JavaScriptVisitorContext(scriptTree, inputFile.file(), settings); highlightSymbols(sensorContext.newSymbolTable().onFile(inputFile), context); List<Issue> fileIssues = new ArrayList<>(); for (TreeVisitor visitor : visitors) { if (visitor instanceof CharsetAwareVisitor) { ((CharsetAwareVisitor) visitor).setCharset(fileSystem.encoding()); } if (visitor instanceof JavaScriptCheck) { fileIssues.addAll(((JavaScriptCheck) visitor).scanFile(context)); } else { visitor.scanTree(context); } } saveFileIssues(sensorContext, fileIssues, inputFile); }
Source:
<code>public void receivingAFindEventsRequest(final Map<String, String> requestData) throws Throwable { final Map<String, String> settings = new HashMap<String, String>(); settings.put(PlatformSmartmeteringKeys.EVENT_TYPE, this.getEventLogCategory()); settings.put(PlatformSmartmeteringKeys.KEY_BEGIN_DATE, requestData.get(PlatformSmartmeteringKeys.KEY_BEGIN_DATE)); settings.put(PlatformSmartmeteringKeys.KEY_END_DATE, requestData.get(PlatformSmartmeteringKeys.KEY_END_DATE)); settings.put(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION, requestData.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION)); final FindEventsRequest request = FindEventsRequestFactory.fromParameterMap(settings); final FindEventsAsyncResponse asyncResponse = this.requestClient.doRequest(request); <START> assertNotNull("asyncResponse should not be null", asyncResponse); <END> ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }</code><technical_language>capital 'AsyncResponse'</technical_language>

Target:
public void receivingAFindEventsRequest(final Map<String, String> requestData) throws Throwable { final Map<String, String> settings = new HashMap<String, String>(); settings.put(PlatformSmartmeteringKeys.EVENT_TYPE, this.getEventLogCategory()); settings.put(PlatformSmartmeteringKeys.KEY_BEGIN_DATE, requestData.get(PlatformSmartmeteringKeys.KEY_BEGIN_DATE)); settings.put(PlatformSmartmeteringKeys.KEY_END_DATE, requestData.get(PlatformSmartmeteringKeys.KEY_END_DATE)); settings.put(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION, requestData.get(PlatformSmartmeteringKeys.KEY_DEVICE_IDENTIFICATION)); final FindEventsRequest findEventsRequest = FindEventsRequestFactory.fromParameterMap(settings); final FindEventsAsyncResponse findEventsAsyncResponse = this.smartMeteringManagementRequestClient .doRequest(findEventsRequest); assertNotNull("AsyncResponse should not be null", findEventsAsyncResponse); ScenarioContext.current().put(PlatformSmartmeteringKeys.KEY_CORRELATION_UID, findEventsAsyncResponse.getCorrelationUid()); }
Source:
<code>protected void updateCompatibilityVersion() { DataCenterWithCluster dataCenterWithCluster = getModel().getDataCenterWithClustersList().getSelectedItem(); if (dataCenterWithCluster == null) { return; } final StoragePool dataCenter = dataCenterWithCluster.getDataCenter(); if (dataCenter == null) { return; } AsyncQuery asyncQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { <START> ArrayList<Version> <END> versions = (ArrayList<Version>) result; versions.add(0, null); Version selectedVersion; selectedVersion = getModel().getCompatibilityVersion().getSelectedItem(); if (selectedVersion != null && versions.contains(selectedVersion)) { getModel().getCompatibilityVersion().setItems(versions, selectedVersion); } else { getModel().getCompatibilityVersion().setItems(versions); } } }); AsyncDataProvider.getInstance().getDataCenterVersions(asyncQuery, dataCenter.getId()); }</code><technical_language>List<Version> versions = ..</technical_language>

Target:
protected void updateCompatibilityVersion() { DataCenterWithCluster dataCenterWithCluster = getModel().getDataCenterWithClustersList().getSelectedItem(); if (dataCenterWithCluster == null) { return; } final StoragePool dataCenter = dataCenterWithCluster.getDataCenter(); if (dataCenter == null) { return; } AsyncQuery asyncQuery = new AsyncQuery(new INewAsyncCallback() { @Override public void onSuccess(Object model, Object result) { List<Version> versions = (List<Version>) result; versions.add(0, null); Version selectedVersion; selectedVersion = getModel().getCustomCompatibilityVersion().getSelectedItem(); if (selectedVersion != null && versions.contains(selectedVersion)) { getModel().getCustomCompatibilityVersion().setItems(versions, selectedVersion); } else { getModel().getCustomCompatibilityVersion().setItems(versions); } } }); AsyncDataProvider.getInstance().getDataCenterVersions(asyncQuery, dataCenter.getId()); }
Source:
<code>private Map<Integer, String> getRemovableTimestampedSnapshots(Metadata metadata, int numberToKeep, int keepPeriod) { Map<Integer, SnapshotVersionDecomposition> snapshots = new HashMap<>(); Map<Integer, String> mapToRemove = new HashMap<>(); metadata.getVersioning() .getSnapshotVersions() .forEach(e -> { if ("jar".equals(e.getExtension())) { SnapshotVersionDecomposition snapshotVersion = SnapshotVersionDecomposition.of(e.getVersion()); <START> if (!SnapshotVersionDecomposition.INVALID.equals(snapshotVersion)) <END> { snapshots.put(snapshotVersion.getBuildNumber(), snapshotVersion); } } }); if (numberToKeep != 0 && snapshots.size() > numberToKeep) { snapshots.forEach((k, v) -> { if (mapToRemove.size() < snapshots.size() - numberToKeep) { mapToRemove.put(k, v.getVersion()); } }); } else if (numberToKeep == 0 && keepPeriod != 0) { snapshots.forEach((k, v) -> { try { if (keepPeriod < getDifferenceDays(v.getTimestamp())) { mapToRemove.put(k, v.getVersion()); } } catch (ParseException e) { logger.error(e.getMessage(), e); } }); } return mapToRemove; }</code><technical_language>@fuss86 some **WARNING** logs in case of else</technical_language>

Target:
private Map<Integer, String> getRemovableTimestampedSnapshots(Metadata metadata, int numberToKeep, int keepPeriod) { Map<Integer, SnapshotVersionDecomposition> snapshots = new HashMap<>(); Map<Integer, String> mapToRemove = new HashMap<>(); metadata.getVersioning() .getSnapshotVersions() .forEach(e -> { if ("jar".equals(e.getExtension())) { SnapshotVersionDecomposition snapshotVersion = SnapshotVersionDecomposition.of(e.getVersion()); if (SnapshotVersionDecomposition.INVALID.equals(snapshotVersion)) { logger.warn("Received invalid snapshot version {}", snapshotVersion); return; } snapshots.put(snapshotVersion.getBuildNumber(), snapshotVersion); } }); if (numberToKeep != 0 && snapshots.size() > numberToKeep) { snapshots.forEach((k, v) -> { if (mapToRemove.size() < snapshots.size() - numberToKeep) { mapToRemove.put(k, v.getVersion()); } }); } else if (numberToKeep == 0 && keepPeriod != 0) { snapshots.forEach((k, v) -> { try { if (keepPeriod < getDifferenceDays(v.getTimestamp())) { mapToRemove.put(k, v.getVersion()); } } catch (ParseException e) { logger.error(e.getMessage(), e); } }); } return mapToRemove; }
Source:
<code>public StreamsSnapshotReader(CorfuRuntime runtime, LogReplicationConfig config) { this.rt = runtime; this.rt.parseConfigurationString(runtime.getLayoutServers().get(0)).connect(); this.maxDataMsgSize = config.getMaxDataMsgSize(); this.maxDataSize = maxDataMsgSize *(100 - DATA_MSG_OVERHEAD_FRACTION)/100; streams = config.getStreamsToReplicate(); <START> log.info("The maxDataNessageSize maxDataSize ", maxDataMsgSize, maxDataSize); <END> }</code><technical_language>Typo -> Nessage</technical_language>

Target:
public StreamsSnapshotReader(CorfuRuntime runtime, LogReplicationConfig config) { this.rt = runtime; this.rt.parseConfigurationString(runtime.getLayoutServers().get(0)).connect(); this.maxDataSizePerMsg = config.getMaxDataSizePerMsg(); streams = config.getStreamsToReplicate(); log.debug("The maxDataSizePerMsg ", maxDataSizePerMsg); }
Source:
<code>public AsyncPoolImpl(String name, Lifecycle<T> lifecycle, int maxSize, long idleTimeout, long waiterTimeout, ScheduledExecutorService timeoutExecutor, int maxWaiters, Strategy strategy, int minSize, RateLimiter rateLimiter, Clock clock, LongTracker waitTimeTracker) { ArgumentUtil.notNull(lifecycle, "lifecycle"); ArgumentUtil.notNull(timeoutExecutor, "timeoutExecutor"); ArgumentUtil.notNull(strategy, "strategy"); ArgumentUtil.notNull(rateLimiter, "rateLimiter"); _poolName = name + "/" + Integer.toHexString(hashCode()); _lifecycle = lifecycle; _maxSize = maxSize; _idleTimeout = idleTimeout; <START> _waitTimeout = waiterTimeout; <END> _timeoutExecutor = timeoutExecutor; _maxWaiters = maxWaiters; _strategy = strategy; _minSize = minSize; _rateLimiter = rateLimiter; _clock = clock; _statsTracker = new AsyncPoolStatsTracker( () -> _lifecycle.getStats(), () -> _maxSize, () -> _minSize, () -> { synchronized (_lock) { return _poolSize; } }, () -> { synchronized (_lock) { return _checkedOut; } }, () -> { synchronized (_lock) { return _idle.size(); } }, clock, waitTimeTracker); }</code><technical_language>Please name parameter class variable consistently. _waitTimeout vs. waiterTimeout</technical_language>

Target:
public AsyncPoolImpl(String name, Lifecycle<T> lifecycle, int maxSize, long idleTimeout, long waiterTimeout, ScheduledExecutorService timeoutExecutor, int maxWaiters, Strategy strategy, int minSize, RateLimiter rateLimiter, Clock clock, LongTracker waitTimeTracker) { ArgumentUtil.notNull(lifecycle, "lifecycle"); ArgumentUtil.notNull(timeoutExecutor, "timeoutExecutor"); ArgumentUtil.notNull(strategy, "strategy"); ArgumentUtil.notNull(rateLimiter, "rateLimiter"); _poolName = name + "/" + Integer.toHexString(hashCode()); _lifecycle = lifecycle; _maxSize = maxSize; _idleTimeout = idleTimeout; _waiterTimeout = waiterTimeout; _timeoutExecutor = timeoutExecutor; _maxWaiters = maxWaiters; _strategy = strategy; _minSize = minSize; _rateLimiter = rateLimiter; _clock = clock; _statsTracker = new AsyncPoolStatsTracker( () -> _lifecycle.getStats(), () -> _maxSize, () -> _minSize, () -> { synchronized (_lock) { return _poolSize; } }, () -> { synchronized (_lock) { return _checkedOut; } }, () -> { synchronized (_lock) { return _idle.size(); } }, clock, waitTimeTracker); }
Source:
<code><START> public static ResourceFilter ofType(String typeId) { <END> return new ResourceFilter(false, null, typeId); }</code><technical_language>I strong opinion, @jmazzitelli started introduce builders, maintain semantic ? I this more "lambda" style, fine wondering if want maintain styles this is ok. LGTM in case</technical_language>

Target:
public static ResourceFilter.Builder ofType(String typeId) { return new ResourceFilter.Builder(false, null, typeId); }
Source:
<code>public void loadKeyRSA() throws IOException, GeneralSecurityException { File file = new File(this.getClass().getResource("rsa").getFile()); <START> assertkeyPair(file, null); <END> }</code><technical_language>suggestion assertKeyPair(file, null);</technical_language>

Target:
public void loadKeyRSA() throws IOException, GeneralSecurityException { File file = new File(this.getClass().getResource("rsa").getFile()); assertKeyPairNotNull(file, null); }
Source:
<code>public void shouldDoAsyncConversionGivenConverterName() throws IOException { <START> ConversionCacheHolder.deleteCache(); <END> File file = FileUtils.getResourceFileFromContext("test-data/hello.doc"); Blob blob = Blobs.createBlob(file, "application/msword", null, "hello.doc"); BlobHolder bh = new SimpleBlobHolder(blob); String id = conversionService.scheduleConversion("identity", bh, null); assertNotNull(id); eventService.waitForAsyncCompletion(); BlobHolder result = conversionService.getConversionResult(id, true); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertEquals(1, blobs.size()); Blob resultBlob = blobs.get(0); assertEquals(blob.getFilename(), resultBlob.getFilename()); assertEquals(blob.getMimeType(), resultBlob.getMimeType()); }</code><technical_language>put this in a @Before method</technical_language>

Target:
public void shouldDoAsyncConversionGivenConverterName() throws IOException { File file = FileUtils.getResourceFileFromContext("test-data/hello.doc"); Blob blob = Blobs.createBlob(file, "application/msword", null, "hello.doc"); BlobHolder bh = new SimpleBlobHolder(blob); String id = conversionService.scheduleConversion("identity", bh, null); assertNotNull(id); eventService.waitForAsyncCompletion(); BlobHolder result = conversionService.getConversionResult(id, true); assertNotNull(result); List<Blob> blobs = result.getBlobs(); assertEquals(1, blobs.size()); Blob resultBlob = blobs.get(0); assertEquals(blob.getFilename(), resultBlob.getFilename()); assertEquals(blob.getMimeType(), resultBlob.getMimeType()); }
Source:
<code>public boolean blobExists(String key, Subject who) throws AuthorizationException, KeyNotFoundException { who = checkAndGetSubject(who); validateKey(key); SettableBlobMeta meta = getStoredBlobMeta(key); aclHandler.hasPermissions(meta.get_acl(), READ, who, key); try { BlobStoreFile blobStoreFile = hbs.read(DATA_PREFIX + key); <START> return blobStoreFile.exists(); <END> } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>need this. For key, files meta_<key> data_<key>. operation blob check get meta_<key>. If blob is deleted, throws KeyNotFoundException. If exists, need continue check data_<key> simply assume data_<key> exists. if meta_<key>exists data_<key> doesn't, RuntimeException client download access blob. In this way, reduce hdfs operation further</technical_language>

Target:
public boolean blobExists(String key, Subject who) throws AuthorizationException { try { who = checkAndGetSubject(who); validateKey(key); SettableBlobMeta meta = getStoredBlobMeta(key); aclHandler.hasPermissions(meta.get_acl(), READ, who, key); } catch (KeyNotFoundException e) { return false; } return true; }
Source:
<code>public void setBaseClassPathForScanning(Iterable<URL> urls) { <START> this.baseClassPathForScanning = urls; <END> }</code><technical_language>enforce "only settable once, catalog is loaded"</technical_language>

Target:
public void setBaseClassPathForScanning(Iterable<URL> urls) { if (baseClassPathForScanning == urls) return; if (baseClassPathForScanning != null) throw new IllegalStateException("Cannot change base class path for scanning (in "+this+")"); if (catalog != null) throw new IllegalStateException("Cannot set base class path for scanning after catalog has been loaded (in "+this+")"); this.baseClassPathForScanning = urls; }
Source:
<code>public ProjectApi create(String name) throws RestApiException { ProjectInput projectInput = new ProjectInput(); projectInput.name = name; <START> return this.create(projectInput); <END> }</code><technical_language>this. omitted here, right</technical_language>

Target:
public ProjectApi create(String name) throws RestApiException { ProjectInput projectInput = new ProjectInput(); projectInput.name = name; return create(projectInput); }
Source:
<code>private static void assertAuditLogWritten() { <START> assertTrue(EXPECTED_AUDIT_LOG_MESSAGE, auditLogWritten); <END> auditLogWritten = false; }</code><technical_language>This a bit of a workaround - mockito's verify</technical_language>

Target:
private void assertAuditLogWritten() { assertTrue(EXPECTED_AUDIT_LOG_MESSAGE, auditLogWritten); auditLogWritten = false; }
Source:
<code>public void scan(HttpMessage msg, NameValuePair originalParam) { isJsonPayload = originalParam.getType() == NameValuePair.TYPE_POST_DATA; super.scan(msg, originalParam); <START> } <END></code><technical_language>I this is checking if parameter is in a POST body if body is of JSON type</technical_language>

Target:
public void scan(HttpMessage msg, NameValuePair originalParam) { isJsonPayload = originalParam.getType() == NameValuePair.TYPE_JSON; super.scan(msg, originalParam); }
Source:
<code>public static String toKey(Role role) { switch (role) { case SUPER_ADMIN: return KEY_SUPER_ADMIN; case ADMIN: return KEY_ADMIN; case EDITOR: return KEY_EDITOR; case AUTHOR: return KEY_AUTHOR; case CONTRIBUTOR: return KEY_CONTRIBUTOR; <START> default: <END> return "unsupported"; } }</code><technical_language>Apparently UNSUPPORTED case is missing switch. caught default case. If this is intentional, argue specific in handling UNSUPPORTED is defined other enum instances. In case, I argue in this Enum -> String conversion, default case offers other "unknown" cases is unpractical enumerate prefer group default case. Also, default hide future bugs new cases get added enum</technical_language>

Target:
public static String toKey(Role role) { switch (role) { case SUPER_ADMIN: return KEY_SUPER_ADMIN; case ADMIN: return KEY_ADMIN; case EDITOR: return KEY_EDITOR; case AUTHOR: return KEY_AUTHOR; case CONTRIBUTOR: return KEY_CONTRIBUTOR; case UNSUPPORTED: return "unsupported"; } return "unsupported"; }
Source:
<code>public String getBuckName() { @Var RuleType ruleType = this; @Var Boolean insertOkBuckPrefix = false; switch (this) { case KOTLIN_ANDROID_LIBRARY: case ANDROID_LIBRARY: ruleType = ANDROID_LIBRARY; insertOkBuckPrefix = true; break; case KOTLIN_ROBOLECTRIC_TEST: case ROBOLECTRIC_TEST: ruleType = ROBOLECTRIC_TEST; break; case ANDROID_PREBUILT_AAR: insertOkBuckPrefix = true; break; default: break; } <START> String prefix = insertOkBuckPrefix ? "okbuck_" : ""; <END> return prefix + ruleType.name().toLowerCase(); }</code><technical_language>move okbuck_ a constant</technical_language>

Target:
public String getBuckName() { @Var RuleType ruleType = this; @Var Boolean insertOkBuckPrefix = false; switch (this) { case KOTLIN_ANDROID_LIBRARY: case ANDROID_LIBRARY: ruleType = ANDROID_LIBRARY; insertOkBuckPrefix = true; break; case KOTLIN_ROBOLECTRIC_TEST: case ROBOLECTRIC_TEST: ruleType = ROBOLECTRIC_TEST; break; case ANDROID_PREBUILT_AAR: insertOkBuckPrefix = true; break; default: break; } String prefix = insertOkBuckPrefix ? OKBUCK_PREFIX : ""; return prefix + ruleType.name().toLowerCase(); }
Source:
<code>protected Command getDeleteCommand(final GroupRequest request) { if <START> (getHost() instanceof <END> Link) { return new DeleteLinkCommand((Link) getHost().getModel()); } return null; }</code><technical_language>is this a getHost().getModel() other edits</technical_language>

Target:
protected Command getDeleteCommand(final GroupRequest request) { if (getHost().getModel() instanceof Link) { return new DeleteLinkCommand((Link) getHost().getModel()); } return null; }
Source:
<code>private void pending() { Callback callback; boolean commit; Throwable failure; synchronized (this) { switch (_state) { case SENDING: { _state = State.PENDING; return; } case SUCCEEDING: { <START> callback = _callback; <END> commit = _commit; failure = null; reset(); break; } case FAILING: { _state = State.FAILED; callback = _callback; commit = _commit; failure = _failure; break; } default: { _state = State.FAILED; _failure = new IllegalStateException("Invalid transport state: " + _state); callback = _callback; commit = _commit; failure = _failure; break; } } } if (failure == null) succeed(callback, commit); else fail(callback, commit, failure); }</code><technical_language>I null _callback it</technical_language>

Target:
private void pending() { Callback callback; boolean commit; Throwable failure; synchronized (this) { switch (_state) { case SENDING: { _state = State.PENDING; return; } case SUCCEEDING: { callback = _callback; commit = _commit; failure = null; reset(null); break; } case FAILING: { callback = _callback; commit = _commit; failure = _failure; reset(failure); break; } default: { callback = _callback; commit = _commit; failure = new IllegalStateException("Invalid transport state: " + _state); reset(failure); break; } } } if (failure == null) succeed(callback, commit); else fail(callback, commit, failure); }
Source:
<code>public boolean execute(Property inputProperty, Node outputNode, Context context) throws Exception { LOGGER.debug("VdbDynamicSequencer.execute called:outputNode name='{0}', path='{1}'", outputNode.getName(), outputNode.getPath()); final Binary binaryValue = inputProperty.getBinary(); CheckArg.isNotNull(binaryValue, "binary"); outputNode.setPrimaryType(VdbLexicon.Vdb.VIRTUAL_DATABASE); outputNode.addMixin(JcrConstants.MIX_REFERENCEABLE); outputNode.setProperty(VdbLexicon.Vdb.ORIGINAL_FILE, outputNode.getPath()); <START> outputNode.setProperty(JcrConstants.MODE_SHA1, ((org.modeshape.jcr.api.Binary)binaryValue).getHexHash()); <END> InputStream stream = binaryValue.getStream(); VdbManifest manifest = readManifest(stream, outputNode, context); if (manifest == null) { throw new Exception("VdbDynamicSequencer.execute failed. The xml cannot be read."); } return true; }</code><technical_language>Please replace tabs spaces indent consistently</technical_language>

Target:
public boolean execute(Property inputProperty, Node outputNode, Context context) throws Exception { LOGGER.debug("VdbDynamicSequencer.execute called:outputNode name='{0}', path='{1}'", outputNode.getName(), outputNode.getPath()); final Binary binaryValue = inputProperty.getBinary(); CheckArg.isNotNull(binaryValue, "binary"); InputStream stream = binaryValue.getStream(); VdbManifest manifest = readManifest(binaryValue, stream, outputNode, context); if (manifest == null) { throw new Exception("VdbDynamicSequencer.execute failed. The xml cannot be read."); } return true; }
Source:
<code>public int createSaveProjectToExternalMemoryNotification(Context context, String programName) { if (context == null || programName == null) { return -1; } PendingIntent doesNothingPendingIntent = PendingIntent.getActivity(context, -1, new Intent(), PendingIntent.FLAG_ONE_SHOT); NotificationData data = new NotificationData(doesNothingPendingIntent, R.drawable.ic_stat, programName, context.getString(R.string.notification_save_project_to_external_storage_title_pending), context.getString(R.string.notification_save_project_to_external_storage_title_open), context.getString(R.string.notification_save_project_to_external_storage_pending), context.getString(R.string.notification_save_project_to_external_storage_open, EXTERNAL_STORAGE_ROOT_EXPORT_DIRECTORY), <START> 0, 100, false, false); <END> int id = createNotification(context, data); showOrUpdateNotification(id, 0); return id; }</code><technical_language>MAX_PERCENT here</technical_language>

Target:
public int createSaveProjectToExternalMemoryNotification(Context context, String programName) { if (context == null || programName == null) { return -1; } PendingIntent doesNothingPendingIntent = PendingIntent.getActivity(context, -1, new Intent(), PendingIntent.FLAG_ONE_SHOT); NotificationData data = new NotificationData(doesNothingPendingIntent, R.drawable.ic_stat, programName, context.getString(R.string.notification_save_project_to_external_storage_title_pending), context.getString(R.string.notification_save_project_to_external_storage_title_open), context.getString(R.string.notification_save_project_to_external_storage_pending), context.getString(R.string.notification_save_project_to_external_storage_open, EXTERNAL_STORAGE_ROOT_EXPORT_DIRECTORY), 0, MAX_PERCENT, false, false); int id = createNotification(context, data); showOrUpdateNotification(id, 0); return id; }
Source:
<code>private IVariableBinding[] compressArray(IVariableBinding[] array) { if (array == null) return null; int size= 0; for (IVariableBinding <START> a : <END> array) { if (a != null) { size++; } } if (size == array.length) return array; IVariableBinding[] result= new IVariableBinding[size]; for (int i= 0, r= 0; i < array.length; i++) { if (array[i] != null) result[r++]= array[i]; } return result; }</code><technical_language>rename binding</technical_language>

Target:
private IVariableBinding[] compressArray(IVariableBinding[] array) { if (array == null) return null; int size= 0; for (IVariableBinding binding : array) { if (binding != null) { size++; } } if (size == array.length) return array; IVariableBinding[] result= new IVariableBinding[size]; for (int i= 0, r= 0; i < array.length; i++) { if (array[i] != null) result[r++]= array[i]; } return result; }
Source:
<code>public boolean isAutoincrementIdField() { <START> return autoincrementIdField == null ? AUTO_INCREMENT_ID_FIELD_DEFAULT : autoincrementIdField; <END> }</code><technical_language>I is done purpose avoid auto boxing/unboxing</technical_language>

Target:
public boolean isAutoincrementIdField() { return autoincrementIdField == null ? AUTO_INCREMENT_ID_FIELD_DEFAULT : autoincrementIdField.booleanValue(); }
Source:
<code>public boolean isLoggedIn() { if (!"XWiki.XWikiGuest".equals(getContext().getUser())) { <START> return true; <END> } else { LOGGER.info("User is not logged in"); } return false; }</code><technical_language>for clarity reasons, preferable return statement end of method, e.g.: boolean ret = ...; LOGGER... return ret;</technical_language>

Target:
public boolean isLoggedIn() { boolean ret = !XWikiRightService.GUEST_USER_FULLNAME.equals(getContext().getUser()); LOGGER.info("isLoggedIn: {}", ret); return ret; }
Source:
<code>private boolean ifExceedQuota(CacheQuota cacheQuota, FileReadRequest request) { DataSize cacheSize = DataSize.succinctBytes(cacheScopeSizeInBytes.getOrDefault(cacheQuota.getIdentifier(), 0L) + request.getLength()); Optional<DataSize> quota = cacheQuota.getQuota(); <START> return quota.isPresent() && (cacheSize.compareTo(quota.get()) > 0); <END> }</code><technical_language>nit: return cacheQuota.getQuota().map(quota -> cacheSize.compareTo(quota) > 0).orElse(false)</technical_language>

Target:
private boolean ifExceedQuota(CacheQuota cacheQuota, FileReadRequest request) { DataSize cacheSize = DataSize.succinctBytes(cacheScopeSizeInBytes.getOrDefault(cacheQuota.getIdentifier(), 0L) + request.getLength()); return cacheQuota.getQuota().map(quota -> cacheSize.compareTo(quota) > 0).orElse(false); }
Source:
<code>protected MessageType getProjectedSchema(FieldProjectionFilter fieldProjectionFilter) { <START> return new ThriftSchemaConverter(null, fieldProjectionFilter) <END> .convert((Class<TBase<?, ?>>)thriftClass); }</code><technical_language>empty instead of null</technical_language>

Target:
protected MessageType getProjectedSchema(FieldProjectionFilter fieldProjectionFilter) { return new ThriftSchemaConverter(new Configuration(), fieldProjectionFilter) .convert((Class<TBase<?, ?>>)thriftClass); }
Source:
<code>public static Collection<Object[]> data() { <START> Collection<Object[]> params = Lists.newArrayListWithCapacity(4); <END> params.add(new Object[]{true}); params.add(new Object[]{false}); return params; }</code><technical_language>size set 2</technical_language>

Target:
public static Collection<Object[]> data() { Collection<Object[]> params = Lists.newArrayListWithCapacity(2); params.add(new Object[]{true}); params.add(new Object[]{false}); return params; }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { int errorCode = data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE, 0); switch (requestCode) { case AndroidPayHelper.REQUEST_CODE_CHANGE_MASKED_WALLET: if (resultCode == Activity.RESULT_OK && data.hasExtra(WalletConstants.EXTRA_MASKED_WALLET)) { MaskedWallet maskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET); <START> getSampleApplication().setMaskedWallet(maskedWallet); <END> updateCheckoutWithMaskedWallet(maskedWallet); } break; case AndroidPayHelper.REQUEST_CODE_FULL_WALLET: switch (resultCode) { case Activity.RESULT_OK: if (data != null && data.hasExtra(WalletConstants.EXTRA_FULL_WALLET)) { FullWallet fullWallet = data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET); completeCheckout(fullWallet); } break; case Activity.RESULT_CANCELED: break; default: handleGoogleWalletError(errorCode); break; } break; case WalletConstants.RESULT_ERROR: handleGoogleWalletError(errorCode); break; default: super.onActivityResult(requestCode, resultCode, data); break; } }</code><technical_language>do save this global context</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { int errorCode = data.getIntExtra(WalletConstants.EXTRA_ERROR_CODE, 0); switch (requestCode) { case AndroidPayHelper.REQUEST_CODE_CHANGE_MASKED_WALLET: if (resultCode == Activity.RESULT_OK && data.hasExtra(WalletConstants.EXTRA_MASKED_WALLET)) { MaskedWallet maskedWallet = data.getParcelableExtra(WalletConstants.EXTRA_MASKED_WALLET); updateCheckoutWithMaskedWallet(maskedWallet); } break; case AndroidPayHelper.REQUEST_CODE_FULL_WALLET: switch (resultCode) { case Activity.RESULT_OK: if (data != null && data.hasExtra(WalletConstants.EXTRA_FULL_WALLET)) { FullWallet fullWallet = data.getParcelableExtra(WalletConstants.EXTRA_FULL_WALLET); completeCheckout(fullWallet); } break; case Activity.RESULT_CANCELED: break; default: handleGoogleWalletError(errorCode); break; } break; case WalletConstants.RESULT_ERROR: handleGoogleWalletError(errorCode); break; default: super.onActivityResult(requestCode, resultCode, data); break; } }
Source:
<code>protected Set<AgentInfo> getVisibleAsSet() { return getAllLocal() <START> .stream() <END> .filter(agentInfo -> agentInfo.getRegion().equals(getConfig().getRegion())) .collect(toSet()); }</code><technical_language>do need this filter? Visible is local</technical_language>

Target:
protected Set<AgentInfo> getVisibleAsSet() { return getAllAttached() .stream() .filter(agentInfo -> agentInfo.getRegion().equals(getConfig().getRegion())) .collect(toSet()); }
Source:
<code>public boolean matches(URL url) { <START> return url.getProtocol().equals("file") && url.toExternalForm().endsWith(".jar"); <END> }</code><technical_language>url's this too? file://some/path/my.jar!org/foo/bar ! is in java url's zip (not if in kind though). I agree contains false positives (like tony.jarvis) endswith false negatives (like my.jar!org)</technical_language>

Target:
public boolean matches(URL url) { return url.getProtocol().equals("file") && url.toExternalForm().contains(".jar"); }
Source:
<code>private boolean isFirstBoot() { <START> IPackageManager pm = AppGlobals.getPackageManager(); try { final boolean isFirstBoot = pm.isFirstBoot(); <END> final boolean isUpgrade = pm.isDeviceUpgrading(); return isFirstBoot && !isUpgrade; } catch (RemoteException e) { throw new IllegalStateException("Package manager not available"); } }</code><technical_language>hidden APIs, try mechanism figure out firstboot? return Settings.Global.getInt(context.getContentResolver(), Settings.Global.BOOT_COUNT) == 1;</technical_language>

Target:
private boolean isFirstBoot() { return Settings.Global.getInt(mResolver, Settings.Global.BOOT_COUNT) == 1; }
Source:
<code>public Completable compressBlock(long startTimeSlice, int pageSize, int maxConcurrency) { <START> return Completable.fromObservable( <END> dataAccess.findAllDataFromBucket(startTimeSlice, pageSize, maxConcurrency) .flatMap(rows -> rows .publish(p -> p.window( p.map(Row::getPartitionKeyToken) .distinctUntilChanged())) .concatMap(o -> { Observable<Row> sharedRows = o.share(); Observable<CompressedPointContainer> compressed = sharedRows.compose(new TempTableCompressTransformer(startTimeSlice)); Observable<Row> keyTake = sharedRows.take(1); return compressed.zipWith(keyTake, (cpc, r) -> { MetricId<?> metricId = new MetricId(r.getString(0), MetricType.fromCode(r.getByte(1)), r.getString(2)); return dataAccess .insertCompressedData(metricId, startTimeSlice, cpc, getTTL(metricId)) .mergeWith(updateMetricExpiration(metricId).map(rs -> null)); }); }), maxConcurrency) .flatMap(rs -> rs) .doOnError(Throwable::printStackTrace) .doOnCompleted(() -> { log.infof("Compress part completed"); dataAccess.dropTempTable(startTimeSlice) .subscribeOn(Schedulers.io()) .subscribe(); }) ); }</code><technical_language>is a lot in this method in terms of work is RxJava operators used. helpful do a BlueJeans session explain is happen operators used</technical_language>

Target:
public Completable compressBlock(long startTimeSlice, int pageSize, int maxConcurrency) { return Completable.fromObservable( dataAccess.findAllDataFromBucket(startTimeSlice, pageSize, maxConcurrency) .switchIfEmpty(Observable.empty()) .flatMap(rows -> rows .publish(p -> p.window( p.map(Row::getPartitionKeyToken) .distinctUntilChanged())) .concatMap(o -> { Observable<Row> sharedRows = o.share(); Observable<CompressedPointContainer> compressed = sharedRows.compose(new TempTableCompressTransformer(startTimeSlice)); Observable<Row> keyTake = sharedRows.take(1); return compressed.zipWith(keyTake, (cpc, r) -> { MetricId<?> metricId = new MetricId(r.getString(0), MetricType.fromCode(r.getByte(1)), r.getString(2)); return dataAccess .insertCompressedData(metricId, startTimeSlice, cpc, getTTL(metricId)) .mergeWith(updateMetricExpiration(metricId).map(rs -> null)); }); }), maxConcurrency) .flatMap(rs -> rs) .doOnCompleted(() -> dataAccess.dropTempTable(startTimeSlice) .compose(applyRetryPolicy()) .subscribeOn(Schedulers.io()) .subscribe()) ); }
Source:
<code>public void setSelectableItems(List<SearchBoxRecordWidget<T>> resultDisplayItems) { waitingForResults = false; hasResults = !(resultDisplayItems.size() == 0); this.resultDisplayItems = resultDisplayItems; if (hasResults) { mainPanel.clear(); int count = 0; for (final SearchBoxRecordWidget<T> displayItem : this.resultDisplayItems) { if (count > 0) { SimplePanel recordsSplitter = new SimplePanel(); recordsSplitter.setHeight("1px"); recordsSplitter.setStyleName("itemSplitter"); mainPanel.add(recordsSplitter); System.out.println("Hello"); } mainPanel.add(displayItem); final int itemId = count; displayItem.addMouseOverHandler(new MouseOverHandler() { <START> @Override <END> public void onMouseOver(MouseOverEvent arg0) { if (selectedIndex >= 0) { SearchBoxDropDown.this.resultDisplayItems.get(selectedIndex).setSelectedState(false); } displayItem.setSelectedState(true); selectedIndex = itemId; } }); displayItem.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent arg0) { displayItem.setSelectedState(false); } }); count++; } } else { addInfoMessages(); } }</code><technical_language>need commet this</technical_language>

Target:
public void setSelectableItems(List<SearchBoxRecordWidget<T>> resultDisplayItems) { waitingForResults = false; hasResults = !(resultDisplayItems.size() == 0); this.resultDisplayItems = resultDisplayItems; if (hasResults) { mainPanel.clear(); int count = 0; for (final SearchBoxRecordWidget<T> displayItem : this.resultDisplayItems) { if (count > 0) { SimplePanel recordsSplitter = new SimplePanel(); recordsSplitter.setHeight("1px"); recordsSplitter.setStyleName("itemSplitter"); mainPanel.add(recordsSplitter); } mainPanel.add(displayItem); final int itemId = count; displayItem.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { if (selectedIndex >= 0) { SearchBoxDropDown.this.resultDisplayItems.get(selectedIndex).setSelectedState(false); } displayItem.setSelectedState(true); selectedIndex = itemId; } }); displayItem.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { displayItem.setSelectedState(false); } }); count++; } } else { addInfoMessages(); } }
Source:
<code>public ATCommandResponse sendATCommand(ATCommand command) throws InterfaceNotOpenException, InvalidOperatingModeException, TimeoutException, IOException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); if (command == null) throw new NullPointerException("AT command cannot be null."); ATCommandResponse response = null; switch (getOperatingMode()) { case AT: case UNKNOWN: default: throw new InvalidOperatingModeException(); case API: case API_ESCAPE: XBeeAPIPacket packet = new ATCommandPacket(getNextFrameID(), command.getCommand(), command.getParameter()); logger.debug("Sending AT command [{} {}].", command.getCommand(), command.getParameter()); try { ATCommandResponsePacket answerPacket = (ATCommandResponsePacket)sendXBeePacket(packet); response = new ATCommandResponse(command, answerPacket.getCommandData(), answerPacket.getStatus()); <START> logger.debug("AT command response: {}.", response.getResponseString()); <END> } catch (InvalidOperatingModeException e) { logger.error(e.getMessage(), e); } catch (ClassCastException e) { logger.error("Received an invalid packet type after sending an AT command packet." + e); } } return response; }</code><technical_language>response of command rarely a string. byte array of response, I print in pretty hex format. like: logger.debug("AT command response: {}.", HexUtils.prettyHexString(HexUtils.byteArrayToHexString(response.getResponse()))); EDIT: I it, add a new method in HexUtils class a pretty string of a byte array: HexUtils.prettyHexString(response.getResponse())</technical_language>

Target:
public ATCommandResponse sendATCommand(ATCommand command) throws InterfaceNotOpenException, InvalidOperatingModeException, TimeoutException, IOException { if (!connectionInterface.isOpen()) throw new InterfaceNotOpenException(); if (command == null) throw new NullPointerException("AT command cannot be null."); ATCommandResponse response = null; OperatingMode operatingMode = getOperatingMode(); switch (operatingMode) { case AT: case UNKNOWN: default: throw new InvalidOperatingModeException(operatingMode); case API: case API_ESCAPE: XBeeAPIPacket packet = new ATCommandPacket(getNextFrameID(), command.getCommand(), command.getParameter()); if (command.getParameter() == null) logger.debug(toString() + "Sending AT command '{}'.", command.getCommand()); else logger.debug(toString() + "Sending AT command '{} {}'.", command.getCommand(), HexUtils.prettyHexString(command.getParameter())); try { ATCommandResponsePacket answerPacket = (ATCommandResponsePacket)sendXBeePacket(packet); response = new ATCommandResponse(command, answerPacket.getCommandData(), answerPacket.getStatus()); logger.debug(toString() + "AT command response: {}.", HexUtils.prettyHexString(response.getResponse())); } catch (ClassCastException e) { logger.error("Received an invalid packet type after sending an AT command packet." + e); } } return response; }
Source:
<code>public Map<EtlKey, ExceptionWritable> readErrors(FileSystem fs, Path newExecutionOutput) throws IOException { Map<EtlKey, ExceptionWritable> errors = new HashMap<EtlKey, ExceptionWritable>(); for (FileStatus f : fs.listStatus(newExecutionOutput, new PrefixFilter( EtlMultiOutputFormat.ERRORS_PREFIX))) { SequenceFile.Reader reader = new SequenceFile.Reader(fs, f.getPath(), fs.getConf()); EtlKey key = new EtlKey(); ExceptionWritable value = new ExceptionWritable(); while (reader.next(key, value)) { <START> ExceptionWritable exceptionWritable = new ExceptionWritable(); <END> exceptionWritable.set(value.toString()); errors.put(new EtlKey(key), exceptionWritable); } reader.close(); } return errors; }</code><technical_language>new ETLKey ExceptionWritable objects copied ones? E.g. new EtlKey(key), toString() method</technical_language>

Target:
public Map<EtlKey, ExceptionWritable> readErrors(FileSystem fs, Path newExecutionOutput) throws IOException { Map<EtlKey, ExceptionWritable> errors = new HashMap<EtlKey, ExceptionWritable>(); for (FileStatus f : fs.listStatus(newExecutionOutput, new PrefixFilter( EtlMultiOutputFormat.ERRORS_PREFIX))) { SequenceFile.Reader reader = new SequenceFile.Reader(fs, f.getPath(), fs.getConf()); String errorFrom = "\nError from file [" + f.getPath() + "]"; EtlKey key = new EtlKey(); ExceptionWritable value = new ExceptionWritable(); while (reader.next(key, value)) { ExceptionWritable exceptionWritable = new ExceptionWritable(value.toString() + errorFrom); errors.put(new EtlKey(key), exceptionWritable); } reader.close(); } return errors; }
Source:
<code>protected DimensionColumn constructDimension(String dimensionField, Class<?> cls, EntityDictionary entityDictionary) { DimensionColumn dim = super.constructDimension(dimensionField, cls, entityDictionary); JoinTo joinTo = entityDictionary.getAttributeOrRelationAnnotation(cls, JoinTo.class, dimensionField); if (joinTo == null) { String columnName = getColumnName(entityClass, dimensionField); if (dim instanceof TimeDimensionColumn) { <START> return new SQLTimeDimension((TimeDimensionColumn) dim, columnName, getAlias()); <END> } return new SQLDimension(dim, columnName, getAlias()); } Path path = new Path(entityClass, entityDictionary, joinTo.path()); if (dim instanceof TimeDimensionColumn) { return new SQLTimeDimension((TimeDimensionColumn) dim, getJoinColumn(path), getJoinTableAlias(path), path); } return new SQLDimension(dim, getJoinColumn(path), getJoinTableAlias(path), path); }</code><technical_language>rename SQLTimeDimension -> SQLTimeDimensionColumn match</technical_language>

Target:
protected DimensionColumn constructDimension(String dimensionField, Class<?> cls, EntityDictionary entityDictionary) { DimensionColumn dim = super.constructDimension(dimensionField, cls, entityDictionary); JoinTo joinTo = entityDictionary.getAttributeOrRelationAnnotation(cls, JoinTo.class, dimensionField); if (joinTo == null) { String columnName = getColumnName(entityClass, dimensionField); if (dim instanceof TimeDimensionColumn) { return new SQLTimeDimensionColumn((TimeDimensionColumn) dim, columnName, getAlias()); } return new SQLDimensionColumn(dim, columnName, getAlias()); } Path path = new Path(entityClass, entityDictionary, joinTo.path()); if (dim instanceof TimeDimensionColumn) { return new SQLTimeDimensionColumn((TimeDimensionColumn) dim, getJoinColumn(path), getJoinTableAlias(path), path); } return new SQLDimensionColumn(dim, getJoinColumn(path), getJoinTableAlias(path), path); }
Source:
<code>public ExitCode run() { for (final sun.misc.Signal s : signalsToIntercept) { sun.misc.Signal.handle(s, signal -> handleTerminationSignal()); } log.info("Starting job execution"); try { this.stateMachine.run(); } catch (final Exception e) { <START> log.error("Job state machine execution failed: {}", e.getMessage()); <END> throw e; } final ExecutionContext executionContext = this.stateMachine.getExecutionContext(); final JobStatus finalJobStatus = executionContext.getCurrentJobStatus(); final boolean jobLaunched = executionContext.isJobLaunched(); final FatalTransitionException fatalException = executionContext.getExecutionAbortedFatalException(); if (fatalException != null) { UserConsole.getLogger().error( "Job execution fatal error in state {}: {}", fatalException.getSourceState(), fatalException.getCause().getMessage() ); } final ExitCode exitCode; switch (finalJobStatus) { case SUCCEEDED: log.info("Job executed successfully"); exitCode = ExitCode.SUCCESS; break; case KILLED: log.info("Job killed during execution"); exitCode = ExitCode.EXEC_ABORTED; break; case FAILED: if (jobLaunched) { log.info("Job execution failed"); exitCode = ExitCode.EXEC_FAIL; } else { log.info("Job setup failed"); exitCode = ExitCode.COMMAND_INIT_FAIL; } break; case INVALID: log.info("Job execution initialization failed"); exitCode = ExitCode.INIT_FAIL; break; default: throw new RuntimeException("Unexpected final job status: " + finalJobStatus.name()); } return exitCode; }</code><technical_language>purposely adding exception this log message</technical_language>

Target:
public ExitCode run() { for (final sun.misc.Signal s : signalsToIntercept) { sun.misc.Signal.handle(s, signal -> handleTerminationSignal()); } log.info("Starting job execution"); try { this.stateMachine.run(); } catch (final Exception e) { log.error("Job state machine execution failed: {}", e.getMessage()); throw e; } final ExecutionContext executionContext = this.stateMachine.getExecutionContext(); final JobStatus finalJobStatus = executionContext.getCurrentJobStatus(); final boolean jobLaunched = executionContext.isJobLaunched(); final FatalJobExecutionException fatalException = executionContext.getExecutionAbortedFatalException(); if (fatalException != null) { UserConsole.getLogger().error( "Job execution fatal error in state {}: {}", fatalException.getSourceState(), fatalException.getCause().getMessage() ); } final ExitCode exitCode; switch (finalJobStatus) { case SUCCEEDED: log.info("Job executed successfully"); exitCode = ExitCode.SUCCESS; break; case KILLED: log.info("Job killed during execution"); exitCode = ExitCode.EXEC_ABORTED; break; case FAILED: if (jobLaunched) { log.info("Job execution failed"); exitCode = ExitCode.EXEC_FAIL; } else { log.info("Job setup failed"); exitCode = ExitCode.COMMAND_INIT_FAIL; } break; case INVALID: log.info("Job execution initialization failed"); exitCode = ExitCode.INIT_FAIL; break; default: throw new RuntimeException("Unexpected final job status: " + finalJobStatus.name()); } return exitCode; }
Source:
<code>protected File doInBackground(Uri... uris) { File instanceFile; FormController formController = Collect.getInstance().getFormController(); if (formController != null) { instanceFile = formController.getInstanceFile(); if (instanceFile != null) { String instanceFolder = instanceFile.getParent(); String extension = ContentResolverHelper.getFileExtensionFromUri(formEntryActivity.get(), uris[0]); String destMediaPath = instanceFolder + File.separator + System.currentTimeMillis() + extension; try { <START> File chosenFile = MediaUtils.getFileFromUri(formEntryActivity.get(), uris[0], MediaStore.Images.Media.DATA, formEntryActivity.get().getNetworkStateProvider()); <END> if (chosenFile != null) { final File newFile = new File(destMediaPath); FileUtils.copyFile(chosenFile, newFile); QuestionWidget questionWidget = formEntryActivity.get().getWidgetWaitingForBinaryData(); if (questionWidget instanceof BaseImageWidget) { ImageConverter.execute(newFile.getPath(), questionWidget, formEntryActivity.get()); } return newFile; } else { Timber.e("Could not receive chosen file"); formEntryActivity.get().runOnUiThread(() -> ToastUtils.showShortToastInMiddle(R.string.error_occured)); return null; } } catch (GDriveConnectionException e) { Timber.e("Could not receive chosen file due to connection problem"); formEntryActivity.get().runOnUiThread(() -> ToastUtils.showLongToastInMiddle(R.string.gdrive_connection_exception)); return null; } } } return null; }</code><technical_language>I pass NetworkStateProvider in a constructor arg needing getter (which I understand) FormEntryActivity</technical_language>

Target:
protected File doInBackground(Uri... uris) { File instanceFile; FormController formController = Collect.getInstance().getFormController(); if (formController != null) { instanceFile = formController.getInstanceFile(); if (instanceFile != null) { String instanceFolder = instanceFile.getParent(); String extension = ContentResolverHelper.getFileExtensionFromUri(formEntryActivity.get(), uris[0]); String destMediaPath = instanceFolder + File.separator + System.currentTimeMillis() + extension; try { File chosenFile = MediaUtils.getFileFromUri(formEntryActivity.get(), uris[0], MediaStore.Images.Media.DATA, connectivityProvider.get()); if (chosenFile != null) { final File newFile = new File(destMediaPath); FileUtils.copyFile(chosenFile, newFile); QuestionWidget questionWidget = formEntryActivity.get().getWidgetWaitingForBinaryData(); if (questionWidget instanceof BaseImageWidget) { ImageConverter.execute(newFile.getPath(), questionWidget, formEntryActivity.get()); } return newFile; } else { Timber.e("Could not receive chosen file"); formEntryActivity.get().runOnUiThread(() -> ToastUtils.showShortToastInMiddle(R.string.error_occured)); return null; } } catch (GDriveConnectionException e) { Timber.e("Could not receive chosen file due to connection problem"); formEntryActivity.get().runOnUiThread(() -> ToastUtils.showLongToastInMiddle(R.string.gdrive_connection_exception)); return null; } } } return null; }