auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void recordUnreachableRemotes() throws Exception { StringBuilder xmlContent = new StringBuilder(); xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\"<LINK_0>\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"base\" name=\"platform/base\" />") .append("</manifest>"); Repository dest = Git.cloneRepository() .setURI(db.getDirectory().toURI().toString()) .setDirectory(createUniqueTestGitDir(true)).setBare(true).call() .getRepository(); assertTrue(dest.isBare()); RepoCommand cmd = <START> new RepoCommand(dest); <END> RevCommit commit = cmd .setInputStream(new ByteArrayInputStream( xmlContent.toString().getBytes(UTF_8))) .setRemoteReader(new IndexedRepos()) .setURI("platform/") .setTargetURI("platform/superproject") .setRecordRemoteBranch(true) .setIgnoreRemoteFailures(true) .setRecordSubmoduleLabels(true) .call(); String idStr = commit.getId().name() + ":" + ".gitmodules"; ObjectId modId = dest.resolve(idStr); try (ObjectReader reader = dest.newObjectReader()) { byte[] bytes = reader.open(modId).getCachedBytes(Integer.MAX_VALUE); Config base = new Config(); BlobBasedConfig cfg = new BlobBasedConfig(base, bytes); String subUrl = cfg.getString("submodule", "base", "url"); assertEquals(subUrl, "<LINK_0>platform/base"); } dest.close(); }</code><technical_language>inlined L255</technical_language>

Target:
public void recordUnreachableRemotes() throws Exception { StringBuilder xmlContent = new StringBuilder(); xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\"<LINK_0>\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"base\" name=\"platform/base\" />") .append("</manifest>"); Repository dest = Git.cloneRepository() .setURI(db.getDirectory().toURI().toString()) .setDirectory(createUniqueTestGitDir(true)).setBare(true).call() .getRepository(); assertTrue(dest.isBare()); RevCommit commit = new RepoCommand(dest) .setInputStream(new ByteArrayInputStream( xmlContent.toString().getBytes(UTF_8))) .setRemoteReader(new IndexedRepos()) .setURI("platform/") .setTargetURI("platform/superproject") .setRecordRemoteBranch(true) .setIgnoreRemoteFailures(true) .setRecordSubmoduleLabels(true) .call(); String idStr = commit.getId().name() + ":" + ".gitmodules"; ObjectId modId = dest.resolve(idStr); try (ObjectReader reader = dest.newObjectReader()) { byte[] bytes = reader.open(modId).getCachedBytes(Integer.MAX_VALUE); Config base = new Config(); BlobBasedConfig cfg = new BlobBasedConfig(base, bytes); String subUrl = cfg.getString("submodule", "base", "url"); assertEquals(subUrl, "<LINK_0>platform/base"); } dest.close(); }
Source:
<code><START> public static GlobalConfigCache getInstance() { <END> return INSTANCE.get(); }</code><technical_language>I SystemReader server this cache instance. static instances, is a interval in this cache instance while SystemReader instance new one. simpler if methods getSystemConfig() getUserConfig() SystemReader, this separate class</technical_language>

Target:
public static GlobalConfigCache getInstance() { return INSTANCE; }
Source:
<code>protected String getStreamForCategory(String category) { if (category != null && streamIds.contains(category)) { return category; } <START> return "default"; <END> }</code><technical_language>a constant</technical_language>

Target:
protected String getStreamForCategory(String category) { if (category != null && streamIds.contains(category)) { return category; } return DEFAULT_CATEGORY; }
Source:
<code>public void showPlaceholder(User user) { portraitImage.setImageBitmap(null); <START> textView.setBackground(getResources().getDrawable(R.drawable.rounded_corner, null)); <END> String nameInitial = user.getFirstName().substring(0, 1); String surnameInitial = user.getLastName().isEmpty() ? "" : user.getLastName().substring(0, 1); String fullNameUppercase = (nameInitial + surnameInitial).toUpperCase(); textView.setText(fullNameUppercase); }</code><technical_language>ContextCompat instead of getResources, passing theme null is a code smell</technical_language>

Target:
public void showPlaceholder(User user) { portraitImage.setImageBitmap(null); textView.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.rounded_corner)); String nameInitial = user.getFirstName().substring(0, 1); String surnameInitial = user.getLastName().isEmpty() ? "" : user.getLastName().substring(0, 1); String fullNameUppercase = (nameInitial + surnameInitial).toUpperCase(); textView.setText(fullNameUppercase); }
Source:
<code>public void createAuthenticationDialog(WebView webView, HttpAuthHandler handler) { CredentialsDialogFragment dialog = CredentialsDialogFragment.newInstanceForCredentials(webView, handler); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.addToBackStack(null); dialog.setCancelable(false); dialog.show(ft, CREDENTIALS_DIALOG_TAG); if (!mIsFirstAuthAttempt) { <START> Snackbar snackbar = Snackbar.make( <END> findViewById(android.R.id.content), getText(R.string.saml_authentication_wrong_pass), Snackbar.LENGTH_LONG ); snackbar.show(); } else { mIsFirstAuthAttempt = false; } }</code><technical_language>create a new method show snackbar, error message parameter</technical_language>

Target:
public void createAuthenticationDialog(WebView webView, HttpAuthHandler handler) { CredentialsDialogFragment dialog = CredentialsDialogFragment.newInstanceForCredentials(webView, handler); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.addToBackStack(null); dialog.setCancelable(false); dialog.show(ft, CREDENTIALS_DIALOG_TAG); if (!mIsFirstAuthAttempt) { showSnackMessage(R.string.saml_authentication_wrong_pass); } else { mIsFirstAuthAttempt = false; } }
Source:
<code>public Date getArtStartDate(Patient patient) { List<Obs> list = Context.getObsService().getObservationsByPersonAndConcept(patient, Context.getConceptService().getConcept(99161)); if (list.size() <= 0) { <START> list = getObsListFromIdList("SELECT obs_id FROM obs where obs.person_id='" + patient.getPatientId() + "' AND obs.concept_id = 90315 AND obs.voided = false ORDER BY obs.encounter_id DESC"); <END> if (list.size() > 0) { return list.get(0).getEncounter().getEncounterDatetime(); } else { return null; } } else { return list.get(0).getValueDatetime(); } }</code><technical_language>@slubwama I do do this backlog for a patient entered - give wrong data</technical_language>

Target:
public Date getArtStartDate(Patient patient) { List<Obs> list = Context.getObsService().getObservationsByPersonAndConcept(patient, Context.getConceptService().getConcept(99161)); Date artStartDate = null; if (list.size() > 0) { artStartDate = list.get(0).getValueDatetime(); } return artStartDate; }
Source:
<code>private static void inlineIncludes(NodeList signatureNodes, Collection<Attachment> attachments) throws IOException { for (int i = 0; i < signatureNodes.getLength(); ++i) { Element sigElement = (Element) signatureNodes.item(i); Object child = sigElement.getFirstChild(); if (child instanceof Element && isIncludeElement((Element) child)) { String refId = ((Element) child).getAttribute(HREF_ATTRIBUTE).replaceFirst(CONTENT_ID_PREFIX, ""); Optional<Attachment> attachment = getAttachment(attachments, refId); if (attachment.isPresent()) { String attachmentValue = convertToBase64Data(attachment.get().getDataHandler()); sigElement.setTextContent(attachmentValue); } else { LOG.warn( <START> "Failed to inline signature/digest element to the header. Cannot find reference id: " + refId); <END> } } } }</code><technical_language>Please parameterized logging</technical_language>

Target:
private static void inlineIncludes(NodeList signatureNodes, Collection<Attachment> attachments) throws IOException { for (int i = 0; i < signatureNodes.getLength(); ++i) { Element sigElement = (Element) signatureNodes.item(i); Object child = sigElement.getFirstChild(); if (child instanceof Element && isIncludeElement((Element) child)) { String refId = ((Element) child).getAttribute(HREF_ATTRIBUTE).replaceFirst(CONTENT_ID_PREFIX, ""); Optional<Attachment> attachment = getAttachment(attachments, refId); if (attachment.isPresent()) { String attachmentValue = convertToBase64Data(attachment.get().getDataHandler()); sigElement.setTextContent(attachmentValue); } else { LOG.warn( "Failed to inline signature/digest element to the header. Cannot find reference id: {}", refId); } } } }
Source:
<code>public List<@Nullable Object> getOngoingStateValues() { fRWLock.readLock().lock(); try { <START> return Collections.unmodifiableList(fOngoingStateInfo); <END> } finally { fRWLock.readLock().unlock(); } }</code><technical_language>This returns a view of transient state is transient, e.g. changes transient state visible user of this method. I if OK? of it, queryOngoing*() methods in ITmfStateSystemBuilder instead of ITmfStateSystem</technical_language>

Target:
public List<@Nullable Object> getOngoingStateValues() { fRWLock.readLock().lock(); try { return new ArrayList<>(fOngoingStateInfo); } finally { fRWLock.readLock().unlock(); } }
Source:
<code>public Collection<Source> getAllSources() { RestTemplate restTemplate = new RestTemplate(); String url = ClientUtils.getSourceUrl(config, SOURCE_QUERY); HttpHeaders headers = ClientUtils.getAuthHeaders(config); HttpEntity<String> request = new HttpEntity<String>(headers); <START> Class<SourceAttrs[]> sourceAttrsClass = SourceAttrs[].class; <END> ResponseEntity<SourceAttrs[]> response = restTemplate.exchange(url, HttpMethod.GET, request, sourceAttrsClass); Collection<Source> sources = Lists.newArrayList(); for (SourceAttrs info : response.getBody()) { sources.add(info.createSource()); } return sources; }</code><technical_language>this need a separate variable declaration</technical_language>

Target:
public Collection<Source> getAllSources() { RestTemplate restTemplate = new RestTemplate(); String url = getUrl(); HttpHeaders headers = getAuthHeaders(); HttpEntity<String> request = new HttpEntity<String>(headers); ResponseEntity<SourceAttrs[]> response = restTemplate.exchange(url, HttpMethod.GET, request, SourceAttrs[].class); Collection<Source> sources = Lists.newArrayList(); for (SourceAttrs info : response.getBody()) { sources.add(info.createSource()); } return sources; }
Source:
<code><START> public Iterator<E> iterator(Predicate<E> filter) { <END> final Iterator<E> allEntities = loadAll(); final Iterator<E> result = filter(allEntities, filter); return result; }</code><technical_language>Please add /** {@inheritDoc} */ for this method delete below</technical_language>

Target:
public Iterator<E> iterator(Predicate<E> filter) { Iterator<E> allEntities = loadAll(); Iterator<E> result = filter(allEntities, filter); return result; }
Source:
<code>public <T> T map(Multihash hash, Function<Multihash, T> success, Function<Throwable, T> absent) { try { return success.apply(hash); } catch (AmazonServiceException e) { if ("NoSuchKey".equals(e.getErrorCode())) { Histogram.Timer readTimer = readTimerLog.labels("0").startTimer(); <START> readTimer.observeDuration(); <END> return absent.apply(e); } LOG.warning("AmazonServiceException: " + e.getMessage()); LOG.warning("AWS Error Code: " + e.getErrorCode()); throw new RuntimeException(e.getMessage(), e); } catch (AmazonClientException e) { LOG.severe("AmazonClientException: " + e.getMessage()); LOG.severe("Thrown at:" + e.getCause().toString()); throw new RuntimeException(e.getMessage(), e); } }</code><technical_language>time this... noop</technical_language>

Target:
public <T> T map(Multihash hash, Function<Multihash, T> success, Function<Throwable, T> absent) { try { return success.apply(hash); } catch (AmazonServiceException e) { if ("NoSuchKey".equals(e.getErrorCode())) { Histogram.Timer readTimer = readTimerLog.labels("absent").startTimer(); readTimer.observeDuration(); return absent.apply(e); } LOG.warning("AmazonServiceException: " + e.getMessage()); LOG.warning("AWS Error Code: " + e.getErrorCode()); throw new RuntimeException(e.getMessage(), e); } catch (AmazonClientException e) { LOG.severe("AmazonClientException: " + e.getMessage()); LOG.severe("Thrown at:" + e.getCause().toString()); throw new RuntimeException(e.getMessage(), e); } }
Source:
<code>private List<Queue.Item> filterQueue(List<Queue.Item> base) { if (!isFilterQueue()) { return base; } Collection<TopLevelItem> items = getItems(); List<Queue.Item> result = new ArrayList<Queue.Item>(); for (Queue.Item qi : base) { Queue.Task currentTask = null; do { currentTask = currentTask == null ? qi.task : currentTask.getOwnerTask(); if (items.contains(currentTask)) { result.add(qi); break; } <START> } while (currentTask.getOwnerTask() != currentTask); <END> if (qi.task instanceof AbstractProject<?, ?>) { AbstractProject<?,?> project = (AbstractProject<?, ?>) qi.task; if (items.contains(project.getRootProject())) { result.add(qi); } } } return result; }</code><technical_language>I a bug is results in infinite loop here. a bug (this.getOwnerTask() == this, I break out 10 iterations log a warning</technical_language>

Target:
private List<Queue.Item> filterQueue(List<Queue.Item> base) { if (!isFilterQueue()) { return base; } Collection<TopLevelItem> items = getItems(); return base.stream().filter(qi -> filterQueueItemTest(qi, items)) .collect(Collectors.toList()); }
Source:
<code>public void delete(Collection<RepositoryGroup> groupsToDelete) { for (RepositoryGroup group : groupsToDelete) { preferences .remove(PREFS_GROUP_PREFIX + <START> group.getGroupId().toString()); <END> groupMap.remove(group.getGroupId()); } savePreferences(); }</code><technical_language>necessary. + operator a string operand (the prefix) performs auto-stringification of other operand</technical_language>

Target:
public void delete(Collection<RepositoryGroup> groupsToDelete) { for (RepositoryGroup group : groupsToDelete) { preferences .remove(PREFS_GROUP_PREFIX + group.getGroupId()); groupMap.remove(group.getGroupId()); } savePreferences(); }
Source:
<code>private void createBanner() { <START> if (mVungleManager == null || pendingRequestBanner.compareAndSet(false, false)) <END> return; mVungleManager.cleanUpBanner(mPlacementForPlay); vungleNativeAd = mVungleManager.getVungleNativeAd(mAdapterId, mPlacementForPlay, adConfig, new VungleListener() { @Override void onAdEnd(String placement, boolean wasSuccessfulView, boolean wasCallToActionClicked) { if (mMediationBannerListener != null) { if (wasCallToActionClicked) { mMediationBannerListener.onAdClicked(VungleInterstitialAdapter.this); mMediationBannerListener.onAdOpened(VungleInterstitialAdapter.this); mMediationBannerListener.onAdLeftApplication(VungleInterstitialAdapter.this); mMediationBannerListener.onAdClosed(VungleInterstitialAdapter.this); } } } @Override void onAdStart(String placement) { mVungleManager.loadAd(mAdapterId, placement, null); } @Override void onAdFail(String placement) { if (mMediationBannerListener != null) { mMediationBannerListener.onAdFailedToLoad(VungleInterstitialAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } } }); View adView = vungleNativeAd == null ? null : vungleNativeAd.renderNativeView(); if (adView != null) { updateVisibility(); adLayout.addView(adView); } else { if (mMediationBannerListener != null) { mMediationBannerListener.onAdFailedToLoad(VungleInterstitialAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } } }</code><technical_language>I is a bit Confusing, setting here. !pendingRequestBanner.get() is easier read. Missing brackets</technical_language>

Target:
private void createBanner() { if (mVungleManager == null || !pendingRequestBanner.get()) return; mVungleManager.cleanUpBanner(mPlacementForPlay); vungleNativeAd = mVungleManager.getVungleNativeAd(mPlacementForPlay, adConfig, new VungleListener() { @Override void onAdEnd(String placement, boolean wasSuccessfulView, boolean wasCallToActionClicked) { if (mMediationBannerListener != null) { if (wasCallToActionClicked) { mMediationBannerListener.onAdClicked(VungleInterstitialAdapter.this); mMediationBannerListener.onAdOpened(VungleInterstitialAdapter.this); mMediationBannerListener.onAdClosed(VungleInterstitialAdapter.this); } } } @Override void onAdStart(String placement) { mVungleManager.loadAd(placement, null); } @Override void onAdFail(String placement) { if (mMediationBannerListener != null) { mMediationBannerListener.onAdFailedToLoad(VungleInterstitialAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } } }); View adView = vungleNativeAd != null ? vungleNativeAd.renderNativeView() : null; if (adView != null) { updateVisibility(); adLayout.addView(adView); if (mMediationBannerListener != null) { mMediationBannerListener.onAdLoaded(VungleInterstitialAdapter.this); } } else { if (mMediationBannerListener != null) { mMediationBannerListener.onAdFailedToLoad(VungleInterstitialAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR); } } }
Source:
<code>private Map<String, String> getPropertyOverrides() { ServletContext context = ResteasyProviderFactory.getContextData(ServletContext.class); Map<String, String> propertyOverridesMap = new HashMap<>(); String propertyOverrides = context.getInitParameter(SERVER_CONTEXT_CONFIG_PROPERTY_OVERRIDES); try { if (context.getInitParameter(SERVER_CONTEXT_CONFIG_PROPERTY_OVERRIDES) != null) { <START> JsonNode jsonObj = new ObjectMapper().readTree(propertyOverrides); <END> jsonObj.fields().forEachRemaining(e -> propertyOverridesMap.put(e.getKey(), e.getValue().asText())); } } catch (IOException e) { } return propertyOverridesMap; }</code><technical_language>Ideally, org.keycloak.util.JsonSerialization for parsing Json Jackson. object mapper instance is there</technical_language>

Target:
private Map<String, String> getPropertyOverrides() { ServletContext context = ResteasyProviderFactory.getContextData(ServletContext.class); Map<String, String> propertyOverridesMap = new HashMap<>(); String propertyOverrides = context.getInitParameter(SERVER_CONTEXT_CONFIG_PROPERTY_OVERRIDES); try { if (context.getInitParameter(SERVER_CONTEXT_CONFIG_PROPERTY_OVERRIDES) != null) { JsonNode jsonObj = JsonSerialization.mapper.readTree(propertyOverrides); jsonObj.fields().forEachRemaining(e -> propertyOverridesMap.put(e.getKey(), e.getValue().asText())); } } catch (IOException e) { } return propertyOverridesMap; }
Source:
<code>private void verifyIdentificationHeader(BitInputStream input) throws IOException { verifyTypeAndHeader("Identification", input, 0x80); <START> checkHeaderField("Identification", "VMAJ", input, 8, not(v -> v != 3)); <END> checkHeaderField("Identification", "VMIN", input, 8, not(v -> v != 2)); checkHeaderField("Identification", "VREV", input, 8, not(v -> v > 1)); int FMBW = checkHeaderField("Identification", "FMBW", input, 16, not(v -> v == 0)); int FMBH = checkHeaderField("Identification", "FMBH", input, 16, not(v -> v == 0)); checkHeaderField( "Identification", "PICW", input, 24, not(v -> v > FMBW * 16)); checkHeaderField("Identification", "PICH", input, 24, not(v -> v > FMBH * 16)); checkHeaderField("Identification", "PICX", input, 8, not(v -> v > FMBW * 16 - v)); checkHeaderField("Identification", "PICY", input, 8, not(v -> v > FMBH * 16 - v)); checkHeaderField("Identification", "FRN", input, 32, not(v -> v == 0)); checkHeaderField("Identification", "FRD", input, 32, not(v -> v == 0)); input.skip(48); checkHeaderField("Identification", "CS", input, 8, not(v -> !(v == 0 || v == 1 || v == 2))); input.skip(35); checkHeaderField("Identification", "PF", input, 2, not(v -> v == 1)); checkHeaderField("Identification", "Res", input, 3, not(v -> v != 0)); }</code><technical_language>usage of harder read if inverted, I think</technical_language>

Target:
private void verifyIdentificationHeader(BitInputStream input) throws IOException { verifyTypeAndHeader("Identification", input, 0x80); checkHeaderField("Identification", "VMAJ", input, 8, not(v -> v != 3)); checkHeaderField("Identification", "VMIN", input, 8, not(v -> v != 2)); input.skip(8); int FMBW = checkHeaderField("Identification", "FMBW", input, 16, v -> v > 0); int FMBH = checkHeaderField("Identification", "FMBH", input, 16, v -> v > 0); checkHeaderField("Identification", "PICW", input, 24, not(v -> v > FMBW * 16)); checkHeaderField("Identification", "PICH", input, 24, not(v -> v > FMBH * 16)); checkHeaderField("Identification", "PICX", input, 8, not(v -> v > FMBW * 16 - v)); checkHeaderField("Identification", "PICY", input, 8, not(v -> v > FMBH * 16 - v)); checkHeaderField("Identification", "FRN", input, 32, v -> v > 0); checkHeaderField("Identification", "FRD", input, 32, v -> v > 0); input.skip(48); checkHeaderField("Identification", "CS", input, 8, v -> v == 0 || v == 1 || v == 2); input.skip(35); checkHeaderField("Identification", "PF", input, 2, not(v -> v == 1)); checkHeaderField("Identification", "Res", input, 3, not(v -> v != 0)); }
Source:
<code>@Override public Scope decorateScope(@Nullable TraceContext currentSpan, Scope scope) { ScopeEvent event = new ScopeEvent(); if (!event.isEnabled()) return scope; if (currentSpan != null) { event.traceId = currentSpan.traceIdString(); event.parentId = currentSpan.parentIdString(); event.spanId = currentSpan.spanIdString(); } event.begin(); class JfrCurrentTraceContextScope implements Scope { @Override public void close() { scope.close(); if (!event.shouldCommit()) return; event.end(); <START> event.commit(); <END> } } return new JfrCurrentTraceContextScope(); }</code><technical_language>need check shouldCommit, need end commit (in JDK 11). Simply call event.commit()</technical_language>

Target:
@Override public Scope decorateScope(@Nullable TraceContext currentSpan, Scope scope) { ScopeEvent event = new ScopeEvent(); if (!event.isEnabled()) return scope; if (currentSpan != null) { event.traceId = currentSpan.traceIdString(); event.parentId = currentSpan.parentIdString(); event.spanId = currentSpan.spanIdString(); } event.begin(); class JfrCurrentTraceContextScope implements Scope { @Override public void close() { scope.close(); event.commit(); } } return new JfrCurrentTraceContextScope(); }
Source:
<code>private void handleSimpleBlob(BlobData blobData, byte[] userMetadata, ByteBuffer encryptionKey) { totalSize = blobData.getSize(); chunkSize = totalSize; boolean rangeResolutionFailure = false; if (encryptionKey == null) { rangeResolutionFailure = resolveRange(totalSize); } else { } if (!rangeResolutionFailure) { chunkIdIterator = null; dataChunks = null; chunkIndex = 0; numChunksTotal = 1; if (encryptionKey == null) { chunkIndexToBuffer.put(0, filterChunkToRange(blobData.getStream().getByteBuffer())); numChunksRetrieved = 1; } else { logger.trace("Submitting decrypt job for simple blob {}", blobId); long startTimeMs = System.currentTimeMillis(); decryptCallbackResultInfo = new DecryptCallBackResultInfo(); progressTracker.initializeDecryptionTracker(); <START> decryptJobMetricsTracker = new CryptoJobMetricsTracker(routerMetrics.decryptJobMetrics); <END> decryptJobMetricsTracker.startTracker(); cryptoJobHandler.submitJob(new DecryptJob(blobId, encryptionKey, blobData.getStream().getByteBuffer(), userMetadata != null ? ByteBuffer.wrap(userMetadata) : null, cryptoService, kms, decryptJobMetricsTracker, (DecryptJob.DecryptJobResult result, Exception exception) -> { routerMetrics.decryptTimeMs.update(System.currentTimeMillis() - startTimeMs); logger.trace("Handling decrypt job call back for simple blob to set decrypt callback results", blobId); decryptCallbackResultInfo.setResultAndException(result, exception); routerCallback.onPollReady(); })); } } }</code><technical_language>need understand created multiple places - a hard follow</technical_language>

Target:
private void handleSimpleBlob(BlobData blobData, byte[] userMetadata, ByteBuffer encryptionKey) { totalSize = blobData.getSize(); chunkSize = totalSize; boolean rangeResolutionFailure = false; if (encryptionKey == null) { rangeResolutionFailure = resolveRange(totalSize); } else { } if (!rangeResolutionFailure) { chunkIdIterator = null; dataChunks = null; chunkIndex = 0; numChunksTotal = 1; if (encryptionKey == null) { chunkIndexToBuffer.put(0, filterChunkToRange(blobData.getStream().getByteBuffer())); numChunksRetrieved = 1; } else { logger.trace("Submitting decrypt job for simple blob {}", blobId); long startTimeMs = System.currentTimeMillis(); decryptCallbackResultInfo = new DecryptCallBackResultInfo(); progressTracker.initializeDecryptionTracker(); decryptJobMetricsTracker.onJobSubmission(); cryptoJobHandler.submitJob(new DecryptJob(blobId, encryptionKey, blobData.getStream().getByteBuffer(), userMetadata != null ? ByteBuffer.wrap(userMetadata) : null, cryptoService, kms, decryptJobMetricsTracker, (DecryptJob.DecryptJobResult result, Exception exception) -> { routerMetrics.decryptTimeMs.update(System.currentTimeMillis() - startTimeMs); decryptJobMetricsTracker.onJobCallbackProcessingStart(); logger.trace("Handling decrypt job call back for simple blob to set decrypt callback results", blobId); decryptCallbackResultInfo.setResultAndException(result, exception); routerCallback.onPollReady(); decryptJobMetricsTracker.onJobCallbackProcessingComplete(); })); } } }
Source:
<code>static boolean upgradeDeviceIdToDB(Context context, String sourcePkgName) { if (sourcePkgName == null) { sourcePkgName = Constants.PACKAGE_NAME; } String prefsName = sourcePkgName + "." + context.getPackageName(); SharedPreferences preferences = context.getSharedPreferences(prefsName, Context.MODE_PRIVATE); String deviceId = preferences.getString(Constants.PREFKEY_DEVICE_ID, null); if (!TextUtils.isEmpty(deviceId)) { DatabaseHelper dbHelper = DatabaseHelper.getDatabaseHelper(context); dbHelper.insertOrReplaceKeyValue(DEVICE_ID_KEY, deviceId); <START> } <END> return true; }</code><technical_language>remove source device id this transfer once</technical_language>

Target:
static boolean upgradeDeviceIdToDB(Context context, String sourcePkgName) { if (sourcePkgName == null) { sourcePkgName = Constants.PACKAGE_NAME; } String prefsName = sourcePkgName + "." + context.getPackageName(); SharedPreferences preferences = context.getSharedPreferences(prefsName, Context.MODE_PRIVATE); String deviceId = preferences.getString(Constants.PREFKEY_DEVICE_ID, null); if (!TextUtils.isEmpty(deviceId)) { DatabaseHelper dbHelper = DatabaseHelper.getDatabaseHelper(context); dbHelper.insertOrReplaceKeyValue(DEVICE_ID_KEY, deviceId); preferences.edit().remove(Constants.PREFKEY_DEVICE_ID).apply(); } return true; }
Source:
<code>public <T> T await(Operation<Optional<T>> f) { TaskState pollState = state.nestedState(stateKey); Long startTime = pollState.params().get(START_TIME, Long.class, null); if (startTime == null) { startTime = System.currentTimeMillis(); pollState.params().set(START_TIME, startTime); } TaskState operationState = pollState.nestedState(OPERATION); <START> Long now = System.currentTimeMillis(); <END> if (timeout.isPresent() && timeout.get().toMillis() <= now - startTime) { logger.debug("Timeout happened. startTime:{}, timeout:{}", startTime, timeout.get()); throw new PollingTimeoutException("Timeout happened"); } Optional<T> result; try { result = f.perform(operationState); } catch (Throwable e) { throw Throwables.propagate(e); } if (!result.isPresent()) { int iteration = pollState.params().get(ITERATION, int.class, 0); pollState.params().set(ITERATION, iteration + 1); int interval = (int) Math.min(pollInterval.min().getSeconds() * Math.pow(nextIntervalExpBase, iteration), pollInterval.max().getSeconds()); String formattedErrorMessage = String.format(waitMessage, waitMessageParameters); logger.info("{}: checking again in {}", formattedErrorMessage, Durations.formatDuration(Duration.ofSeconds(interval))); throw pollState.pollingTaskExecutionException(interval); } pollState.params().remove(OPERATION); pollState.params().remove(ITERATION); return result.get(); }</code><technical_language>boxed type unnecessary suggestion long = System.currentTimeMillis();</technical_language>

Target:
public <T> T await(Operation<Optional<T>> f) { TaskState pollState = state.nestedState(stateKey); Optional<Instant> startTime = pollState.params().getOptional(START_TIME, Instant.class); if (!startTime.isPresent()) { startTime = Optional.of(Instant.now()); pollState.params().set(START_TIME, startTime.get()); } TaskState operationState = pollState.nestedState(OPERATION); Optional<T> result; try { result = f.perform(operationState); } catch (Throwable e) { throw Throwables.propagate(e); } Instant now = Instant.now(); if (timeout.isPresent() && timeout.get().toMillis() <= now.toEpochMilli() - startTime.get().toEpochMilli()) { logger.trace("Timeout happened. startTime:{}, timeout:{}", startTime, timeout.get()); throw new PollingTimeoutException("Timeout happened"); } if (!result.isPresent()) { int iteration = pollState.params().get(ITERATION, int.class, 0); pollState.params().set(ITERATION, iteration + 1); int interval = calculateNextInterval(now, startTime.get(), iteration); String formattedErrorMessage = String.format(waitMessage, waitMessageParameters); logger.info("{}: checking again in {}", formattedErrorMessage, Durations.formatDuration(Duration.ofSeconds(interval))); throw pollState.pollingTaskExecutionException(interval); } pollState.params().remove(OPERATION); pollState.params().remove(ITERATION); return result.get(); }
Source:
<code><START> private boolean isAllowed( <END> MutableHttpServletRequest request, String paramName, String method) { String typeNameParam = request.getParameterIgnoreCase(paramName); List<Layer> all = layerService.findAll(); boolean match = false; for (Layer layer : all) { if (layer.getSource() instanceof WfsLayerDataSource) { WfsLayerDataSource source = (WfsLayerDataSource) layer.getSource(); if ((source.getTypeName().equalsIgnoreCase(typeNameParam) || source.getTypeNames().equalsIgnoreCase(typeNameParam)) && source.getUrl().equalsIgnoreCase(request.getContextPath() + "/geoserver.action")) { if (method.equals("UPDATE")) { match = checkForPermission(layer, Permission.UPDATE); } else if (method.equals("READ")) { match = true; } } } else if (layer.getSource() instanceof ImageWmsLayerDataSource) { ImageWmsLayerDataSource source = (ImageWmsLayerDataSource) layer.getSource(); if (source.getLayerNames().equalsIgnoreCase(typeNameParam) && source.getUrl().equalsIgnoreCase(request.getContextPath() + "/geoserver.action")) { if (method.equals("UPDATE")) { match = checkForPermission(layer, Permission.UPDATE); } else if (method.equals("READ")) { match = true; } } } } return match; }</code><technical_language>check if reuse hasPermission method of PermissionEvaluator</technical_language>

Target:
private boolean isAllowed( MutableHttpServletRequest request, String paramName, String method) { String typeNameParam = request.getParameterIgnoreCase(paramName); List<Layer> all = layerService.findAll(); boolean match = false; for (Layer layer : all) { if (layer.getSource() instanceof WfsLayerDataSource) { WfsLayerDataSource source = (WfsLayerDataSource) layer.getSource(); if ((source.getTypeName().equalsIgnoreCase(typeNameParam) || source.getTypeNames().equalsIgnoreCase(typeNameParam)) && source.getUrl().equalsIgnoreCase(request.getContextPath() + "/geoserver.action")) { if (method.equals("UPDATE")) { match = checkForPermission(layer, Permission.UPDATE); } else if (method.equals("READ")) { match = true; } break; } } else if (layer.getSource() instanceof ImageWmsLayerDataSource) { ImageWmsLayerDataSource source = (ImageWmsLayerDataSource) layer.getSource(); if (source.getLayerNames().equalsIgnoreCase(typeNameParam) && source.getUrl().equalsIgnoreCase(request.getContextPath() + "/geoserver.action")) { if (method.equals("UPDATE")) { match = checkForPermission(layer, Permission.UPDATE); } else if (method.equals("READ")) { match = true; } break; } } } return match; }
Source:
<code>private void resetComponents() { <START> PlatformImpl.runLater(()-> { <END> webEngine.setJavaScriptEnabled(false); javaScriptButton.setText(enableJavaScriptTxt); }); loadWebEngineContent(""); }</code><technical_language>PlatformImpl Platform</technical_language>

Target:
private void resetComponents() { Platform.runLater(()-> { webEngine.setJavaScriptEnabled(false); javaScriptButton.setText(enableJavaScriptTxt); }); loadWebEngineContent(""); }
Source:
<code>public void onEvent(UnsupportedDMNEvent event) { <START> confirmPopupPresenter.show("Unsupported DMN", event.getMessage()); <END> }</code><technical_language>Change to: > Unsupported DMN asset</technical_language>

Target:
public void onEvent(UnsupportedDMNEvent event) { confirmPopupPresenter.show("Unsupported DMN asset", event.getMessage()); }
Source:
<code>public Object deserialize(Object serializedSketch) { if (serializedSketch instanceof String) { String str = (String) serializedSketch; return deserializeFromByteArray(Base64.decodeBase64(str.getBytes(Charsets.UTF_8))); } else if (serializedSketch instanceof byte[]) { return deserializeFromByteArray((byte[]) serializedSketch); } else if (serializedSketch instanceof MomentSketchWrapper) { return (MomentSketchWrapper) serializedSketch; } throw new ISE( "Object is not of a type that can be deserialized to a Moments Sketch" + serializedSketch.getClass()); <START> <END> }</code><technical_language>extra line</technical_language>

Target:
public Object deserialize(Object serializedSketch) { if (serializedSketch instanceof String) { String str = (String) serializedSketch; return deserializeFromByteArray(StringUtils.decodeBase64(StringUtils.toUtf8(str))); } else if (serializedSketch instanceof byte[]) { return deserializeFromByteArray((byte[]) serializedSketch); } else if (serializedSketch instanceof MomentSketchWrapper) { return serializedSketch; } throw new ISE( "Object cannot be deserialized to a Moments Sketch: " + serializedSketch.getClass() ); }
Source:
<code>public boolean writeHPCCFileData(byte data, String fileName, String targetLandingZone, boolean append, long offset, int uploadchunksize) throws Exception { boolean success = true; log.debug("Attempting to write data to HPCC File: " + fileName); getSoapProxy(); WriteFileDataRequest writefileparams = new WriteFileDataRequest(); writefileparams.setAppend(append); writefileparams.setDestDropZone(targetLandingZone); writefileparams.setDestRelativePath(fileName); writefileparams.setOffset(offset); int dataindex = 0; int limit = uploadchunksize <= 0 ? defaultUploadChunkSize : uploadchunksize; int payloadsize = 0; int bytesleft = data.length; byte subdata = null; while (bytesleft > 0) { payloadsize = bytesleft >= limit ? limit : bytesleft; log.trace("Writing offset: "+dataindex+"\t size: "+(dataindex + payloadsize)); <START> subdata = Arrays.copyOfRange(data, 0, payloadsize-1); <END> writefileparams.setData(subdata); writefileparams.setAppend(dataindex > 0); writefileparams.setOffset((long)dataindex); try { WriteFileDataResponse writeFileDataResponse = wsFileIOServiceSoapProxy.writeFileData(writefileparams); String result = writeFileDataResponse.getResult(); log.debug(result); if (!result.startsWith("Failed")) { success = true; bytesleft = bytesleft - subdata.length; } else { bytesleft = 0; } } catch (Exception e) { log.error(e.getLocalizedMessage()); return false; } } return success; }</code><technical_language>changing copy offset. I this like: int end = dataindex + payloadsize-1; subdata = Arrays.copyOfRange(data, dataindex, end); dataindex += payloadsize;</technical_language>

Target:
public boolean writeHPCCFileData(byte data, String fileName, String targetLandingZone, boolean append, long offset, int uploadchunksize) throws Exception { boolean success = true; log.debug("Attempting to write data to HPCC File: " + fileName); getSoapProxy(); WriteFileDataRequest writefileparams = new WriteFileDataRequest(); writefileparams.setAppend(append); writefileparams.setDestDropZone(targetLandingZone); writefileparams.setDestRelativePath(fileName); writefileparams.setOffset(offset); int dataindex = 0; int limit = uploadchunksize <= 0 ? defaultUploadChunkSize : uploadchunksize; int payloadsize = 0; int bytesleft = data.length; byte subdata = null; while (bytesleft > 0) { payloadsize = bytesleft >= limit ? limit : bytesleft; log.trace("Writing offset: "+dataindex+"\t size: " + payloadsize); subdata = Arrays.copyOfRange(data, dataindex, dataindex + payloadsize); dataindex += payloadsize; writefileparams.setData(subdata); writefileparams.setAppend(dataindex > 0); writefileparams.setOffset((long)dataindex); try { WriteFileDataResponse writeFileDataResponse = wsFileIOServiceSoapProxy.writeFileData(writefileparams); String result = writeFileDataResponse.getResult(); log.debug(result); if (!result.startsWith("Failed")) { success = true; bytesleft = bytesleft - subdata.length; } else { bytesleft = 0; } } catch (Exception e) { log.error(e.getLocalizedMessage()); return false; } } return success; }
Source:
<code>public void inflatesubmissionDate() { mfDatePicker = MFDatePicker.newInsance(this); tvSubmittedOnDate.setText(MFDatePicker.getDatePickedAsString()); <START> tvSubmittedOnDate.setOnClickListener(new View.OnClickListener() { <END> @Override public void onClick(View view) { mfDatePicker.show(getActivity().getSupportFragmentManager(), FragmentConstants .DFRAG_DATE_PICKER); } }); }</code><technical_language>ButterKnife. Please remove this OnClickListener implementation Butter Knife @OnClick annotation</technical_language>

Target:
public void inflatesubmissionDate() { mfDatePicker = MFDatePicker.newInsance(this); tvSubmittedOnDate.setText(MFDatePicker.getDatePickedAsString()); }
Source:
<code>public void addFile(String fileName, File file) throws Exception { Git gitProject = getGitProject(); CommonTestUtil.copy(file, new File(getFolder(), fileName)); <START> gitProject.add().addFilepattern(".").call(); <END> }</code><technical_language>consider file name adding files ("."). result same, though</technical_language>

Target:
public void addFile(String fileName, File file) throws Exception { Git gitProject = getGitProject(); CommonTestUtil.copy(file, new File(getFolder(), fileName)); gitProject.add().addFilepattern(fileName).call(); }
Source:
<code>public void multiIndex_incompatibleAnalyzer_skipAnalysis() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.phrase().onField( absoluteFieldPath ).matching( PHRASE_1_UNIQUE_TERM ) .skipAnalysis() ) .toQuery(); <START> assertThat( query ).assertThat( query ).hasDocRefHitsAnyOrder( b -> { <END> b.doc( INDEX_NAME, DOCUMENT_1, DOCUMENT_2, DOCUMENT_3, DOCUMENT_4 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }</code><technical_language>assertThat( query ).assertThat( query )</technical_language>

Target:
public void multiIndex_incompatibleAnalyzer_skipAnalysis() { StubMappingSearchScope scope = indexManager.createSearchScope( incompatibleAnalyzerIndexManager ); String absoluteFieldPath = indexMapping.analyzedStringField1.relativeFieldName; IndexSearchQuery<DocumentReference> query = scope.query().asReference() .predicate( f -> f.phrase().onField( absoluteFieldPath ).matching( PHRASE_1_UNIQUE_TERM ) .skipAnalysis() ) .toQuery(); assertThat( query ).hasDocRefHitsAnyOrder( b -> { b.doc( INDEX_NAME, DOCUMENT_1, DOCUMENT_2, DOCUMENT_3, DOCUMENT_4 ); b.doc( INCOMPATIBLE_ANALYZER_INDEX_NAME, INCOMPATIBLE_ANALYZER_INDEX_DOCUMENT_1 ); } ); }
Source:
<code>public AzureMonitorExporterBuilder connectionString(String connectionString) { <START> this.instrumentationKey = extractInstrumentationKey(connectionString); <END> return this; }</code><technical_language>I ideally extract IngestionEndpoint connection string expose endpoint()</technical_language>

Target:
public AzureMonitorExporterBuilder connectionString(String connectionString) { Map<String, String> keyValues = extractKeyValuesFromConnectionString(connectionString); if (!keyValues.containsKey("InstrumentationKey")) { throw logger.logExceptionAsError( new IllegalArgumentException("InstrumentationKey not found in connectionString")); } this.instrumentationKey = keyValues.get("InstrumentationKey"); String endpoint = keyValues.get("IngestionEndpoint"); if (endpoint != null) { this.endpoint(endpoint); } return this; }
Source:
<code>private void waitForJobStatusChangeOrTimeout(SolverManager<TestdataSolution, Long> solverManager, Long problemId, SolverStatus expectedStatusChange) throws InterruptedException { long t = System.currentTimeMillis(); long end = t + 5000; <START> while (true) { <END> t = System.currentTimeMillis(); if (t < end) { if (solverManager.getSolverStatus(problemId) == expectedStatusChange) { break; } TimeUnit.MILLISECONDS.sleep(5); } else { fail("Job with id " + problemId + " took too long and timed-out not changing its status from " + solverManager.getSolverStatus(problemId) + " to " + expectedStatusChange + "."); } } }</code><technical_language>a nitpicking: condition put in while clause avoid break in middle of loop</technical_language>

Target:
private void waitForJobStatusChangeOrTimeout(SolverManager<TestdataSolution, Long> solverManager, Long problemId, SolverStatus expectedStatusChange) throws InterruptedException { long t = System.currentTimeMillis(); long end = t + 5000; while (t < end) { if (solverManager.getSolverStatus(problemId) == expectedStatusChange) { return; } TimeUnit.MILLISECONDS.sleep(5); t = System.currentTimeMillis(); } fail("Job with id " + problemId + " took too long and timed-out not changing its status from " + solverManager.getSolverStatus(problemId) + " to " + expectedStatusChange + "."); }
Source:
<code>private String branchUrlOf(Project project, Branch branch) { if (branch.getType() == Branch.Type.LONG) { if (branch.isMain()) { return projectUrlOf(project); } return format("%s/dashboard?branch=%s&id=%s", server.getPublicRootUrl(), encode(branch.getName().orElse("")), encode(project.getKey())); <START> } else if (branch.getType() == Branch.Type.SHORT) { <END> return format("%s/project/issues?branch=%s&id=%s&resolved=false", server.getPublicRootUrl(), encode(branch.getName().orElse("")), encode(project.getKey())); } else { return format("%s/project/issues?pullRequest=%s&id=%s&resolved=false", server.getPublicRootUrl(), encode(branch.getName().orElse("")), encode(project.getKey())); } }</code><technical_language>suggestion: case switch throw fail (silently?) if branch type is handled</technical_language>

Target:
private String branchUrlOf(Project project, Branch branch) { if (branch.getType() == Branch.Type.LONG) { if (branch.isMain()) { return projectUrlOf(project); } return format("%s/dashboard?branch=%s&id=%s", server.getPublicRootUrl(), encode(branch.getName().orElse("")), encode(project.getKey())); } if (branch.getType() == Branch.Type.SHORT) { return format("%s/project/issues?branch=%s&id=%s&resolved=false", server.getPublicRootUrl(), encode(branch.getName().orElse("")), encode(project.getKey())); } if (branch.getType() == Branch.Type.PULL_REQUEST) { return format("%s/project/issues?pullRequest=%s&id=%s&resolved=false", server.getPublicRootUrl(), encode(branch.getName().orElse("")), encode(project.getKey())); } return projectUrlOf(project); }
Source:
<code>public boolean isApplicable(UpgradeCheckRequest request) throws AmbariException { UpgradeType upgradeType = request.getUpgradeType(); UpgradeCheckInfo annotation = m_checkClass.getAnnotation(UpgradeCheckInfo.class); if (null == annotation) { return true; } UpgradeType[] upgradeTypes = annotation.required(); <START> if (ArrayUtils.isEmpty(upgradeTypes) || ArrayUtils.contains(upgradeTypes, upgradeType)) { <END> return true; } return false; }</code><technical_language>simplify: return ..</technical_language>

Target:
public boolean isApplicable(UpgradeCheckRequest request) throws AmbariException { UpgradeType upgradeType = request.getUpgradeType(); UpgradeCheckInfo annotation = m_checkClass.getAnnotation(UpgradeCheckInfo.class); if (null == annotation) { return true; } UpgradeType[] upgradeTypes = annotation.required(); return (ArrayUtils.isEmpty(upgradeTypes) || ArrayUtils.contains(upgradeTypes, upgradeType)); }
Source:
<code>public void receiveDmg(float dmg, SolGame game, Vector2 position, DmgType dmgType) { <START> if(isInvincible == true){ <END> return; } if (dmg <= 0) { return; } if (myShield != null && myShield.canAbsorb(dmgType)) { myShield.absorb(game, dmg, position, this, dmgType); return; } if (myArmor != null) { if (dmgType == DmgType.ENERGY) { dmg *= ENERGY_DMG_FACTOR; } dmg *= (1 - myArmor.getPerc()); } getHitWith(dmg, game, position, dmgType); }</code><technical_language>Please, do compare booleans true. Ever. is ugly. Also, space brace. suggestion if (isInvincible) {</technical_language>

Target:
public void receiveDmg(float dmg, SolGame game, Vector2 position, DmgType dmgType) { Hero hero = game.getHero(); if (dmg <= 0 || (hero.isInvincible() && hero.getShip() == this)) { return; } if (myShield != null && myShield.canAbsorb(dmgType)) { myShield.absorb(game, dmg, position, this, dmgType); return; } if (myArmor != null) { if (dmgType == DmgType.ENERGY) { dmg *= ENERGY_DMG_FACTOR; } dmg *= (1 - myArmor.getPerc()); } getHitWith(dmg, game, position, dmgType); }
Source:
<code>public void run() { logger.debug("Error storing object to dynamo, unprocessed items: {}. Retrying with exponential back-off", unprocessedItems); lastException = null; while (!unprocessedItems.isEmpty() && retry < WAIT_MILLIS_IN_RETRIES.length) { if (!sleep()) { return; } retry++; try { BatchWriteItemOutcome outcome = DynamoDBPersistenceService.this.db.getDynamoDB() .batchWriteItemUnprocessed(unprocessedItems); unprocessedItems = outcome.getUnprocessedItems(); lastException = null; } catch (AmazonServiceException e) { if (e instanceof ResourceNotFoundException) { logger.debug( "DynamoDB query raised unexpected exception: {}. This might happen if table was recently created", e.getMessage()); } else { logger.debug("DynamoDB query raised unexpected exception: {}.", e.getMessage()); } lastException = e; continue; } } if (unprocessedItems.isEmpty()) { logger.debug("After retries successfully wrote all unprocessed items", retry); } else { <START> logger.error( <END> "Even after retries failed to write some items. Last exception: {}, unprocessed items: {}", lastException == null ? "null" : lastException.getClass().getName(), lastException == null ? "null" : lastException.getMessage(), unprocessedItems); } }</code><technical_language>This a WARN instead of ERROR</technical_language>

Target:
public void run() { logger.debug("Error storing object to dynamo, unprocessed items: {}. Retrying with exponential back-off", unprocessedItems); lastException = null; while (!unprocessedItems.isEmpty() && retry < WAIT_MILLIS_IN_RETRIES.length) { if (!sleep()) { return; } retry++; try { BatchWriteItemOutcome outcome = DynamoDBPersistenceService.this.db.getDynamoDB() .batchWriteItemUnprocessed(unprocessedItems); unprocessedItems = outcome.getUnprocessedItems(); lastException = null; } catch (AmazonServiceException e) { if (e instanceof ResourceNotFoundException) { logger.debug( "DynamoDB query raised unexpected exception: {}. This might happen if table was recently created", e.getMessage()); } else { logger.debug("DynamoDB query raised unexpected exception: {}.", e.getMessage()); } lastException = e; continue; } } if (unprocessedItems.isEmpty()) { logger.debug("After retries successfully wrote all unprocessed items", retry); } else { logger.warn( "Even after retries failed to write some items. Last exception: {}, unprocessed items: {}", lastException == null ? "null" : lastException.getClass().getName(), lastException == null ? "null" : lastException.getMessage(), unprocessedItems); } }