auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private FileStatus[] listStatusForFallbackLink() throws IOException { if (theInternalDir.isRoot() && theInternalDir.getFallbackLink() != null) { URI fallBackUri = theInternalDir.getFallbackLink().targetDirLinkList[0]; return FileSystem.get(fallBackUri, conf) .listStatus(new Path(fallBackUri.toString())); } else { return new FileStatus[0]; } }

Target:
private FileStatus[] listStatusForFallbackLink() throws IOException { if (theInternalDir.isRoot() && theInternalDir.getFallbackLink() != null) { FileSystem linkedFs = theInternalDir.getFallbackLink().getTargetFileSystem(); FileStatus[] statuses = linkedFs.listStatus(new Path("/")); for (FileStatus status : statuses) { status.setPath( new Path(myUri.toString(), status.getPath().getName())); } return statuses; } else { return new FileStatus[0]; } }
Source:
private void assertUserSuggestion(SuggestionElement user, String name, String... extra) { String alias; if (extra.length > 0) { alias = extra[0]; } else { String[] parts = name.split("\\s+"); if (parts.length > 1) { alias = parts[0].toLowerCase().charAt(0) + parts[1].toLowerCase(); } else { alias = name; } } String image = alias + ".png?"; if (extra.length > 1) { image = extra[1]; } Assert.assertEquals(name, user.getLabel()); String value = user.getValue(); if (value.startsWith("XWiki.")) { Assert.assertEquals("XWiki." + alias, value); } else { Assert.assertEquals(alias, value); } if (image != null) { Assert.assertTrue(user.getIcon().contains(image)); } else { try { Assert.assertEquals("", user.getIcon()); } catch (NoSuchElementException e) { } } }

Target:
private void assertUserSuggestion(SuggestionElement user, String name, String... extra) { String alias; if (extra.length > 0) { alias = extra[0]; } else { String[] parts = name.split("\\s+"); if (parts.length > 1) { alias = parts[0].toLowerCase().charAt(0) + parts[1].toLowerCase(); } else { alias = name; } } String image = alias + ".png?"; if (extra.length > 1) { image = extra[1]; } Assert.assertEquals(name, user.getLabel()); String value = user.getValue(); if (value.startsWith("XWiki.")) { Assert.assertEquals("XWiki." + alias, value); } else { Assert.assertEquals(alias, value); } if (image != null) { Assert.assertTrue(user.getIcon().contains(image)); } else { try { user.getIcon(); Assert.fail(); } catch (NoSuchElementException e) { } } }
Source:
public void setUp() throws Exception { project = new Project(InstrumentationRegistry.getTargetContext(), "testProject"); Group parentGroup = new Group(); background = new SingleSprite("background"); parentGroup.addActor(background.look); sprite = new SingleSprite("penActor"); parentGroup.addActor(sprite.look); project.getDefaultScene().addSprite(sprite); sprite2 = new SingleSprite("embroideryActor"); parentGroup.addActor(sprite2.look); project.getDefaultScene().addSprite(sprite2); sprite3 = new SingleSprite("testSprite"); parentGroup.addActor(sprite3.look); project.getDefaultScene().addSprite(sprite3); ProjectManager.getInstance().setProject(project); }

Target:
public void setUp() throws Exception { project = new Project(InstrumentationRegistry.getTargetContext(), "testProject"); Group parentGroup = new Group(); background = new SingleSprite("background"); parentGroup.addActor(background.look); penActorSprite = new SingleSprite("penActor"); parentGroup.addActor(penActorSprite.look); project.getDefaultScene().addSprite(penActorSprite); embroideryActorSprite = new SingleSprite("embroideryActor"); parentGroup.addActor(embroideryActorSprite.look); project.getDefaultScene().addSprite(embroideryActorSprite); realSprite = new SingleSprite("testSprite"); parentGroup.addActor(realSprite.look); project.getDefaultScene().addSprite(realSprite); ProjectManager.getInstance().setProject(project); }
Source:
public static VmDevice addManagedDevice(VmDeviceId id, VmDeviceType type, VmDeviceType device, Map<String, Object> specParams, boolean is_plugged, boolean isReadOnly, String address) { VmDevice managedDevice = addManagedDevice(id, type, device, specParams,is_plugged,isReadOnly); if (!StringUtils.isEmpty(address)){ managedDevice.setAddress(address); } return managedDevice; }

Target:
public static VmDevice addManagedDevice(VmDeviceId id, VmDeviceType type, VmDeviceType device, Map<String, Object> specParams, boolean is_plugged, boolean isReadOnly, String address) { VmDevice managedDevice = addManagedDevice(id, type, device, specParams,is_plugged,isReadOnly); if (StringUtils.isNotBlank(address)){ managedDevice.setAddress(address); } return managedDevice; }
Source:
private void onStartupTaskCompleteListener() { if (mApi == null) { mApi = new RestApi(this, mConfig.getWebGuiUrl(), mConfig.getApiKey(), this::onApiAvailable, () -> onServiceStateChange(mCurrentState)); Log.i(TAG, "Web GUI will be available at " + mConfig.getWebGuiUrl()); } if (mSyncthingRunnable != null || mSyncthingRunnableThread != null) { Log.e(TAG, "onStartupTaskCompleteListener: Syncthing binary lifecycle violated"); return; } mSyncthingRunnable = new SyncthingRunnable(this, SyncthingRunnable.Command.main); mSyncthingRunnableThread = new Thread(mSyncthingRunnable); mSyncthingRunnableThread.start(); if (mPollWebGuiAvailableTask == null) { mPollWebGuiAvailableTask = new PollWebGuiAvailableTask( this, getWebGuiUrl(), mConfig.getApiKey(), result -> { Log.i(TAG, "Web GUI has come online at " + mConfig.getWebGuiUrl()); if (mApi != null) { mApi.readConfigFromRestApi(); } }); } return; }

Target:
private void onStartupTaskCompleteListener() { if (mApi == null) { mApi = new RestApi(this, mConfig.getWebGuiUrl(), mConfig.getApiKey(), this::onApiAvailable, () -> onServiceStateChange(mCurrentState)); Log.i(TAG, "Web GUI will be available at " + mConfig.getWebGuiUrl()); } if (mSyncthingRunnable != null || mSyncthingRunnableThread != null) { Log.e(TAG, "onStartupTaskCompleteListener: Syncthing binary lifecycle violated"); return; } mSyncthingRunnable = new SyncthingRunnable(this, SyncthingRunnable.Command.main); mSyncthingRunnableThread = new Thread(mSyncthingRunnable); mSyncthingRunnableThread.start(); if (mPollWebGuiAvailableTask == null) { mPollWebGuiAvailableTask = new PollWebGuiAvailableTask( this, getWebGuiUrl(), mConfig.getApiKey(), result -> { Log.i(TAG, "Web GUI has come online at " + mConfig.getWebGuiUrl()); if (mApi != null) { mApi.readConfigFromRestApi(); } } ); } }
Source:
public String whereIs(@CommandParam("entity id") long id) { Map<Long, EngineEntityPool> worldPoolMap = entityManager.getPoolMap(); if (worldPoolMap.containsKey(id)) { EngineEntityPool pool = worldPoolMap.get(id); for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { if (entry.getValue() == pool) { return id + " is present in " + entry.getKey().getTitle(); } } } return id + " not found"; }

Target:
public String whereIs(@CommandParam("entity id") long id) { Map<Long, EngineEntityPool> worldPoolMap = entityManager.getPoolMap(); if (worldPoolMap.containsKey(id)) { EngineEntityPool pool = worldPoolMap.get(id); for (Map.Entry<WorldInfo, EngineEntityPool> entry : entityManager.getWorldPoolsMap().entrySet()) { if (entry.getValue() == pool) { return "Entity" + id + " is present in " + entry.getKey().getTitle(); } } } return "Entity" + id + " not found"; }
Source:
@Override protected void after() { tmp.delete(); }

Target:
protected void after() { tmp.delete(); }
Source:
public final void getStyles(Object element, StyleAccumulator accumulator) { onGetStyles((E) element, accumulator); mSuper.getStyles(element, accumulator); }

Target:
public final void getStyles(Object element, StyleAccumulator accumulator) { mSuper.getStyles(element, accumulator); onGetStyles((E) element, accumulator); }
Source:
private static <E> E[] getArray(Class<E> clazz, List<?> baseList) { E[] result = (E[]) Array.newInstance(clazz, baseList.size()); for (int i = 0; i < baseList.size(); i++) { Array.set(result, i, (E) baseList.get(i)); } return (E[]) result; }

Target:
private static <E> E[] getArray(Class<E> clazz, List<?> baseList) { final E[] result = (E[]) Array.newInstance(clazz, baseList.size()); for (int i = 0; i < baseList.size(); i++) { Array.set(result, i, (E) baseList.get(i)); } return (E[]) result; }
Source:
public String getName() { return MODULE; }

Target:
public String getName() { return "logger"; }
Source:
private void addSlab(int minimumSize) { this.currentSlabIndex += 1; int nextSlabSize; if (size == 0) { nextSlabSize = initialSize; } else if (size > pageSize / 5) { nextSlabSize = pageSize / 5; } else { nextSlabSize = size; } if (nextSlabSize < minimumSize) { if (Log.DEBUG) LOG.debug(format("slab size %,d too small for value of size %,d. Bumping up slab size", nextSlabSize, minimumSize)); nextSlabSize = minimumSize; } if (Log.DEBUG) LOG.debug(format("used %d slabs, new slab size %d", currentSlabIndex, nextSlabSize)); this.currentSlab = new byte[nextSlabSize]; this.slabs.add(currentSlab); this.capacity += nextSlabSize; this.currentSlabPosition = 0; }

Target:
private void addSlab(int minimumSize) { int nextSlabSize; if (bytesUsed == 0) { nextSlabSize = initialSlabSize; } else if (bytesUsed > maxCapacityHint / 5) { nextSlabSize = maxCapacityHint / 5; } else { nextSlabSize = bytesUsed; } if (nextSlabSize < minimumSize) { if (Log.DEBUG) LOG.debug(format("slab size %,d too small for value of size %,d. Bumping up slab size", nextSlabSize, minimumSize)); nextSlabSize = minimumSize; } if (Log.DEBUG) LOG.debug(format("used %d slabs, adding new slab of size %d", slabs.size(), nextSlabSize)); this.currentSlab = new byte[nextSlabSize]; this.slabs.add(currentSlab); this.bytesAllocated += nextSlabSize; this.currentSlabIndex = 0; }
Source:
public void testConfigurePipelineSchemaWithMissingInputNameField() throws Exception { Schema inputSchemaString = Schema.recordOf( "event", Schema.Field.of("CLF", Schema.of(Schema.Type.STRING)) ); MockPipelineConfigurer mockConfigurer = new MockPipelineConfigurer(inputSchemaString, ImmutableMap.of( CoreValidator.ID, new CoreValidator())); S3_TRANSFORM.configurePipeline(mockConfigurer); Assert.assertEquals(1, mockConfigurer.getStageConfigurer().getFailureCollector().getValidationFailures().size()); }

Target:
public void testConfigurePipelineSchemaWithMissingInputNameField() throws Exception { Schema inputSchemaString = Schema.recordOf( "event", Schema.Field.of("CLF", Schema.of(Schema.Type.STRING)) ); MockPipelineConfigurer mockConfigurer = new MockPipelineConfigurer(inputSchemaString, ImmutableMap.of( CoreValidator.ID, new CoreValidator())); S3_TRANSFORM.configurePipeline(mockConfigurer); FailureCollector collector = mockConfigurer.getStageConfigurer().getFailureCollector(); Assert.assertEquals(1, collector.getValidationFailures().size()); Assert.assertEquals(1, collector.getValidationFailures().get(0).getCauses().size()); Cause expectedCause = new Cause(); expectedCause.addAttribute(CauseAttributes.STAGE_CONFIG, "inputName"); Assert.assertEquals(expectedCause, collector.getValidationFailures().get(0).getCauses().get(0)); }
Source:
public void testUploadBundleFromRepository() throws IOException, InterruptedException { Bundle[] bundlesBeforeUpload, bundlesAfterUpload; String uri = String.format("http://%s:%d/admin/api/bundles/upload/", HOST, PORT); HttpPost httpPost = new HttpPost(uri); MultipartEntityBuilder entity = MultipartEntityBuilder.create(); Charset chars = Charset.forName("UTF-8"); entity.setCharset(chars); entity.addTextBody("moduleSource", "Repository", ContentType.MULTIPART_FORM_DATA); entity.addTextBody("moduleId","org.motechproject:cms-lite:LATEST", ContentType.MULTIPART_FORM_DATA); entity.addTextBody("startBundle","on", ContentType.MULTIPART_FORM_DATA); httpPost.setEntity(entity.build()); bundlesBeforeUpload = bundleContext.getBundles(); HttpResponse response = getHttpClient().execute(httpPost); EntityUtils.consume(response.getEntity()); bundlesAfterUpload = bundleContext.getBundles(); assertTrue(bundlesAfterUpload.length == bundlesBeforeUpload.length+1); }

Target:
public void testUploadBundleFromRepository() throws IOException, InterruptedException { uploadBundle("Repository", "org.motechproject:cms-lite:LATEST", null, "on","org.motechproject.cms-lite"); }
Source:
public void setLocation(Location location) { if (hasPermissions()) { return; } fusedLocationProviderClient.setMockLocation(location); }

Target:
public void setLocation(Location location) { if (!hasPermissions()) { return; } if (!googleApiClient.isConnected()) { Log.d(TAG, "GoogleApiClient is not connected"); return; } fusedLocationProviderClient.setMockLocation(location); }
Source:
public void testOffsetting() { SWTBotUtils.createProject(TEST_FOR_OFFSETTING); SWTBotUtils.openTrace(TEST_FOR_OFFSETTING, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub"); SWTBotTreeItem treeItem = SWTBotUtils.selectTracesFolder(fBot, TEST_FOR_OFFSETTING); final SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotTable eventsTableBot = bot.activeEditor().bot().table(); String timestamp = eventsTableBot.cell(1, 1); assertEquals("19:00:00.000 000 000", timestamp); treeItem.select(); treeItem.getItems()[0].contextMenu("Apply Time Offset...").click(); SWTBotUtils.waitForJobs(); SWTBotShell shell = fBot.shell("Apply time offset"); shell.setFocus(); final SWTBot shellBot = shell.bot(); assertNotNull(shellBot); SWTBotTreeItem[] allItems = shellBot.tree().getAllItems(); final SWTBotTreeItem swtBotTreeItem = allItems[0]; swtBotTreeItem.select(); swtBotTreeItem.click(1); KeyStroke[] keyStrokes = new KeyStroke[1]; keyStrokes[0] = KeyStroke.getInstance('9'); swtBotTreeItem.pressShortcut(keyStrokes); keyStrokes[0] = KeyStroke.getInstance('9'); swtBotTreeItem.pressShortcut(keyStrokes); keyStrokes[0] = KeyStroke.getInstance(SWT.CR); swtBotTreeItem.pressShortcut(keyStrokes); SWTBotUtils.waitForJobs(); shellBot.button("OK").click(); SWTBotUtils.openTrace(TEST_FOR_OFFSETTING, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub"); SWTBotUtils.waitForJobs(); timestamp = eventsTableBot.cell(1, 1); assertEquals("19:00:00.000 000 000", timestamp); }

Target:
public void testOffsetting() { SWTBotUtils.createProject(PROJET_NAME); SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub"); SWTBotTreeItem treeItem = SWTBotUtils.selectTracesFolder(fBot, PROJET_NAME); SWTBotTable eventsTableBot = fBot.activeEditor().bot().table(); String timestamp = eventsTableBot.cell(1, 1); assertEquals("19:00:00.000 000 000", timestamp); treeItem.select(); treeItem.getItems()[0].contextMenu("Apply Time Offset...").click(); SWTBotUtils.waitForJobs(); SWTBotShell shell = fBot.shell("Apply time offset"); shell.setFocus(); SWTBotTreeItem[] allItems = fBot.tree().getAllItems(); final SWTBotTreeItem swtBotTreeItem = allItems[0]; swtBotTreeItem.select(); swtBotTreeItem.click(1); KeyStroke[] keyStrokes = new KeyStroke[1]; keyStrokes[0] = KeyStroke.getInstance('9'); swtBotTreeItem.pressShortcut(keyStrokes); keyStrokes[0] = KeyStroke.getInstance('9'); swtBotTreeItem.pressShortcut(keyStrokes); keyStrokes[0] = KeyStroke.getInstance(SWT.CR); swtBotTreeItem.pressShortcut(keyStrokes); SWTBotUtils.waitForJobs(); fBot.button("OK").click(); SWTBotUtils.openTrace(PROJET_NAME, fLocation.getAbsolutePath(), "org.eclipse.linuxtools.tmf.core.tests.xmlstub"); SWTBotUtils.waitForJobs(); timestamp = eventsTableBot.cell(1, 1); assertEquals("19:00:00.000 000 000", timestamp); SWTBotUtils.deleteProject(PROJET_NAME, fBot); }
Source:
private void testTimeout() throws Exception { String url = getURL("connectionPool", true), user = getUser(); String password = getPassword(); final JdbcConnectionPool man = JdbcConnectionPool.create(url, user, password); man.setLoginTimeout(1); createClassProxy(man.getClass()); assertThrows(IllegalArgumentException.class, man). setMaxConnections(-1); man.setMaxConnections(2); Task t = new Task() { @Override public void call() { while (!stop) { man.setMaxConnections(1); man.setMaxConnections(2); } } }; t.execute(); long time = System.nanoTime(); Connection conn2 = null; try (Connection conn = man.getConnection()) { conn2 = man.getConnection(); man.getConnection(); fail(); } catch (SQLException e) { if (conn2 != null) { conn2.close(); } assertContains(e.toString().toLowerCase(), "timeout"); time = System.nanoTime() - time; assertTrue("timeout after " + TimeUnit.NANOSECONDS.toMillis(time) + " ms", time > TimeUnit.SECONDS.toNanos(1)); } finally { t.get(); } man.dispose(); }

Target:
private void testTimeout() throws Exception { String url = getURL("connectionPool", true), user = getUser(); String password = getPassword(); final JdbcConnectionPool man = JdbcConnectionPool.create(url, user, password); man.setLoginTimeout(1); createClassProxy(man.getClass()); assertThrows(IllegalArgumentException.class, man). setMaxConnections(-1); man.setMaxConnections(2); Connection conn = man.getConnection(); Task t = new Task() { @Override public void call() { while (!stop) { man.setMaxConnections(1); man.setMaxConnections(2); } } }; t.execute(); long time = System.nanoTime(); Connection conn2 = null; try { conn2 = man.getConnection(); man.getConnection(); fail(); } catch (SQLException e) { if (conn2 != null) { conn2.close(); } assertContains(e.toString().toLowerCase(), "timeout"); time = System.nanoTime() - time; assertTrue("timeout after " + TimeUnit.NANOSECONDS.toMillis(time) + " ms", time > TimeUnit.SECONDS.toNanos(1)); } finally { conn.close(); t.get(); } man.dispose(); }
Source:
private Type(String name) { this.name = name; }

Target:
Type(String name) { this.name = name; }
Source:
public static @Nullable Pattern getPatternForBuild(@Nonnull AbstractBuild<?, ?> build) { if (secretsForBuild.containsKey(build)) { return Pattern.compile(MultiBinding.getSecretForStrings(secretsForBuild.get(build)).getPlainText()); } else { return null; } }

Target:
public static @CheckForNull Pattern getPatternForBuild(@Nonnull AbstractBuild<?, ?> build) { if (secretsForBuild.containsKey(build)) { return Pattern.compile(MultiBinding.getPatternStringForSecrets(secretsForBuild.get(build))); } else { return null; } }
Source:
private Map<String, ResourceAssignment> partialRebalance( ResourceControllerDataProvider clusterData, Map<HelixConstants.ChangeType, Set<String>> clusterChanges, Map<String, Resource> resourceMap, final CurrentStateOutput currentStateOutput) throws HelixRebalanceException { LOG.info("Start calculating the new best possible assignment."); Map<String, ResourceAssignment> currentBaseline = getBaselineAssignment(_assignmentMetadataStore, currentStateOutput, resourceMap.keySet()); Map<String, ResourceAssignment> currentBestPossibleAssignment = getBestPossibleAssignment(_assignmentMetadataStore, currentStateOutput, resourceMap.keySet()); Map<String, ResourceAssignment> newAssignment = calculateAssignment(clusterData, clusterChanges, resourceMap, clusterData.getEnabledLiveInstances(), currentBaseline, currentBestPossibleAssignment); try { _assignmentMetadataStore.persistBestPossibleAssignment(newAssignment); } catch (Exception ex) { throw new HelixRebalanceException("Failed to persist the new best possible assignment.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } LOG.info("Finish calculating the new best possible assignment."); return newAssignment; }

Target:
private Map<String, ResourceAssignment> partialRebalance( ResourceControllerDataProvider clusterData, Map<HelixConstants.ChangeType, Set<String>> clusterChanges, Map<String, Resource> resourceMap, final CurrentStateOutput currentStateOutput) throws HelixRebalanceException { LOG.info("Start calculating the new best possible assignment."); Map<String, ResourceAssignment> currentBaseline = getBaselineAssignment(_assignmentMetadataStore, currentStateOutput, resourceMap.keySet()); Map<String, ResourceAssignment> currentBestPossibleAssignment = getBestPossibleAssignment(_assignmentMetadataStore, currentStateOutput, resourceMap.keySet()); Map<String, ResourceAssignment> newAssignment = calculateAssignment(clusterData, clusterChanges, resourceMap, clusterData.getEnabledLiveInstances(), currentBaseline, currentBestPossibleAssignment); if (_assignmentMetadataStore != null) { try { _assignmentMetadataStore.persistBestPossibleAssignment(newAssignment); } catch (Exception ex) { throw new HelixRebalanceException("Failed to persist the new best possible assignment.", HelixRebalanceException.Type.INVALID_REBALANCER_STATUS, ex); } } else { LOG.debug("Assignment Metadata Store is empty. Skip persist the baseline assignment."); } LOG.info("Finish calculating the new best possible assignment."); return newAssignment; }
Source:
public void onCreate() { super.onCreate(); VialerApplication.get().component().inject(this); AudioStateChangeReceiver.fetch(); mHandler = new Handler(); mToneGenerator = new ToneGenerator( AudioManager.STREAM_VOICE_CALL, SipConstants.RINGING_VOLUME); mSipBroadcaster = new SipBroadcaster(this); mPreferences = new Preferences(this); mLogger = new Logger(SipService.class); mNativeCallManager = new NativeCallManager((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)); mLogger.d("onCreate"); IntentFilter filter = new IntentFilter(); filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); registerReceiver(phoneStateReceiver, filter); IntentFilter networkFilter = new IntentFilter(); networkFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); registerReceiver(mNetworkSwitch, networkFilter); mCheckServiceHandler = new Handler(); mCheckServiceRunnable = new Runnable() { @Override public void run() { checkServiceBeingUsed(); mCheckServiceHandler.postDelayed(this, CHECK_SERVICE_USER_INTERVAL_MS); } }; mCheckServiceHandler.postDelayed(mCheckServiceRunnable, CHECK_SERVICE_USER_INTERVAL_MS); PhoneAccount phoneAccount = new JsonStorage<PhoneAccount>(this).get(PhoneAccount.class); if (phoneAccount != null) { mSipConfig = mSipConfig.init(this, phoneAccount); mSipConfig.initLibrary(this); } else { mLogger.w("No sip account when trying to create service"); stopSelf(); } }

Target:
public void onCreate() { super.onCreate(); VialerApplication.get().component().inject(this); AudioStateChangeReceiver.fetch(); mHandler = new Handler(); mToneGenerator = new ToneGenerator( AudioManager.STREAM_VOICE_CALL, SipConstants.RINGING_VOLUME); mSipBroadcaster = new SipBroadcaster(this); mPreferences = new Preferences(this); mLogger = new Logger(SipService.class); mNativeCallManager = new NativeCallManager((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)); mLogger.d("onCreate"); mBroadcastReceiverManager.registerReceiverViaGlobalBroadcastManager(phoneStateReceiver, TelephonyManager.ACTION_PHONE_STATE_CHANGED); mBroadcastReceiverManager.registerReceiverViaGlobalBroadcastManager(mNetworkConnectivity, ConnectivityManager.CONNECTIVITY_ACTION); mCheckServiceHandler = new Handler(); mCheckServiceRunnable = new Runnable() { @Override public void run() { checkServiceBeingUsed(); mCheckServiceHandler.postDelayed(this, CHECK_SERVICE_USER_INTERVAL_MS); } }; mCheckServiceHandler.postDelayed(mCheckServiceRunnable, CHECK_SERVICE_USER_INTERVAL_MS); PhoneAccount phoneAccount = new JsonStorage<PhoneAccount>(this).get(PhoneAccount.class); if (phoneAccount != null) { mSipConfig = mSipConfig.init(this, phoneAccount); mSipConfig.initLibrary(this); } else { mLogger.w("No sip account when trying to create service"); stopSelf(); } }
Source:
private void setVotingMembers() { if (LOG.isDebugEnabled()) LOG.debug("Setting voting and non-voting members of replica set: {}", name); boolean seenPrimary = !primary.isPresent(); String expectedPrimary = primary.isPresent() ? primary.get().getHostText() + ":" + primary.get().getPort() : ""; int setSize = this.members.size(); int votingMembers = Math.min(setSize % 2 == 0 ? setSize - 1 : setSize, MAXIMUM_VOTING_MEMBERS); for (Object member : this.members) { if (member instanceof BasicBSONObject) { BasicBSONObject bsonObject = BasicBSONObject.class.cast(member); String host = bsonObject.getString("host"); if (this.primary.isPresent() && expectedPrimary.equals(host)) { bsonObject.put("votes", 1); --votingMembers; seenPrimary = true; if (LOG.isDebugEnabled()) LOG.debug("Voting member (primary) of set {}: {}", name, host); } else if (votingMembers-- > 0) { bsonObject.put("votes", 1); if (LOG.isDebugEnabled()) LOG.debug("Voting member of set {}: {}", name, host); } else { bsonObject.put("votes", 0); if (LOG.isDebugEnabled()) LOG.debug("Non-voting member of set {}: {}", name, host); } } else { LOG.error("Unexpected entry in replica set members list: " + member); } } if (!seenPrimary) { LOG.warn("Cannot give replica set primary a vote in reconfigured set: " + "primary was indicated as but no member with that host and port was seen in the set.", this.primary); } }

Target:
private void setVotingMembers() { if (LOG.isDebugEnabled()) LOG.debug("Setting voting and non-voting members of replica set: {}", name); boolean seenPrimary = false; String expectedPrimary = primary.isPresent() ? primary.get().getHostText() + ":" + primary.get().getPort() : ""; int setSize = this.members.size(); int nonPrimaryVotingMembers = Math.min(setSize % 2 == 0 ? setSize - 1 : setSize, MAXIMUM_VOTING_MEMBERS); if (primary.isPresent()) { if (LOG.isTraceEnabled()) LOG.trace("Reserving vote for primary: " + expectedPrimary); nonPrimaryVotingMembers -= 1; } for (Object member : this.members) { if (member instanceof BasicBSONObject) { BasicBSONObject bsonObject = BasicBSONObject.class.cast(member); String host = bsonObject.getString("host"); if (this.primary.isPresent() && expectedPrimary.equals(host)) { bsonObject.put("votes", 1); seenPrimary = true; if (LOG.isDebugEnabled()) LOG.debug("Voting member (primary) of set {}: {}", name, host); } else if (nonPrimaryVotingMembers-- > 0) { bsonObject.put("votes", 1); if (LOG.isDebugEnabled()) LOG.debug("Voting member of set {}: {}", name, host); } else { bsonObject.put("votes", 0); if (LOG.isDebugEnabled()) LOG.debug("Non-voting member of set {}: {}", name, host); } } else { LOG.error("Unexpected entry in replica set members list: " + member); } } if (primary.isPresent() && !seenPrimary) { LOG.warn("Cannot give replica set primary a vote in reconfigured set: " + "primary was indicated as but no member with that host and port was seen in the set. " + "The replica set now has an even number of voters.", this.primary); } }
Source:
public void retrieveItems() throws IOException { String input = "{\"items\":{" + "\"egg-1\":{\"id\":\"egg-1\",\"type\": \"food\",\"name\":\"egg\",\"description\":\"A nice egg\"," + "\"position\":\"mouth\"," + "\"properties\":{\"weight\":1,\"value\":3,\"health\":2}}," + "\"milk-bottle\":{\"id\":\"milk-bottle\",\"type\": \"food-liquid\",\"name\":\"milk\",\"description\":\"Milk in a bottle\"," + "\"position\":\"mouth\"," + "\"properties\":{\"weight\":1,\"value\":10,\"health\":5}}" + "}}"; JsonReader jsonReader = new JsonReader(new StringReader(input)); ItemRepository itemRepo = new ItemRepository(); itemRepo.retrieve(jsonReader); Item eggItem = itemRepo.getItem("egg-1"); assertEquals("A nice egg", eggItem.getDescription()); Item milkItem = itemRepo.getItem("milk-bottle"); assertEquals("Milk in a bottle", milkItem.getDescription()); }

Target:
public void retrieveItems() throws IOException { String input = "{\"items\":{" + "\"fegg1\":{\"id\":\"fegg1\",\"type\": \"food\",\"name\":\"egg\",\"description\":\"A nice egg\"," + "\"position\":\"mouth\"," + "\"properties\":{\"weight\":1,\"value\":3,\"health\":2}}," + "\"fmil1\":{\"id\":\"fmil1\",\"type\": \"food-liquid\",\"name\":\"milk\",\"description\":\"Milk in a bottle\"," + "\"position\":\"mouth\"," + "\"properties\":{\"weight\":1,\"value\":10,\"health\":5}}" + "}}"; JsonReader jsonReader = new JsonReader(new StringReader(input)); ItemRepository itemRepo = new ItemRepository(); itemRepo.retrieve(jsonReader); Item eggItem = itemRepo.getItem("fegg1"); assertEquals("A nice egg", eggItem.getDescription()); Item milkItem = itemRepo.getItem("fmil1"); assertEquals("Milk in a bottle", milkItem.getDescription()); }
Source:
public ItemLockableDataProcessor() { super(t -> true, Keys.LOCK_TOKEN); }

Target:
public ItemLockableDataProcessor() { super(stack -> { Item item = stack.getItem(); return item.equals(Item.getItemFromBlock(Blocks.chest)) || item.equals(Item.getItemFromBlock(Blocks.furnace)) || item.equals(Item.getItemFromBlock(Blocks.lit_furnace)) || item.equals(Item.getItemFromBlock(Blocks.dispenser)) || item.equals(Item.getItemFromBlock(Blocks.dropper)) || item.equals(Item.getItemFromBlock(Blocks.hopper)) || item.equals(Item.getItemFromBlock(Blocks.brewing_stand)) || item.equals(Item.getItemFromBlock(Blocks.beacon)); }, Keys.LOCK_TOKEN); }
Source:
static <T> T checkNotNull(T object, String message, Object... args) { if (args.length > 0) message = String.format(message, args); if (object == null) throw new NullPointerException(message); return object; }

Target:
static <T> T checkNotNull(T object, String message, Object... args) { if (object == null) { throw new NullPointerException(String.format(message, args)); } return object; }
Source:
public void checkInputs(List inputs) throws IllegalArgumentException { Object[] list = inputs.toArray(); if (list.length < 2) throw new IllegalArgumentException("requires more than two inputs"); Function function = null; if (list[0] instanceof Function) { function = (Function) (list[0]); } else { throw new IllegalArgumentException("first arg to higher-order " + " function must be a function"); } if (!function.getReturnType().toString().equals(BooleanAttribute.identifier)) throw new IllegalArgumentException("higher-order function must " + "use a boolean function"); List<Evaluatable> bagArgs = new ArrayList(); List<Evaluatable> args = new ArrayList(); for (int i = 1; i < list.length; i++) { Evaluatable eval = (Evaluatable) (list[i]); if (eval.returnsBag()) { bagArgs.add(eval); } else { args.add(eval); } } if (functionId == ID_ALL_OF || functionId == ID_ANY_OF) { if (bagArgs.size() != 1) { throw new IllegalArgumentException("Only one argument SHALL be a bag of a primitive data-type for " + getIdentifier()); } for (Evaluatable arg : args) { List<Evaluatable> inputForCheck = new ArrayList(); inputForCheck.add(arg); inputForCheck.addAll(bagArgs); function.checkInputsNoBag(inputForCheck); } } else { if (args.size() > 0 && bagArgs.size() > 0) { throw new IllegalArgumentException("The arguments can be are either primitive data types or " + "bags of primitive types. " + getIdentifier()); } if (args.size() > 0) { validateAnyOfAnyInput(args, function); } else { validateAnyOfAnyInput(bagArgs, function); } } }

Target:
public void checkInputs(List inputs) throws IllegalArgumentException { Object[] list = inputs.toArray(); if (list.length < 2) { throw new IllegalArgumentException("requires more than two inputs"); } Function function; if (list[0] instanceof Function) { function = (Function) (list[0]); } else { throw new IllegalArgumentException("first arg to higher-order " + " function must be a function"); } if (!function.getReturnType().toString().equals(BooleanAttribute.identifier)) throw new IllegalArgumentException("higher-order function must " + "use a boolean function"); List<Evaluatable> bagArgs = new ArrayList(); List<Evaluatable> args = new ArrayList(); for (int i = 1; i < list.length; i++) { Evaluatable eval = (Evaluatable) (list[i]); if (eval.returnsBag()) { bagArgs.add(eval); } else { args.add(eval); } } if (functionId == ID_ALL_OF || functionId == ID_ANY_OF) { if (bagArgs.size() != 1) { throw new IllegalArgumentException("Only one argument SHALL be a bag of a primitive data-type for " + getIdentifier()); } for (Evaluatable arg : args) { List<Evaluatable> inputForCheck = new ArrayList(); inputForCheck.add(arg); inputForCheck.addAll(bagArgs); function.checkInputsNoBag(inputForCheck); } } else { if (!args.isEmpty() && !bagArgs.isEmpty()) { throw new IllegalArgumentException("The arguments can be are either primitive data types or " + "bags of primitive types. " + getIdentifier()); } if (!args.isEmpty()) { validateAnyOfAnyInput(args, function); } else { validateAnyOfAnyInput(bagArgs, function); } } }
Source:
private Metrics buildAppMetrics(final double sampleLoss, final double regLoss, final double accuracy, final double elapsedTime, final int numInstances) { final Map<CharSequence, Double> appMetricMap = new HashMap<>(); appMetricMap.put(MetricKeys.NUM_INSTANCES, (double) numInstances); appMetricMap.put(MetricKeys.SAMPLE_LOSS_AVG, sampleLoss); appMetricMap.put(MetricKeys.REG_LOSS_AVG, regLoss); appMetricMap.put(MetricKeys.ACCURACY, accuracy); appMetricMap.put(MetricKeys.DVT, numInstances / elapsedTime); return Metrics.newBuilder() .setData(appMetricMap) .build(); }

Target:
private Metrics buildAppMetrics(final double sampleLoss, final double regLoss, final double accuracy, final double elapsedTime, final int numInstances) { final Map<CharSequence, Double> appMetricMap = new HashMap<>(); appMetricMap.put(MetricKeys.SAMPLE_LOSS_AVG, sampleLoss); appMetricMap.put(MetricKeys.REG_LOSS_AVG, regLoss); appMetricMap.put(MetricKeys.ACCURACY, accuracy); appMetricMap.put(MetricKeys.DVT, numInstances / elapsedTime); return Metrics.newBuilder() .setData(appMetricMap) .build(); }
Source:
protected void thingDiscovered(DiscoveryResult discoveryResult) { discoveryResult.discoveredBy(this.getClass().getName()); for (DiscoveryListener discoveryListener : discoveryListeners) { try { discoveryListener.thingDiscovered(this, discoveryResult); } catch (Exception e) { logger.error("An error occurred while calling the discovery listener " + discoveryListener.getClass().getName() + ".", e); } } synchronized (cachedResults) { cachedResults.put(discoveryResult.getThingUID(), discoveryResult); } }

Target:
protected void thingDiscovered(DiscoveryResult discoveryResult) { for (DiscoveryListener discoveryListener : discoveryListeners) { try { discoveryListener.thingDiscovered(this, discoveryResult); } catch (Exception e) { logger.error("An error occurred while calling the discovery listener " + discoveryListener.getClass().getName() + ".", e); } } synchronized (cachedResults) { cachedResults.put(discoveryResult.getThingUID(), discoveryResult); } }
Source:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (!pushCertNonce.isEmpty()) adv.advertiseCapability(CAPABILITY_PUSH_CERT + "=" + pushCertNonce); if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); adv.send(getAdvertisedOrDefaultRefs()); for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }

Target:
public void sendAdvertisedRefs(final RefAdvertiser adv) throws IOException, ServiceMayNotContinueException { if (advertiseError != null) { adv.writeOne("ERR " + advertiseError); return; } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } adv.init(db); adv.advertiseCapability(CAPABILITY_SIDE_BAND_64K); adv.advertiseCapability(CAPABILITY_DELETE_REFS); adv.advertiseCapability(CAPABILITY_REPORT_STATUS); if (pushCertificateParser.enabled()) adv.advertiseCapability( pushCertificateParser.getAdvertiseNonce()); if (db.getRefDatabase().performsAtomicTransactions()) adv.advertiseCapability(CAPABILITY_ATOMIC); if (allowOfsDelta) adv.advertiseCapability(CAPABILITY_OFS_DELTA); adv.send(getAdvertisedOrDefaultRefs()); for (ObjectId obj : advertisedHaves) adv.advertiseHave(obj); if (adv.isEmpty()) adv.advertiseId(ObjectId.zeroId(), "capabilities^{}"); adv.end(); }
Source:
public void run() { while (!shutdown) { try { Thread.sleep(logDelayMillis); } catch (InterruptedException e) { continue; } tasksSizes.clear(); for (ScheduledExecutorPartition partition : partitions) { if (partition == null) { continue; } if (partitionService.getPartitionOwner(partition.partitionId()) != nodeEngine.getThisAddress()) { continue; } for (Map.Entry<String, ScheduledExecutorContainer> entry : partition.containers.entrySet()) { String name = entry.getKey(); ScheduledExecutorContainer container = entry.getValue(); MutableInteger tasksSize = tasksSizes.get(name); if (tasksSize == null) { tasksSize = new MutableInteger(); tasksSizes.put(name, tasksSize); } tasksSize.value += container.tasks.size(); } } for (Map.Entry<String, MutableInteger> entry : tasksSizes.entrySet()) { logger.info("ScheduledExecutorService(name=" + entry.getKey() + ",tasksSize=" + entry.getValue().value + ")"); } } }

Target:
public void run() { try { while (!shutdown) { try { Thread.sleep(logDelayMillis); } catch (InterruptedException e) { continue; } gatherStats(); logStats(); tasksSizes.clear(); } } catch (Exception e) { logger.warning("StatsLoggerThread failed, message [" + e.getMessage() + "]", e); } }
Source:
private Widget operatorDropDown(final SingleFieldConstraint constraint, final FlexTable inner, final int rowIndex, final int colIndex) { final HorizontalPanel dropdownContainer = new HorizontalPanel(); if (!this.readOnly) { final SingleFieldConstraintOperatorSelectorBuilder operatorSelectorBuilder = GWT.create(SingleFieldConstraintOperatorSelectorBuilder.class); operatorSelectorBuilder.hasConstraint(constraint); operatorSelectorBuilder.hasConstraintValueEditor(() -> constraintValueEditor); operatorSelectorBuilder.hasConstraintValueEditorProducer(this::createValueEditor); operatorSelectorBuilder.hasParentWidgetWidget(this); operatorSelectorBuilder.hasAsyncPackageDataModel(getConnectives().getDataModelOracle()); operatorSelectorBuilder.hasPlaceholderForOperatorsDropdown(dropdownContainer); operatorSelectorBuilder.hasConstraintValueEditorInWrapperAtPosition(inner, rowIndex, colIndex); operatorSelectorBuilder.build(); } else { final SmallLabel sl = new SmallLabel("<b>" + (constraint.getOperator() == null ? GuidedRuleEditorResources.CONSTANTS.pleaseChoose() : HumanReadable.getOperatorDisplayName(constraint.getOperator())) + "</b>"); dropdownContainer.add(sl); } return dropdownContainer; }

Target:
private Widget operatorDropDown(final SingleFieldConstraint constraint, final FlexTable inner, final int rowIndex, final int colIndex) { final HorizontalPanel dropdownContainer = new HorizontalPanel(); if (!this.readOnly) { final SingleFieldConstraintOperatorSelector operatorSelectorBuilder = GWT.create(SingleFieldConstraintOperatorSelector.class); operatorSelectorBuilder.configure(constraint, () -> constraintValueEditor, this::createValueEditor, this, dropdownContainer, inner, rowIndex, colIndex, getConnectives().getDataModelOracle()); } else { final SmallLabel sl = new SmallLabel("<b>" + (constraint.getOperator() == null ? GuidedRuleEditorResources.CONSTANTS.pleaseChoose() : HumanReadable.getOperatorDisplayName(constraint.getOperator())) + "</b>"); dropdownContainer.add(sl); } return dropdownContainer; }
Source:
private void onPostPlayback(final Playable playable, boolean ended, boolean skipped, boolean playingNext) { PlaybackPreferences.clearCurrentlyPlayingTemporaryPlaybackSpeed(); if (playable == null) { Log.e(TAG, "Cannot do post-playback processing: media was null"); return; } Log.d(TAG, "onPostPlayback(): media=" + playable.getEpisodeTitle()); if (!(playable instanceof FeedMedia)) { Log.d(TAG, "Not doing post-playback processing: media not of type FeedMedia"); if (ended) { playable.onPlaybackCompleted(getApplicationContext()); } else { playable.onPlaybackPause(getApplicationContext()); } return; } FeedMedia media = (FeedMedia) playable; FeedItem item = media.getItem(); boolean smartMarkAsPlayed = media.hasAlmostEnded(); if (!ended && smartMarkAsPlayed) { Log.d(TAG, "smart mark as played"); } if (ended || smartMarkAsPlayed) { media.onPlaybackCompleted(getApplicationContext()); } else { media.onPlaybackPause(getApplicationContext()); } if (playable.hasAutoSkippedEnding()) { ended = true; } if (item != null) { if (ended || smartMarkAsPlayed || (skipped && !UserPreferences.shouldSkipKeepEpisode())) { DBWriter.markItemPlayed(item, FeedItem.PLAYED, ended); DBWriter.removeQueueItem(PlaybackService.this, ended, item); if (item.getFeed().getPreferences().getCurrentAutoDelete() && (!item.isTagged(FeedItem.TAG_FAVORITE) || !UserPreferences.shouldFavoriteKeepEpisode())) { DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media.getId()); Log.d(TAG, "Episode Deleted"); } } } if (ended || skipped || playingNext) { DBWriter.addItemToPlaybackHistory(media); } }

Target:
private void onPostPlayback(final Playable playable, boolean ended, boolean skipped, boolean playingNext) { PlaybackPreferences.clearCurrentlyPlayingTemporaryPlaybackSpeed(); if (playable == null) { Log.e(TAG, "Cannot do post-playback processing: media was null"); return; } Log.d(TAG, "onPostPlayback(): media=" + playable.getEpisodeTitle()); if (!(playable instanceof FeedMedia)) { Log.d(TAG, "Not doing post-playback processing: media not of type FeedMedia"); if (ended) { playable.onPlaybackCompleted(getApplicationContext()); } else { playable.onPlaybackPause(getApplicationContext()); } return; } FeedMedia media = (FeedMedia) playable; FeedItem item = media.getItem(); boolean smartMarkAsPlayed = media.hasAlmostEnded(); if (!ended && smartMarkAsPlayed) { Log.d(TAG, "smart mark as played"); } if (ended || smartMarkAsPlayed) { media.onPlaybackCompleted(getApplicationContext()); } else { media.onPlaybackPause(getApplicationContext()); } if (autoSkippedFeedMediaId >= 0 && autoSkippedFeedMediaId == media.getId()) { ended = true; } if (item != null) { if (ended || smartMarkAsPlayed || (skipped && !UserPreferences.shouldSkipKeepEpisode())) { DBWriter.markItemPlayed(item, FeedItem.PLAYED, ended); DBWriter.removeQueueItem(PlaybackService.this, ended, item); if (item.getFeed().getPreferences().getCurrentAutoDelete() && (!item.isTagged(FeedItem.TAG_FAVORITE) || !UserPreferences.shouldFavoriteKeepEpisode())) { DBWriter.deleteFeedMediaOfItem(PlaybackService.this, media.getId()); Log.d(TAG, "Episode Deleted"); } } } if (ended || skipped || playingNext) { DBWriter.addItemToPlaybackHistory(media); } }
Source:
public void authenticatedWhenUserNotAuthenticatedThenDeniedDecision() { AuthenticatedAuthorizationManager<Object> manager = AuthenticatedAuthorizationManager.authenticated(); Supplier<Authentication> authentication = () -> { TestingAuthenticationToken authenticationToken = new TestingAuthenticationToken("user", "password", "ROLE_ADMIN", "ROLE_USER"); authenticationToken.setAuthenticated(false); return authenticationToken; }; Object object = new Object(); assertThat(manager.check(authentication, object).isGranted()).isFalse(); }

Target:
public void authenticatedWhenUserNotAuthenticatedThenDeniedDecision() { AuthenticatedAuthorizationManager<Object> manager = AuthenticatedAuthorizationManager.authenticated(); TestingAuthenticationToken authentication = new TestingAuthenticationToken("user", "password", "ROLE_ADMIN", "ROLE_USER"); authentication.setAuthenticated(false); Object object = new Object(); assertThat(manager.check(() -> authentication, object).isGranted()).isFalse(); }
Source:
public void visit(@NonNull DataChartStringDescriptor<?> desc) { fConsumer = new ScatterStringConsumer(IStringResolver.class.cast(desc.getResolver()), fForXAxis ? fXStringMap : fYStringMap); }

Target:
public void visit(@NonNull DataChartStringDescriptor<?> desc) { fConsumer = new ScatterStringConsumer(IStringResolver.class.cast(desc.getResolver()), fMap); }
Source:
public String determineLastName(Optional<User> user) { return Buddy.determineName(this::getLastName, user, User::getLastName, "message.alternative.last.name", getNickname()); }

Target:
public String determineLastName(Optional<User> user) { return determineName(this::getLastName, user, User::getLastName, "message.alternative.last.name", getNickname()); }
Source:
public Class<?> getCellClass(int column) { EditedStyleItem item = myAttributes.get(myRowIndex); String name = item.getName(); AttributeDefinition attrDefinition = myAttributeDefinitions.getAttrDefByName(name); ResourceValue resourceValue = mySelectedStyle.getConfiguration().getResourceResolver().resolveResValue(item.getItemResourceValue()); if (resourceValue == null) { LOG.error("Unable to resolve " + item.getValue()); return null; } ResourceType urlType = resourceValue.getResourceType(); if (urlType == ResourceType.STYLE && column == 1) { return ThemeEditorStyle.class; } if (urlType == ResourceType.DRAWABLE) { return DrawableDomElement.class; } String value = resourceValue.getValue(); if (value == null) { return String.class; } if (urlType == ResourceType.COLOR || (value.startsWith("#") && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Color))) { return Color.class; } if (column == 1) { if (urlType == ResourceType.INTEGER || ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Integer)) { return Integer.class; } if (urlType == ResourceType.BOOL || ((value.equals("true") || value.equals("false")) && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Boolean))) { return Boolean.class; } } return String.class; }

Target:
public Class<?> getCellClass(int column) { EditedStyleItem item = myAttributes.get(myRowIndex); String name = item.getName(); AttributeDefinition attrDefinition = myAttributeDefinitions.getAttrDefByName(name); ResourceValue resourceValue = mySelectedStyle.getConfiguration().getResourceResolver().resolveResValue(item.getItemResourceValue()); if (resourceValue == null) { LOG.error("Unable to resolve " + item.getValue()); return null; } ResourceType urlType = resourceValue.getResourceType(); String value = resourceValue.getValue(); if (value == null) { if (urlType == ResourceType.STYLE && column == 1) { return ThemeEditorStyle.class; } return String.class; } if (urlType == ResourceType.DRAWABLE) { return DrawableDomElement.class; } if (urlType == ResourceType.COLOR || (value.startsWith("#") && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Color))) { return Color.class; } if (column == 1) { if (urlType == ResourceType.INTEGER || ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Integer)) { return Integer.class; } if (urlType == ResourceType.BOOL || ((value.equals("true") || value.equals("false")) && ThemeEditorUtils.acceptsFormat(attrDefinition, AttributeFormat.Boolean))) { return Boolean.class; } } return String.class; }
Source:
protected Map<String, Pair<String, String>> getExclusiveLocks() { return Collections.singletonMap(getParameters().getStorageDomainId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); }

Target:
protected Map<String, Pair<String, String>> getExclusiveLocks() { if (getParameters().getStorageDomainId() != null) { return Collections.singletonMap(getParameters().getStorageDomainId().toString(), LockMessagesMatchUtil.makeLockingPair(LockingGroup.STORAGE, VdcBllMessages.ACTION_TYPE_FAILED_OBJECT_LOCKED)); } return null; }