auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void importHostedEngineVm(final VM vm, final Guid vdsGroupId) { ThreadPoolUtil.execute(new Runnable() { public void run() { StorageDomain sd = (StorageDomain) ((ArrayList) backend.runInternalQuery( VdcQueryType.Search, new SearchParameters( "Storage: name=" + Config.<String>getValue(ConfigValues.HostedEngineStorageDomainName), SearchType.StorageDomain ) <START> ).getReturnValue()).get(0); <END> if (sd != null && sd.getStatus() == StorageDomainStatus.Active) { boolean removedUnmanagedHEVM = backend.runInternalAction( VdcActionType.RemoveVm, new RemoveVmParameters(vm.getId(), true)).getSucceeded(); if (removedUnmanagedHEVM) { ImportVmParameters parameters = new ImportVmParameters( vm, sd.getId(), sd.getId(), sd.getStoragePoolId(), vdsGroupId); Guid sdProfileId = diskProfileDao.getAllForStorageDomain(sd.getId()).get(0).getId(); for (DiskImage image : vm.getImages()) { image.setDiskProfileId(sdProfileId); image.setStorageIds(new ArrayList(Arrays.asList(sd.getId()))); image.setVmSnapshotId(Guid.newGuid()); } parameters.setImagesExistOnTargetStorageDomain(true); vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); VDSGroup vdsGroup = vdsGroupDAO.get(vdsGroupId); vm.setClusterArch(vdsGroup.getArchitecture()); vm.setCustomCpuName(vdsGroup.getCpuName()); vm.setCustomEmulatedMachine(vdsGroup.getEmulatedMachine()); backend.runInternalAction( VdcActionType.ImportVm, parameters); } } } }); }</code><technical_language>try this instead: getStorageDomainStaticDAO().getByName()</technical_language>

Target:
public void importHostedEngineVm(final VM vm, final Guid vdsGroupId) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { hostedEngineImporterProvider.get().run(vm, vdsGroupId); } }); }
Source:
<code>public String toString() { return "InjectionPoint of type " + requiredType + " with qualifiers " + qualifiers + <START> " which is " + (isDelegate ? "" : "not ") + "delegate and is" + (isTransient ? "" : "not ") + "transient."; <END> }</code><technical_language>delegate=true style fine</technical_language>

Target:
public String toString() { return "InjectionPoint with type=" + requiredType + ", qualifiers=" + qualifiers + ", delegate=" + isDelegate + ", transient=" + isTransient + "."; }
Source:
<code>public static void logoutAllUsers() { final CountDownLatch allUsersLoggedOut = new CountDownLatch(1); final HandlerThread ht = new HandlerThread("LoggingOutUsersThread"); ht.start(); Handler handler = new Handler(ht.getLooper()); handler.post(() -> { Map<String, SyncUser> users = SyncUser.all(); for (SyncUser user : users.values()) { user.logOut(); } TestHelper.waitForNetworkThreadExecutorToFinish(); allUsersLoggedOut.countDown(); }); TestHelper.awaitOrFail(allUsersLoggedOut); ht.quit(); try { <START> ht.join(TimeUnit.MILLISECONDS.convert(TestHelper.SHORT_WAIT_SECS, TimeUnit.SECONDS)); <END> } catch (InterruptedException e) { throw new AssertionError("LoggingOutUsersThread failed to finish in time"); } }</code><technical_language>I TimeUnit.SECONDS.toMillis(TestHelper.SHORT_WAIT_SECS) is more concise</technical_language>

Target:
public static void logoutAllUsers() { final CountDownLatch allUsersLoggedOut = new CountDownLatch(1); final HandlerThread ht = new HandlerThread("LoggingOutUsersThread"); ht.start(); Handler handler = new Handler(ht.getLooper()); handler.post(() -> { Map<String, SyncUser> users = SyncUser.all(); for (SyncUser user : users.values()) { user.logOut(); } TestHelper.waitForNetworkThreadExecutorToFinish(); allUsersLoggedOut.countDown(); }); TestHelper.awaitOrFail(allUsersLoggedOut); ht.quit(); try { ht.join(TimeUnit.SECONDS.toMillis(TestHelper.SHORT_WAIT_SECS)); } catch (InterruptedException e) { throw new AssertionError("LoggingOutUsersThread failed to finish in time"); } }
Source:
<code>public EntityEquipmentInvWrapper(final EntityLivingBase entity, final EntityEquipmentSlot.Type slotType) { this.entity = entity; final List<EntityEquipmentSlot> slots = new ArrayList<EntityEquipmentSlot>(); for (final EntityEquipmentSlot slot : EntityEquipmentSlot.values()) { if (slot.getSlotType() == slotType) { slots.add(slot.getIndex(), slot); } <START> } <END> this.slots = ImmutableList.copyOf(slots); }</code><technical_language>a fan of this, add non-congruent slots. inventory 'holes' A add instead of a indexed add</technical_language>

Target:
public EntityEquipmentInvWrapper(final EntityLivingBase entity, final EntityEquipmentSlot.Type slotType) { this.entity = entity; final List<EntityEquipmentSlot> slots = new ArrayList<EntityEquipmentSlot>(); for (final EntityEquipmentSlot slot : EntityEquipmentSlot.values()) { if (slot.getSlotType() == slotType) { slots.add(slot); } } this.slots = ImmutableList.copyOf(slots); }
Source:
<code>static public boolean isWorkunitComplete(WUState state) { <START> switch (state) <END> { case UNKNOWN_ONSERVER: case COMPLETED: case FAILED: case ABORTED: case ARCHIVED: case COMPILED: return true; } return false; }</code><technical_language>switch statement missing default case</technical_language>

Target:
static public boolean isWorkunitComplete(WUState state) { switch (state) { case UNKNOWN_ONSERVER: case COMPLETED: case FAILED: case ABORTED: case ARCHIVED: case COMPILED: return true; case ABORTING: case BLOCKED: case COMPILING: case LAST: case RUNNING: case SCHEDULED: case SUBMITTED: case UNKNOWN: case WAIT: default: return false; } }
Source:
<code>private List<Pair<Guid, Pair<Integer, Integer>>> getUnutilizedResources(List<VDS> hosts) { List<Pair<Guid, Pair<Integer, Integer>>> hostsUnutilizedResources = <START> new ArrayList<Pair<Guid, Pair<Integer, Integer>>>(); <END> for (VDS host : hosts) { Pair<Integer, Integer> innerUnutilizedCpuRamPair = new Pair<Integer, Integer>(); innerUnutilizedCpuRamPair.setFirst(100 - host.getUsageCpuPercent()); int hostFreeMem = 0; if (host.getPhysicalMemMb() != null && host.getUsageMemPercent() != null) { int usedMem = (int) Math.round(host.getPhysicalMemMb() * (host.getUsageMemPercent() / 100.0)); hostFreeMem = host.getPhysicalMemMb() - usedMem; } innerUnutilizedCpuRamPair.setSecond(hostFreeMem); Pair<Guid, Pair<Integer, Integer>> outerUnutilizedCpuRamPair = new Pair<Guid, Pair<Integer, Integer>>(); outerUnutilizedCpuRamPair.setFirst(host.getId()); outerUnutilizedCpuRamPair.setSecond(innerUnutilizedCpuRamPair); hostsUnutilizedResources.add(outerUnutilizedCpuRamPair); } return hostsUnutilizedResources; }</code><technical_language>a good place diamond operator drop type</technical_language>

Target:
private List<Pair<Guid, Pair<Integer, Integer>>> getUnutilizedResources(List<VDS> hosts) { List<Pair<Guid, Pair<Integer, Integer>>> hostsUnutilizedResources = new ArrayList<>(); for (VDS host : hosts) { Pair<Integer, Integer> innerUnutilizedCpuRamPair = new Pair<>(); int hostFreeCpu = 0; if (host.getUsageCpuPercent() != null) { hostFreeCpu = 100 - host.getUsageCpuPercent(); } innerUnutilizedCpuRamPair.setFirst(hostFreeCpu); int hostFreeMem = 0; if (host.getPhysicalMemMb() != null && host.getUsageMemPercent() != null) { int usedMem = (int) Math.round(host.getPhysicalMemMb() * (host.getUsageMemPercent() / 100.0)); hostFreeMem = host.getPhysicalMemMb() - usedMem; } innerUnutilizedCpuRamPair.setSecond(hostFreeMem); Pair<Guid, Pair<Integer, Integer>> outerUnutilizedCpuRamPair = new Pair<>(host.getId(), innerUnutilizedCpuRamPair); outerUnutilizedCpuRamPair.setFirst(host.getId()); outerUnutilizedCpuRamPair.setSecond(innerUnutilizedCpuRamPair); hostsUnutilizedResources.add(outerUnutilizedCpuRamPair); } return hostsUnutilizedResources; }
Source:
<code>private void waitUntilMirrorMakerIsRunning(EmbeddedConnectCluster connectCluster, Set<String> connNames) throws InterruptedException { for (String connector : connNames) { TestUtils.waitForCondition(() -> areConnectorAndTasksRunning(connectCluster, connector, MIN_TASKS), "Timed out trying to verify connector " + connector + " was up!" ); } <START> <END> }</code><technical_language>nit: unneeded newline</technical_language>

Target:
private void waitUntilMirrorMakerIsRunning(EmbeddedConnectCluster connectCluster, Set<String> connNames) throws InterruptedException { for (String connector : connNames) { TestUtils.waitForCondition(() -> areConnectorAndTasksRunning(connectCluster, connector), "Timed out trying to verify connector " + connector + " was up!"); } }
Source:
<code>public int run() { if (!options.mainDefinitionFile().exists()) { throw KEMException.criticalError("Definition file doesn't exist: " + options.mainDefinitionFile().getAbsolutePath()); } Kompile kompile = new Kompile(options, files, kem, sw); <START> CompiledDefinition def = null; <END> def = kompile.run(options.mainDefinitionFile(), options.mainModule(), options.syntaxModule(), Sorts.K(), koreBackend.get().steps(kompile)); loader.saveOrDie(files.resolveKompiled("compiled.bin"), def); koreBackend.get().accept(def); loader.saveOrDie(files.resolveKompiled("timestamp"), ""); sw.printIntermediate("Save to disk"); sw.printTotal("Total"); return 0; }</code><technical_language>debugging leftover</technical_language>

Target:
public int run() { if (!options.outerParsing.mainDefinitionFile(files).exists()) { throw KEMException.criticalError("Definition file doesn't exist: " + options.outerParsing.mainDefinitionFile(files).getAbsolutePath()); } Kompile kompile = new Kompile(options, files, kem, sw); CompiledDefinition def = kompile.run(options.outerParsing.mainDefinitionFile(files), options.mainModule(files), options.syntaxModule(files), Sorts.K(), koreBackend.get().steps(kompile)); loader.saveOrDie(files.resolveKompiled("compiled.bin"), def); koreBackend.get().accept(def); loader.saveOrDie(files.resolveKompiled("timestamp"), ""); sw.printIntermediate("Save to disk"); sw.printTotal("Total"); return 0; }
Source:
<code>public static void throwNonAggExpressionInAggException(String nonAggregateExpression) throws SQLException { <START> throw new SQLException("Aggregate query may not contain column that do not appear in the GROUP BY: " + nonAggregateExpression); <END> }</code><technical_language>this one? I a standard error code for this</technical_language>

Target:
public static void throwNonAggExpressionInAggException(String nonAggregateExpression) throws SQLException { throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_WITH_NOT_GROUP_BY_COLUMN) .setMessage(nonAggregateExpression).build().buildException(); }
Source:
<code>public void execute() { if (getEnclosingCommand().getParameters().getTaskGroupSuccess()) { getReturnValue().setSucceeded(false); beforeTask(); <START> Guid taskId = cmd.persistAsyncTaskPlaceHolder(cmd.getActionType()); <END> addTask(taskId, Backend.getInstance().getResourceManager() .RunVdsCommand(getVDSCommandType(), getVDSParameters()), false); } ExecutionHandler.setAsyncJob(getEnclosingCommand().getExecutionContext(), true); getReturnValue().setSucceeded(true); }</code><technical_language>please getEnclosingCommand()</technical_language>

Target:
public void execute() { if (getEnclosingCommand().getParameters().getTaskGroupSuccess()) { getReturnValue().setSucceeded(false); beforeTask(); Guid taskId = getEnclosingCommand().persistAsyncTaskPlaceHolder(getEnclosingCommand().getActionType()); addTask(taskId, Backend.getInstance().getResourceManager() .RunVdsCommand(getVDSCommandType(), getVDSParameters()), false); } ExecutionHandler.setAsyncJob(getEnclosingCommand().getExecutionContext(), true); getReturnValue().setSucceeded(true); }
Source:
<code>public void appendFrom(ReadableByteChannel channel, long size) throws IOException { MessageInfo messageInfo = messageInfoList.get(messageIndex); if (messageInfo.getSize() != size) { throw new IllegalStateException("Mismatched buffer length for blob: " + messageInfo.getStoreKey().getID()); } ByteBuffer messageBuf = ByteBuffer.allocate((int) size); int bytesRead = 0; while (bytesRead < size) { <START> bytesRead += channel.read(messageBuf); <END> } try { cloudBlobStore.putBlob(messageInfo, messageBuf, size); messageIndex++; } catch (Exception e) { throw new IOException(e); } }</code><technical_language>handle -1 return value. ReadableByteChannel return -1 if end of stream reached early for some reason</technical_language>

Target:
public void appendFrom(ReadableByteChannel channel, long size) throws IOException { MessageInfo messageInfo = messageInfoList.get(messageIndex); if (messageInfo.getSize() != size) { throw new IllegalStateException("Mismatched buffer length for blob: " + messageInfo.getStoreKey().getID()); } ByteBuffer messageBuf = ByteBuffer.allocate((int) size); int bytesRead = 0; while (bytesRead < size) { int readResult = channel.read(messageBuf); if (readResult == -1) { throw new IOException("Channel read returned -1 before reading expected number of bytes, blobId=" + messageInfo.getStoreKey().getID()); } bytesRead += readResult; } try { cloudBlobStore.putBlob(messageInfo, messageBuf, size); messageIndex++; } catch (Exception e) { throw new IOException(e); } }
Source:
<code>public void doSubscribeAdvertisement(Subscriber subscriber) throws IOException { try { <START> pckOut.end(); <END> for (String repository : subscriber.getAllRepositories()) { write("repository " + repository); pckOut.end(); } write("done advertisement"); readResponseHeader(subscriber); } finally { close(); } }</code><technical_language>odd start a transaction "0000"</technical_language>

Target:
public void doSubscribeAdvertisement(Subscriber subscriber) throws IOException { try { pckOut.writeString("advertisement"); for (String repository : subscriber.getAllRepositories()) { write("repositoryaccess " + repository); } pckOut.end(); readResponseHeader(); } finally { close(); } }
Source:
<code>void complete() { unregisterShutdownHook(); final Object lock = loggerNode.getContext().treeLock; <START> synchronized (publisher) { <END> publisher.drain(); synchronized (lock) { replacePublisher(loggerNode); } } }</code><technical_language>If publisher field lives log context, of tree lock (I think)</technical_language>

Target:
void complete() { if (!complete) { unregisterShutdownHook(); synchronized (publisher) { publisher.drain(); complete = true; } } }
Source:
<code>public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) { logger.info("Getting nearest structure {}", generator); if (isComplete()) { <START> FMLLog.bigWarning("Structure Gen Test in successful", generator); <END> } else { FMLLog.bigWarning("Structure Gen Test not successful. Spawn {}, isAt {}, generate {}, generateStructure {}", spawn, isAt, generate, generateStructure); } return new BlockPos(64, 0, 64); }</code><technical_language>info if error</technical_language>

Target:
public BlockPos getNearestStructurePos(World worldIn, BlockPos pos, boolean findUnexplored) { logger.info("Getting nearest structure {}", generator); if (isComplete()) { logger.info("[STRUCTURE-GEN-TEST] Test in successful", generator); } else { logger.info("[STRUCTURE-GEN-TEST] Test not successful. Spawn {}, isAt {}, generate {}, generateStructure {}", spawn, isAt, generate, generateStructure); } return new BlockPos(64, 0, 64); }
Source:
<code><START> private void spongeImpl$registerGoals(final MobEntity this$0) { <END> this.initSpongeAI(); this.shadow$registerGoals(); }</code><technical_language>Fix prefix, impl$</technical_language>

Target:
private void impl$registerGoals(final MobEntity this$0) { this.initSpongeAI(); this.shadow$registerGoals(); }
Source:
<code>public void setData_whenFileExists_updatesWidgetAnswer() { FormEntryPrompt prompt = promptWithAnswer(new StringData("blah.txt")); when(prompt.getIndex()).thenReturn(formIndex); ArbitraryFileWidget widget = createWidget(prompt); <START> widget.setBinaryData(mockedFile); <END> assertThat(widget.getAnswer().getDisplayText(), is("newFile.txt")); assertThat(widget.binding.answerTextView.getText(), is("newFile.txt")); }</code><technical_language>reason a mocked File here. If want create a file for test worry clean [createTempFile](<LINK_0>,%20java.lang.String,%20java.io.File))</technical_language>

Target:
public void setData_whenFileExists_updatesWidgetAnswer() throws IOException { File tempFile = File.createTempFile("newFile", "txt", fakeQuestionMediaManager.getDir()); tempFile.deleteOnExit(); ArbitraryFileWidget widget = createWidget(promptWithAnswer(null)); widget.setData(tempFile); assertThat(widget.getAnswer().getDisplayText(), is(tempFile.getName())); assertThat(widget.binding.answerTextView.getText(), is(tempFile.getName())); assertThat(widget.binding.answerLayout.getVisibility(), is(View.VISIBLE)); }
Source:
<code><START> private static Field convertToBasicSearchField(java.lang.reflect.Field classField, <END> ClientLogger logger) { Field searchField = new Field(); searchField.setName(classField.getName()); DataType dataType = covertToDataType(classField.getGenericType(), false, logger); searchField.setType(dataType); searchField.setKey(false); searchField.setSearchable(false); searchField.setFacetable(false); searchField.setHidden(false); searchField.setFilterable(false); searchField.setSortable(false); return searchField; }</code><technical_language>Field SearchField mode renames</technical_language>

Target:
private static Field convertToBasicSearchField(java.lang.reflect.Field classField, ClientLogger logger) { Field searchField = new Field(); searchField.setName(classField.getName()); DataType dataType = covertToDataType(classField.getGenericType(), false, logger); searchField.setType(dataType) .setKey(false) .setSearchable(false) .setFacetable(false) .setHidden(false) .setFilterable(false) .setSortable(false); return searchField; }
Source:
<code>protected static BlobHolder doGetFromCache(String key) { ConversionCacheEntry cacheEntry = cache.get(key); if (cacheEntry != null) { if (CACHE_HITS.incrementAndGet() < 0) { CACHE_HITS.addAndGet(Long.MIN_VALUE); } BlobHolder restored = cacheEntry.restore(); if (restored.getBlob().getFile().exists()) { return restored; } else { <START> removeFromCache(key); <END> } } return null; }</code><technical_language>done unique caller getFromCache here, no</technical_language>

Target:
protected static BlobHolder doGetFromCache(String key) { ConversionCacheEntry cacheEntry = cache.get(key); if (cacheEntry != null) { if (CACHE_HITS.incrementAndGet() < 0) { CACHE_HITS.addAndGet(Long.MIN_VALUE); } BlobHolder restored = cacheEntry.restore(); if (restored.getBlob().getFile().exists()) { return restored; } } return null; }
Source:
<code>private void syncAzureObjectIds(Stack stack, UmsUsersState umsUsersState, BiConsumer<String, String> warnings) { String envCrn = stack.getEnvironmentCrn(); LOGGER.info("Syncing Azure Object IDs for environment {}", envCrn); Map<String, List<CloudIdentity>> userCloudIdentites = getUserCloudIdentitiesToSync(umsUsersState); Map<String, String> userToAzureObjectIdMap = getAzureObjectIdMap(userCloudIdentites); Map<String, String> groupToAzureObjectIdMap = getAzureObjectIdMap(umsUsersState.getGroupToCloudIdentityMap()); SetRangerCloudIdentityMappingRequest setRangerCloudIdentityMappingRequest = new SetRangerCloudIdentityMappingRequest(); setRangerCloudIdentityMappingRequest.setAzureUserMapping(userToAzureObjectIdMap); setRangerCloudIdentityMappingRequest.setAzureGroupMapping(groupToAzureObjectIdMap); try { sdxEndpoint.setRangerCloudIdentityMapping(envCrn, setRangerCloudIdentityMappingRequest); } catch (Exception e) { LOGGER.warn("Failed to set cloud identity mapping for environment {}", envCrn, e); <START> warnings.accept(envCrn, "Failed to set cloud identity mapping"); <END> } }</code><technical_language>log request</technical_language>

Target:
private void syncAzureObjectIds(Stack stack, UmsUsersState umsUsersState, BiConsumer<String, String> warnings) { String envCrn = stack.getEnvironmentCrn(); LOGGER.info("Syncing Azure Object IDs for environment {}", envCrn); try { Map<String, List<CloudIdentity>> userCloudIdentites = getUserCloudIdentitiesToSync(umsUsersState); Map<String, String> userToAzureObjectIdMap = getAzureObjectIdMap(userCloudIdentites); Map<String, String> groupToAzureObjectIdMap = getAzureObjectIdMap(umsUsersState.getGroupToCloudIdentityMap()); SetRangerCloudIdentityMappingRequest setRangerCloudIdentityMappingRequest = new SetRangerCloudIdentityMappingRequest(); setRangerCloudIdentityMappingRequest.setAzureUserMapping(userToAzureObjectIdMap); setRangerCloudIdentityMappingRequest.setAzureGroupMapping(groupToAzureObjectIdMap); LOGGER.debug("Setting ranger cloud identity mapping: {}", setRangerCloudIdentityMappingRequest); sdxEndpoint.setRangerCloudIdentityMapping(envCrn, setRangerCloudIdentityMappingRequest); } catch (Exception e) { LOGGER.warn("Failed to set cloud identity mapping for environment {}", envCrn, e); warnings.accept(envCrn, "Failed to set cloud identity mapping"); } }
Source:
<code>public void initialize(Config mConfig, Config mRuntime) { this.config = Config.toClusterMode(mConfig); this.runtime = mRuntime; <START> <END> }</code><technical_language>please remove empty lines } lines in this class</technical_language>

Target:
public void initialize(Config mConfig, Config mRuntime) { if (Config.toClusterMode(mConfig) != null) { this.config = Config.toClusterMode(mConfig); } else { this.config = mConfig; } this.runtime = mRuntime; }
Source:
<code>protected void updateDefaultDisplayRelatedFields(final VmBase vmBase) { final Collection<DisplayType> displayTypes = model.getDisplayType().getItems(); if (displayTypes == null || displayTypes.isEmpty()) { return; } Frontend.getInstance().runQuery(VdcQueryType.GetGraphicsDevices, new IdQueryParameters(vmBase.getId()), new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object modelFromCallback, Object returnValue) { deactivate(); DisplayType displayProtocol = displayTypes.iterator().next(); if (displayTypes.contains(vmBase.getDefaultDisplayType())) { displayProtocol = vmBase.getDefaultDisplayType(); } maybeSetSelectedItem(model.getDisplayType(), displayProtocol); Set<GraphicsType> graphicsTypes = new HashSet<GraphicsType>(); List<GraphicsDevice> graphicsDevices = ((VdcQueryReturnValue) returnValue).getReturnValue(); for (GraphicsDevice graphicsDevice : graphicsDevices) { graphicsTypes.add(graphicsDevice.getGraphicsType()); } UnitVmModel.GraphicsTypes selected = UnitVmModel.GraphicsTypes.fromGraphicsTypes(graphicsTypes); if (selected != null && getModel().getGraphicsType().getItems().contains(selected)) { maybeSetSelectedItem(getModel().getGraphicsType(), selected); } <START> maybeSetSelectedItem(model.getDisplayType(), displayProtocol); <END> maybeSetSelectedItem(model.getNumOfMonitors(), vmBase.getNumOfMonitors()); maybeSetSelectedItem(model.getUsbPolicy(), vmBase.getUsbPolicy()); maybeSetEntity(model.getIsSmartcardEnabled(), vmBase.isSmartcardEnabled()); maybeSetSingleQxlPci(vmBase); activate(); } })); }</code><technical_language>is this duplication of line 489 intended</technical_language>

Target:
protected void updateDefaultDisplayRelatedFields(final VmBase vmBase) { final Collection<DisplayType> displayTypes = model.getDisplayType().getItems(); if (displayTypes == null || displayTypes.isEmpty()) { return; } Frontend.getInstance().runQuery(VdcQueryType.GetGraphicsDevices, new IdQueryParameters(vmBase.getId()), new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object modelFromCallback, Object returnValue) { deactivate(); DisplayType displayProtocol = displayTypes.iterator().next(); if (displayTypes.contains(vmBase.getDefaultDisplayType())) { displayProtocol = vmBase.getDefaultDisplayType(); } maybeSetSelectedItem(model.getDisplayType(), displayProtocol); Set<GraphicsType> graphicsTypes = new HashSet<GraphicsType>(); List<GraphicsDevice> graphicsDevices = ((VdcQueryReturnValue) returnValue).getReturnValue(); for (GraphicsDevice graphicsDevice : graphicsDevices) { graphicsTypes.add(graphicsDevice.getGraphicsType()); } UnitVmModel.GraphicsTypes selected = UnitVmModel.GraphicsTypes.fromGraphicsTypes(graphicsTypes); if (selected != null && getModel().getGraphicsType().getItems().contains(selected)) { maybeSetSelectedItem(getModel().getGraphicsType(), selected); } maybeSetSelectedItem(model.getNumOfMonitors(), vmBase.getNumOfMonitors()); maybeSetSelectedItem(model.getUsbPolicy(), vmBase.getUsbPolicy()); maybeSetEntity(model.getIsSmartcardEnabled(), vmBase.isSmartcardEnabled()); maybeSetSingleQxlPci(vmBase); activate(); } })); }
Source:
<code>public void childRendered(MElementContainer<MUIElement> parentElement, MUIElement element) { super.childRendered(parentElement, element); processContents(parentElement); ToolBar toolbar = (ToolBar) getUIContainer(element); if (toolbar != null && !toolbar.isDisposed()) { <START> toolbar.pack(true); <END> toolbar.requestLayout(); } }</code><technical_language>Remove call pack</technical_language>

Target:
public void childRendered(MElementContainer<MUIElement> parentElement, MUIElement element) { super.childRendered(parentElement, element); processContents(parentElement); ToolBar toolbar = (ToolBar) getUIContainer(element); if (toolbar != null && !toolbar.isDisposed()) { toolbar.requestLayout(); } }
Source:
<code>private void testString(final String language, final String str) throws CRException { bean.set("content", str); t.processBean(bean); String s = (String) bean.get("lang"); <START> Assert.assertEquals("The found Language (" + s + ") should be (" + language + "). String: '" + str + "'", language, s); <END> }</code><technical_language>Please static imports for Assert methods</technical_language>

Target:
private void testString(final String language, final String str) throws CRException { bean.set("content", str); t.processBean(bean); String s = (String) bean.get("lang"); assertEquals("The found Language (" + s + ") should be (" + language + "). String: '" + str + "'", language, s); }
Source:
<code><START> public <T> CompletableFuture<T> send(final Request<T> request) { <END> final CompletableFuture<T> promise = new CompletableFuture<>(); sendHelper(request, promise, 0); return promise; }</code><technical_language>This a significant refactoring - why? do a separate change is required for java8 migration</technical_language>

Target:
public <T> CompletionStage<T> send(final Request<T> request) { final CompletableFuture<T> promise = new CompletableFuture<>(); sendHelper(request, promise, 0); return promise; }
Source:
<code>public void stop_run_if_too_many_failures() throws Exception { IntStream.range(0, 10).forEach(i -> createUnindexedUser()); advanceInTime(); PartiallyFailingUserIndexer failingAboveRatioUserIndexer = new PartiallyFailingUserIndexer(1); Settings settings = new MapSettings() <START> .setProperty("sonar.search.recovery.loopLimit", "3"); <END> underTest = newRecoveryIndexer(failingAboveRatioUserIndexer, settings); underTest.recover(); assertThatLogsContain(ERROR, "Elasticsearch recovery - too many failures [2/3 documents], waiting for next run"); assertThatQueueHasSize(9); assertThat(failingAboveRatioUserIndexer.called).hasSize(3); }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Remove this of "Thread.sleep()". [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public void stop_run_if_too_many_failures() { IntStream.range(0, 10).forEach(i -> createUnindexedUser()); advanceInTime(); PartiallyFailingUserIndexer failingAboveRatioUserIndexer = new PartiallyFailingUserIndexer(1); Settings settings = new MapSettings() .setProperty("sonar.search.recovery.loopLimit", "3"); underTest = newRecoveryIndexer(failingAboveRatioUserIndexer, mockedRuleIndexer, settings); underTest.recover(); assertThatLogsContain(ERROR, "Elasticsearch recovery - too many failures [2/3 documents], waiting for next run"); assertThatQueueHasSize(9); assertThat(failingAboveRatioUserIndexer.called).hasSize(3); }
Source:
<code>protected boolean doExists() throws SQLException { <START> String query = "SELECT COUNT(*) FROM " + systemSchema + ".schemata WHERE " + schemaNameField + "=?"; <END> return jdbcTemplate.queryForInt(query, name) > 0; }</code><technical_language>"schemata" a variable chenge easily in future. In addition "tables" "TABLES" put in Uppercase property. think</technical_language>

Target:
protected boolean doExists() throws SQLException { String query = "SELECT COUNT(1) FROM " + schemaTable + " WHERE " + schemaNameField + "=?"; return jdbcTemplate.queryForInt(query, name) > 0; }
Source:
<code>public boolean isDirectoryFileConflict() { if (dfConflictPath != null) { <START> if ((currentHead.getEntryPathString()+"/").startsWith(dfConflictPath)) <END> return true; dfConflictPath = null; } return false; }</code><technical_language>need do this a path string. A D/F conflict is true for entire time recursed path, walker pop out of level. do this faster a boolean variable a != null test? I thought prior iteration of this feature AbstractTreeIterator in a field if of a D/F conflict</technical_language>

Target:
public boolean isDirectoryFileConflict() { return dfConflict != null; }
Source:
<code><START> public void setFrameID(int frameID) { <END> this.frameID = frameID; }</code><technical_language>Throws IllegalArgumentException if frameID < 0 if frameID > 255</technical_language>

Target:
public void setFrameID(int frameID) { if (frameID < 0 || frameID > 255) throw new IllegalArgumentException("Frame ID must be between 0 and 255."); this.frameID = frameID; }
Source:
<code>int removeExecutionLogsByTime(final long millis, final int recordCleanupLimit) throws ExecutorManagerException { final String DELETE_BY_TIME = <START> "DELETE FROM execution_logs WHERE upload_time < ? LIMIT ?"; <END> try { return this.dbOperator.update(DELETE_BY_TIME, millis, recordCleanupLimit); } catch (final SQLException e) { logger.error("delete execution logs failed", e); throw new ExecutorManagerException( "Error deleting old execution_logs before " + millis, e); } }</code><technical_language>This is maintaining retention time for logs deleting 1000 entries end huge number of rows spanning multiple months a period of time if cluster generates more rows restricting delete 24k rows/day. I pointed out earlier a run this clean hour some batch_size in a loop while records deleted(i.e older 12 weeks) committing batch</technical_language>

Target:
int removeExecutionLogsByTime(final long millis, final int recordCleanupLimit) throws ExecutorManagerException { int totalRecordsRemoved = 0; int removedRecords; do { removedRecords = removeExecutionLogsBatch(millis, recordCleanupLimit); logger.debug("Removed batch of execution logs. Count of records removed in this batch: " + removedRecords); totalRecordsRemoved = totalRecordsRemoved + removedRecords; } while (removedRecords == recordCleanupLimit); return totalRecordsRemoved; }
Source:
<code>private ConnectorPageSink createPageSink() { <START> boolean connectorCommitRequired = connectorCommitStrategy == ConnectorCommitStrategy.LIFESPAN_COMMIT || connectorCommitStrategy == ConnectorCommitStrategy.TASK_COMMIT; <END> if (target instanceof CreateHandle) { return pageSinkManager.createPageSink(session, ((CreateHandle) target).getHandle(), PageSinkProperties.builder().setCommitRequired(connectorCommitRequired).build()); } if (target instanceof InsertHandle) { return pageSinkManager.createPageSink(session, ((InsertHandle) target).getHandle(), PageSinkProperties.builder().setCommitRequired(connectorCommitRequired).build()); } throw new UnsupportedOperationException("Unhandled target type: " + target.getClass().getName()); }</code><technical_language>nit: connectorCommitRequired a enum property</technical_language>

Target:
private ConnectorPageSink createPageSink() { PageSinkProperties pageSinkProperties = PageSinkProperties.builder() .setCommitRequired(pageSinkCommitStrategy.isCommitRequired()) .build(); if (target instanceof CreateHandle) { return pageSinkManager.createPageSink(session, ((CreateHandle) target).getHandle(), pageSinkProperties); } if (target instanceof InsertHandle) { return pageSinkManager.createPageSink(session, ((InsertHandle) target).getHandle(), pageSinkProperties); } throw new UnsupportedOperationException("Unhandled target type: " + target.getClass().getName()); }
Source:
<code>public void closeAndRecycleState() { final Map<TopicPartition, Long> checkpoint = prepareClose(true); if (checkpoint != null) { stateMgr.checkpoint(checkpoint); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: stateMgr.recycle(); recordCollector.close(); break; case CLOSED: <START> log.trace("Skip close since state is {}", state()); <END> return; default: throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); log.info("Closed clean and recycled state"); }</code><technical_language>I this of exceptions enforce state is CLOSED (ie throw IllegalStateException) related actions occur of Task implementation fail if try recycle a CLOSED task. Similar prepare/post commit, resume,</technical_language>

Target:
public void closeAndRecycleState() { final Map<TopicPartition, Long> checkpoint = prepareClose(true); if (checkpoint != null) { stateMgr.checkpoint(checkpoint); } switch (state()) { case CREATED: case RUNNING: case RESTORING: case SUSPENDED: stateMgr.recycle(); recordCollector.close(); break; case CLOSED: throw new IllegalStateException("Illegal state " + state() + " while closing active task " + id); default: throw new IllegalStateException("Unknown state " + state() + " while closing active task " + id); } partitionGroup.close(); closeTaskSensor.record(); transitionTo(State.CLOSED); log.info("Closed clean and recycled state"); }
Source:
<code>public void postCollectionAdminGroupCreateAdminGroupDcTitleUnprocessable() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); metadataRest.put("dc.title", new MetadataValueRest("testTitle")); groupRest.setMetadata(metadataRest); AtomicReference<UUID> idRef = new AtomicReference<>(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); <START> <END> }</code><technical_language>verify group created extra get</technical_language>

Target:
public void postCollectionAdminGroupCreateAdminGroupDcTitleUnprocessable() throws Exception { ObjectMapper mapper = new ObjectMapper(); GroupRest groupRest = new GroupRest(); MetadataRest metadataRest = new MetadataRest(); metadataRest.put("dc.description", new MetadataValueRest("testingDescription")); metadataRest.put("dc.subject", new MetadataValueRest("testSubject")); metadataRest.put("dc.title", new MetadataValueRest("testTitle")); groupRest.setMetadata(metadataRest); AtomicReference<UUID> idRef = new AtomicReference<>(); String token = getAuthToken(admin.getEmail(), password); getClient(token).perform(post("/api/core/collections/" + collection.getID() + "/adminGroup") .content(mapper.writeValueAsBytes(groupRest)) .contentType(contentType)) .andExpect(status().isUnprocessableEntity()); getClient(token).perform(get("/api/core/collections/" + collection.getID() + "/adminGroup")) .andExpect(status().isNoContent()); }
Source:
<code>@Override public void onReceive(Context context, Intent intent) { <START> if (null == intent) <END> return; String action = intent.getAction(); Bundle extras = intent.getExtras(); if (ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { dispatchAirplaneModeChange(extras.getBoolean(EXTRA_AIRPLANE_STATE, false)); } else if (CONNECTIVITY_ACTION.equals(action)) { dispatchNetworkStateChange(connectivityManager.getActiveNetworkInfo()); } }</code><technical_language>Add { }</technical_language>

Target:
@Override public void onReceive(Context context, Intent intent) { if (null == intent) { return; } String action = intent.getAction(); Bundle extras = intent.getExtras(); if (ACTION_AIRPLANE_MODE_CHANGED.equals(action)) { dispatchAirplaneModeChange(extras.getBoolean(EXTRA_AIRPLANE_STATE, false)); } else if (CONNECTIVITY_ACTION.equals(action)) { dispatchNetworkStateChange(connectivityManager.getActiveNetworkInfo()); } }
Source:
<code>public void setEnabled(boolean enabled) { if (this.enabled && !enabled) { if (LOG.isTraceEnabled()) { <START> LOG.trace("Disabling filesystem listener"); <END> } this.enabled = false; intellijWorkspace.removeResourceListener(this); } else if (!this.enabled && enabled) { if (LOG.isTraceEnabled()) { LOG.trace("Enabling filesystem listener"); } this.enabled = true; intellijWorkspace.addResourceListener(this); } }</code><technical_language>if is needed</technical_language>

Target:
public void setEnabled(boolean enabled) { if (this.enabled && !enabled) { LOG.trace("Disabling filesystem listener"); this.enabled = false; intellijWorkspace.removeResourceListener(this); } else if (!this.enabled && enabled) { LOG.trace("Enabling filesystem listener"); this.enabled = true; intellijWorkspace.addResourceListener(this); } }
Source:
<code>public void run() { KafkaCollector collector = null; try { LOG.info("Starting runner for " + this.props.getProperty(TOPIC_AND_HOUR)); collector = new KafkaCollector(props, name, topic); LOG.info("Running " + name + " for input " + props.getProperty(INPUT_PATHS)); collector.run(); } catch (Throwable e) { e.printStackTrace(); <START> LOG.error("Failed for " + name + " ,job: " + collector == null ? null : collector.getJob() + " failed for " <END> + props.getProperty(INPUT_PATHS) + " Exception:" + e.getLocalizedMessage()); errorQueue.add(new SweeperError(name, props.get(INPUT_PATHS).toString(), e)); } }</code><technical_language>String.format() here. do LOG.error(msg, e); need include exception message in msg</technical_language>

Target:
public void run() { KafkaCollector collector = null; try { LOG.info("Starting runner for " + this.props.getProperty(TOPIC_AND_HOUR)); collector = new KafkaCollector(props, name, topic); LOG.info("Running " + name + " for input " + props.getProperty(INPUT_PATHS)); collector.run(); } catch (Throwable e) { LOG.error("Failed for " + name + " ,job: " + collector == null ? null : collector.getJob() + " failed for " + props.getProperty(INPUT_PATHS) + " Exception:" + e.getLocalizedMessage()); errorQueue.add(new SweeperError(name, props.get(INPUT_PATHS).toString(), e)); } }
Source:
<code>private void reconcileExternalAgents(Account account, Agent agent, Region localRegion, Map<String, Region> regions, Map<String, ExternalCredential> toAdd, Map<String, ExternalCredential> toRemove, Map<String, ExternalCredential> toRetain, Map<String, ExternalProject> externalProjects) { boolean changed = false; for (String key : toAdd.keySet()) { ExternalCredential value = toAdd.get(key); ExternalAgent externalAgent = createExternalAgent(agent, account, localRegion, regions.get(value.getRegionName()), toAdd.get(key), externalProjects); if (externalAgent != null) { value.setAgentUuid(externalAgent.getUuid()); toRetain.put(key, value); changed = true; } } for (String key : toRemove.keySet()) { ExternalCredential value = toRemove.get(key); if (deactivateAndRemoveExternalAgent(agent, value)) { <START> changed = true; <END> } } if (changed) { objectManager.setFields(agent, AccountConstants.FIELD_EXTERNAL_CREDENTIALS, toRetain.values()); } }</code><technical_language>changed set true if attempt remove agent fails</technical_language>

Target:
private void reconcileExternalAgents(Account account, Agent agent, Region localRegion, Map<String, Region> regions, Map<String, ExternalCredential> toAdd, Map<String, ExternalCredential> toRemove, Map<String, ExternalCredential> toRetain, Map<String, ExternalProject> externalProjects) { boolean changed = false; for (String key : toAdd.keySet()) { ExternalCredential value = toAdd.get(key); ExternalAgent externalAgent = createExternalAgent(agent, account, localRegion, regions.get(value.getRegionName()), toAdd.get(key), externalProjects); if (externalAgent != null) { value.setAgentUuid(externalAgent.getUuid()); toRetain.put(key, value); changed = true; } } for (String key : toRemove.keySet()) { ExternalCredential value = toRemove.get(key); deactivateAndRemoveExternalAgent(agent, value); changed = true; } if (changed) { objectManager.setFields(agent, AccountConstants.FIELD_EXTERNAL_CREDENTIALS, toRetain.values()); } }
Source:
<code>public void process(TraceContext context, APMSpan span, NodeBuilder nodeBuilder) { for (Map.Entry<String, Object> entry : span.getTags().entrySet()) { if (entry.getValue() != null) { nodeBuilder.addProperty(new Property(entry.getKey(), entry.getValue().toString())); <START> if (entry.getKey().endsWith(".url") || entry.getKey().endsWith(".uri")) { <END> try { URL url = new URL(entry.getValue().toString()); nodeBuilder.setUri(url.getPath()); } catch (MalformedURLException e) { nodeBuilder.setUri(entry.getValue().toString()); } nodeBuilder.setEndpointType(entry.getKey().substring(0, entry.getKey().length() - 4)); } else if (entry.getKey().equals("component")) { nodeBuilder.setComponentType(entry.getValue().toString()); } else if (entry.getKey().contains("fault")) { nodeBuilder.setFault(entry.getValue().toString()); } else if (entry.getKey().contains(APMTracer.TRANSACTION_NAME)) { if (context.getBusinessTransaction() == null) { context.setBusinessTransaction(entry.getValue().toString()); } } } } }</code><technical_language>entry.getKey() is non-null safe ? Probably, maps doen't support null values IIRC</technical_language>

Target:
public void process(TraceContext context, APMSpan span, NodeBuilder nodeBuilder) { for (Map.Entry<String, Object> entry : span.getTags().entrySet()) { if (entry.getKey() != null && entry.getValue() != null) { nodeBuilder.addProperty(new Property(entry.getKey(), entry.getValue().toString())); if (entry.getKey().endsWith(".url") || entry.getKey().endsWith(".uri")) { try { URL url = new URL(entry.getValue().toString()); nodeBuilder.setUri(url.getPath()); } catch (MalformedURLException e) { nodeBuilder.setUri(entry.getValue().toString()); } nodeBuilder.setEndpointType(entry.getKey().substring(0, entry.getKey().length() - 4)); } else if (entry.getKey().equals("component")) { nodeBuilder.setComponentType(entry.getValue().toString()); } else if (entry.getKey().contains("fault")) { nodeBuilder.setFault(entry.getValue().toString()); } else if (entry.getKey().contains(APMTracer.TRANSACTION_NAME)) { if (context.getBusinessTransaction() == null) { context.setBusinessTransaction(entry.getValue().toString()); } } } } }
Source:
<code>public static List<SchemaChange> parse(String currentDB, String sql) { if ( matchesBlacklist(sql) ) { return null; } while ( true ) { try { return parseSQL(currentDB, sql); } catch ( ReparseSQLException e ) { <START> LOGGER.debug("rewrote SQL to " + sql); <END> sql = e.getSQL(); } catch ( ParseCancellationException e ) { LOGGER.debug("Parse cancelled: " + e); return null; } catch ( MaxwellSQLSyntaxError e) { LOGGER.error("Error parsing SQL: '" + sql + "'"); throw (e); } } }</code><technical_language>log line stmt bellow</technical_language>

Target:
public static List<SchemaChange> parse(String currentDB, String sql) { if ( matchesBlacklist(sql) ) { return null; } while ( true ) { try { return parseSQL(currentDB, sql); } catch ( ReparseSQLException e ) { sql = e.getSQL(); LOGGER.debug("rewrote SQL to " + sql); } catch ( ParseCancellationException e ) { LOGGER.debug("Parse cancelled: " + e); return null; } catch ( MaxwellSQLSyntaxError e) { LOGGER.error("Error parsing SQL: '" + sql + "'"); throw (e); } } }
Source:
<code>public void logout() throws IOException { if (this.loggedIn) { Map<String, String> params = new HashMap<>(); params.put("action", "logout"); params.put("format", "json"); <START> params.put("token", fetchToken("csrf")); <END> try { sendJsonRequest("POST", params); } catch (MediaWikiApiErrorException e) { throw new IOException(e.getMessage(), e); } this.loggedIn = false; this.username = ""; this.password = ""; } }</code><technical_language>MaybegetOrFetchToken if csrf token loaded</technical_language>

Target:
public void logout() throws IOException { if (this.loggedIn) { Map<String, String> params = new HashMap<>(); params.put("action", "logout"); params.put("format", "json"); params.put("token", getOrFetchToken("csrf")); try { sendJsonRequest("POST", params); } catch (MediaWikiApiErrorException e) { throw new IOException(e.getMessage(), e); } this.loggedIn = false; this.username = ""; this.password = ""; } }
Source:
<code>public void end(final Xid xid, final int flags) throws XAException { if (logger.isTraceEnabled()) { logger.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags)); } checkXA(); try { if (rollbackOnly) { try { rollback(false, false); } catch (Throwable ignored) { logger.debug("Error on rollback during end call!", ignored); } throw new XAException(XAException.XAER_RMFAIL); } try { flushAcks(); startCall(); try { sessionContext.xaEnd(xid, flags); } catch (ActiveMQNotConnectedException ex) { <START> ActiveMQClientLogger.LOGGER.connectionClosedWarn(ex.getType(), ex.getMessage()); <END> } finally { endCall(); } } catch (XAException xae) { throw xae; } catch (Throwable t) { ActiveMQClientLogger.LOGGER.errorCallingEnd(t); XAException xaException = new XAException(XAException.XAER_RMFAIL); xaException.initCause(t); throw xaException; } } finally { currentXID = null; } }</code><technical_language>a logger.debug(ex.getMessage(), ex) here? This if a developer needs debug why.. give developer more information</technical_language>

Target:
public void end(final Xid xid, final int flags) throws XAException { if (logger.isTraceEnabled()) { logger.trace("Calling end:: " + convert(xid) + ", flags=" + convertTXFlag(flags)); } checkXA(); try { if (rollbackOnly) { try { rollback(false, false); } catch (Throwable ignored) { logger.debug("Error on rollback during end call!", ignored); } throw new XAException(XAException.XAER_RMFAIL); } try { flushAcks(); startCall(); try { sessionContext.xaEnd(xid, flags); } catch (ActiveMQNotConnectedException ex) { ActiveMQClientLogger.LOGGER.connectionClosedWarn(ex.getType(), ex.getMessage()); if (logger.isDebugEnabled()) { logger.debug(ex.getMessage(), ex); } } finally { endCall(); } } catch (XAException xae) { throw xae; } catch (Throwable t) { ActiveMQClientLogger.LOGGER.errorCallingEnd(t); XAException xaException = new XAException(XAException.XAER_RMFAIL); xaException.initCause(t); throw xaException; } } finally { currentXID = null; } }
Source:
<code>public void namespaceAwareUpsert(SavedPage savedPage) { namespaceAwareUpsert( <START> WikipediaApp.getInstance().getDbOpenHelper().getWritableDatabase(), <END> savedPage, getTableName(), getPrimaryKeySelection(), getPrimaryKeySelectionArgs(savedPage) ); }</code><technical_language>content provider's responsibility call methods a reference database? vague this area of codebase I want avoid unnecessary dependencies WikipediaApp possible</technical_language>

Target:
public void namespaceAwareUpsert(SavedPage savedPage) { super.namespaceAwareUpsert( WikipediaApp.getInstance().getDbOpenHelper().getWritableDatabase(), savedPage, getTableName(), getPrimaryKeySelection(), getPrimaryKeySelectionArgs(savedPage) ); }
Source:
<code>private String protectedPathInForeground(String adjustedPath, byte[] data) throws Exception { try { return pathInForeground(adjustedPath, data); } catch ( KeeperException.ConnectionLossException e ) { if ( protectedId != null ) { findAndDeleteProtectedNodeInBackground(adjustedPath, protectedId, null); protectedId = UUID.randomUUID().toString(); } throw e; } <START> catch ( KeeperException e ) <END> { throw e; } catch ( Exception e ) { if ( protectedId != null ) { findAndDeleteProtectedNodeInBackground(adjustedPath, protectedId, null); protectedId = UUID.randomUUID().toString(); } throw e; } }</code><technical_language>I 3 catch clauses combined for clarity</technical_language>

Target:
private String protectedPathInForeground(String adjustedPath, byte[] data) throws Exception { try { return pathInForeground(adjustedPath, data); } catch ( Exception e) { if ( ( e instanceof KeeperException.ConnectionLossException || !( e instanceof KeeperException )) && protectedId != null ) { String localProtectedId = protectedId; findAndDeleteProtectedNodeInBackground(adjustedPath, localProtectedId, null); protectedId = UUID.randomUUID().toString(); } throw e; } }