auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private int priority(int eventId) { switch (eventId) { case MetricsEvent.NOTIFICATION_NETWORK_SIGN_IN: return 4; case MetricsEvent.NOTIFICATION_NETWORK_NO_INTERNET: return 3; case MetricsEvent.NOTIFICATION_NETWORK_SWITCH: return 2; case MetricsEvent.NOTIFICATION_NETWORK_LOST_INTERNET: return 1; default: return 0; } }

Target:
private static int priority(int eventId) { switch (eventId) { case MetricsEvent.NOTIFICATION_NETWORK_SIGN_IN: return 4; case MetricsEvent.NOTIFICATION_NETWORK_NO_INTERNET: return 3; case MetricsEvent.NOTIFICATION_NETWORK_SWITCH: return 2; case MetricsEvent.NOTIFICATION_NETWORK_LOST_INTERNET: return 1; default: return 0; } }
Source:
public void testCreateInvalidConfigAeadWithAuth() throws Exception { IpSecConfig ipSecConfig = new IpSecConfig(); addDefaultSpisAndRemoteAddrToIpSecConfig(ipSecConfig); for (int direction : DIRECTIONS) { ipSecConfig.setAuthentication(direction, AUTH_ALGO); try { ipSecConfig.setAuthenticatedEncryption(direction, AEAD_ALGO); } catch (IllegalArgumentException expected) { /* Expected exception; do nothing */ } } try { mIpSecService.createTransportModeTransform(ipSecConfig, new Binder()); fail( "IpSecService should have thrown an error on authentication being" + " enabled with authenticated encryption"); } catch (IllegalArgumentException expected) { /* Expected exception; do nothing */ } }

Target:
public void testCreateInvalidConfigAeadWithAuth() throws Exception { IpSecConfig ipSecConfig = new IpSecConfig(); addDefaultSpisAndRemoteAddrToIpSecConfig(ipSecConfig); for (int direction : DIRECTIONS) { ipSecConfig.setAuthentication(direction, AUTH_ALGO); ipSecConfig.setAuthenticatedEncryption(direction, AEAD_ALGO); } try { mIpSecService.createTransportModeTransform(ipSecConfig, new Binder()); fail( "IpSecService should have thrown an error on authentication being" + " enabled with authenticated encryption"); } catch (IllegalArgumentException expected) { } }
Source:
public void test_pipe2_errno() throws Exception { try { // flag=1 is not a valiud value for pip2, will EINVAL Libcore.os.pipe2(1); fail(); } catch(ErrnoException expected) }

Target:
public void test_pipe2_errno() throws Exception { try { // flag=-1 is not a valid value for pip2, will EINVAL Libcore.os.pipe2(-1); fail(); } catch(ErrnoException expected) { } }
Source:
public static InterfaceParams getByName(String name) { final NetworkInterface netif = getNetworkInterfaceByName(name); if (netif == null) return null; // Not all interfaces have MAC addresses, e.g. rmnet_data0. final MacAddress macAddr = getMacAddress(netif); try { return new InterfaceParams(name, netif.getIndex(), macAddr, netif.getMTU()); } catch (IllegalArgumentException|NullPointerException|SocketException e) { return null; } }

Target:
public static InterfaceParams getByName(String name) { final NetworkInterface netif = getNetworkInterfaceByName(name); if (netif == null) return null; // Not all interfaces have MAC addresses, e.g. rmnet_data0. final MacAddress macAddr = getMacAddress(netif); try { return new InterfaceParams(name, netif.getIndex(), macAddr, netif.getMTU()); } catch (IllegalArgumentException|SocketException e) { return null; } }
Source:
public void setCapabilities(@NetCapability int[] capabilities) { mNetworkCapabilities = BitUtils.packBits(capabilities); // Remove given capabilities from unwanted list mUnwantedNetworkCapabilities &= ~(mNetworkCapabilities & mUnwantedNetworkCapabilities); }

Target:
public void setCapabilities(@NetCapability int[] capabilities) { mNetworkCapabilities = BitUtils.packBits(capabilities); // Remove given capabilities from unwanted list mUnwantedNetworkCapabilities &= ~mNetworkCapabilities; }
Source:
private File getApnConfFile() { // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system". File confFile = new File(Environment.getRootDirectory(), PARTNER_APNS_PATH); File oemConfFile = new File(Environment.getOemDirectory(), OEM_APNS_PATH); File vendorConfFile = new File(Environment.getVendorDirectory(), PARTNER_APNS_PATH); File updatedConfFile = new File(Environment.getDataDirectory(), OTA_UPDATED_APNS_PATH); confFile = pickSecondIfExists(confFile, vendorConfFile); confFile = pickSecondIfExists(confFile, oemConfFile); confFile = pickSecondIfExists(confFile, updatedConfFile); return confFile; }

Target:
private File getApnConfFile() { // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system". File confFile = new File(Environment.getRootDirectory(), PARTNER_APNS_PATH); File oemConfFile = new File(Environment.getOemDirectory(), OEM_APNS_PATH); File updatedConfFile = new File(Environment.getDataDirectory(), OTA_UPDATED_APNS_PATH); confFile = pickSecondIfExists(confFile, oemConfFile); confFile = pickSecondIfExists(confFile, updatedConfFile); return confFile; }
Source:
public int computeCellInfoMinInterval() { // The screen is on and we're either on cellular or charging. Screen on + Charging is // a likely vehicular scenario, even if there is a nomadic AP. if (mIsScreenOn && (!mIsWifiConnected || mIsCharging)) { // TODO: should this be an automatic value or a fixed periodic value return CELL_INFO_INTERVAL_SHORT_MS; } // if the screen is off, or the screen is on and connected to wifi and not charging return CELL_INFO_INTERVAL_LONG_MS; }

Target:
public int computeCellInfoMinInterval() { // The screen is on and we're either on cellular or charging. Screen on + Charging is // a likely vehicular scenario, even if there is a nomadic AP. if (mIsScreenOn && !mIsWifiConnected) { // Screen on without WiFi - We are in a high power likely mobile situation. return CELL_INFO_INTERVAL_SHORT_MS; } else if (mIsScreenOn && mIsCharging) { // Screen is on and we're charging, so we favor accuracy over power. return CELL_INFO_INTERVAL_SHORT_MS; } else { // If the screen is off, apps should not need cellular location at rapid intervals. // If the screen is on but we are on wifi and not charging then cellular location // accuracy is not crucial, so favor modem power saving over high accuracy. return CELL_INFO_INTERVAL_LONG_MS; } }
Source:
private void updateMutePreviewOverlayVisibility() { boolean showMuteOverlay = getMuteOverlayConfig(); // Normally the mute overlay shows on the bottom right of the preview bubble. In green screen // mode the preview is fullscreen so there's no where to anchor it. // However, it should be hidden if carrier config of mute overlay is disabled. mutePreviewOverlay.setVisibility( showMuteOverlay && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE); }

Target:
private void updateMutePreviewOverlayVisibility() { // Normally the mute overlay shows on the bottom right of the preview bubble. In green screen // mode the preview is fullscreen so there's no where to anchor it. // However, it should be hidden if carrier config of mute overlay is disabled. mutePreviewOverlay.setVisibility( getMuteOverlayConfig() && muteButton.isChecked() && !isInGreenScreenMode ? View.VISIBLE : View.GONE); }
Source:
public void testScrollBarViewShowAllWhenLimitedSpace() { setLayoutRestrictions(/*allowScrollThumb=*/true, /*allowAlphaJump=*/true, /*bias=*/false); onView(withId(androidx.car.test.R.id.page_up)).check(matches(isDisplayed())); onView(withId(androidx.car.test.R.id.scrollbar_thumb)).check(matches(isDisplayed())); onView(withId(androidx.car.test.R.id.alpha_jump)).check(matches(isDisplayed())); }

Target:
public void testScrollBarViewShowAllWhenLimitedSpace() { setLayoutRestrictions(/* allowScrollThumb= */true, /* allowAlphaJump= */true, /* bias= */false); onView(withId(R.id.page_up)).check(matches(isDisplayed())); onView(withId(R.id.scrollbar_thumb)).check(matches(isDisplayed())); onView(withId(R.id.alpha_jump)).check(matches(isDisplayed())); }
Source:
AlphaJumpTestAdapter() { for (int i = 0; i < sSize; i++) { mStrings[i] = "Dummy" + i; } }

Target:
AlphaJumpTestAdapter() { for (int i = 0; i < mStrings.length; i++) { mStrings[i] = "Dummy" + i; } }
Source:
public void testAuthorizedAPDUAID40() { if (PropertyUtil.getFirstApiLevel() < Build.VERSION_CODES.P) { return; } for (byte[] apdu : AUTHORIZED_APDU_AID_40) { testTransmitAPDU(AID_40, apdu); } }

Target:
public void testAuthorizedAPDUAID40() { for (byte[] apdu : AUTHORIZED_APDU_AID_40) { testTransmitAPDU(AID_40, apdu); } }
Source:
protected void accumulateConsecutiveDnsTimeoutCount(int code) { final DnsResult result = new DnsResult(code); // Keep only the last mSize events in the mDnsEvents. Remove the oldest one if its size // become larger than mSize. final int index = mResultIndices.add(); if (index >= 0 && index < mSize) { mDnsEvents[index] = result; } if (result.isTimeout()) { mConsecutiveTimeoutCount++; } else { // Keep the event in mDnsEvents without clearing it so that there are logs to do the // simulation and analysis. mConsecutiveTimeoutCount = 0; } }

Target:
protected void accumulateConsecutiveDnsTimeoutCount(int code) { final DnsResult result = new DnsResult(code); mDnsEvents[mResultIndices.add()] = result; if (result.isTimeout()) { mConsecutiveTimeoutCount++; } else { // Keep the event in mDnsEvents without clearing it so that there are logs to do the // simulation and analysis. mConsecutiveTimeoutCount = 0; } }
Source:
public void setVpnProxy(@Nullable ProxyInfo proxyInfo) { synchronized (mProxyLock) { if (proxyInfo == null) { mVPNProxy = null; return; } if (!TextUtils.isEmpty(proxyInfo.getHost()) && proxyInfo.getPort() != 0) { // vpn proxy with empty blacklist mVPNProxy = proxyInfo; } } }

Target:
public void setVpnProxy(@Nullable ProxyInfo proxyInfo) { synchronized (mProxyLock) { mVPNProxy = proxyInfo; } }
Source:
public void setUp() { mAppStartupHelper = new AppStartupHelper(); // Make sure the apps are starting from the clean state. HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, CALENDAR_PKG_NAME)); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, SETTINGS_PKG_NAME)); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, SETTINGS_PKG_NAME)); // Make sure display is on and unlocked. HelperTestUtility.wakeUpAndUnlock(); }

Target:
public void setUp() { mAppStartupHelper = new AppStartupHelper(); // Make sure the apps are starting from the clean state. HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, CALENDAR_PKG_NAME)); HelperTestUtility.clearApp(String.format(KILL_TEST_APP_CMD_TEMPLATE, SETTINGS_PKG_NAME)); // Make sure display is on and unlocked. HelperTestUtility.wakeUpAndUnlock(); }
Source:
public void testGetFirstRowItemCount_singleItemFullSpan() throws Throwable { int itemCount = 1; setUpPagedListView(itemCount); RecyclerView recyclerView = mPagedListView.getRecyclerView(); mActivityRule.runOnUiThread(() -> { ((GridLayoutManager) recyclerView.getLayoutManager()).setSpanSizeLookup( new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return SPAN_COUNT; } }); }); // Wait for the UI to lay itself out. InstrumentationRegistry.getInstrumentation().waitForIdleSync(); assertEquals(itemCount, GridLayoutManagerUtils.getFirstRowItemCount(recyclerView)); }

Target:
public void testGetFirstRowItemCount_singleItemFullSpan() throws Throwable { int itemCount = 1; setUpPagedListView(itemCount, new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { return SPAN_COUNT; } }); RecyclerView recyclerView = mPagedListView.getRecyclerView(); // Wait for the UI to lay itself out. InstrumentationRegistry.getInstrumentation().waitForIdleSync(); assertEquals(itemCount, GridLayoutManagerUtils.getFirstRowItemCount(recyclerView)); }
Source:
public void testRunTimedCmd_WithOutputRedirect() throws IOException { File outputRedirect = FileUtil.createTempFile("output_redirect", ".txt"); try { CommandResult result = RunUtil.getDefault() .runTimedCmd( SHORT_TIMEOUT_MS, new FileOutputStream(outputRedirect), /* stderr= */ null, "echo", "TEST_OUTPUT"); assertTrue(CommandStatus.SUCCESS.equals(result.getStatus())); assertEquals("TEST_OUTPUT\n", FileUtil.readStringFromFile(outputRedirect)); } finally { FileUtil.deleteFile(outputRedirect); } }

Target:
public void testRunTimedCmd_WithOutputRedirect() throws IOException { File outputRedirect = FileUtil.createTempFile("output_redirect", ".txt"); FileOutputStream outputStream = new FileOutputStream(outputRedirect); try { CommandResult result = RunUtil.getDefault() .runTimedCmd( SHORT_TIMEOUT_MS, outputStream, /* stderr= */ null, "echo", "TEST_OUTPUT"); assertTrue(CommandStatus.SUCCESS.equals(result.getStatus())); assertEquals("TEST_OUTPUT\n", FileUtil.readStringFromFile(outputRedirect)); } finally { FileUtil.deleteFile(outputRedirect); outputStream.close(); } }
Source:
private boolean doesCellInfoCorrespondToKnownMccMnc(CellInfo ci, Set<String> knownMccMncs) { String mccMnc = ci.getCellIdentity().getMccString() + ci.getCellIdentity().getMncString(); return knownMccMncs.contains(mccMnc); }

Target:
private static boolean doesCellInfoCorrespondToKnownMccMnc(CellInfo ci, Set<String> knownMccMncs) { String mccMnc = ci.getCellIdentity().getMccString() + ci.getCellIdentity().getMncString(); return knownMccMncs.contains(mccMnc); }
Source:
static boolean isTransformSelectedFrom(Transform[] selected, Transform[] selectFrom) { // If the selected proposal has multiple transforms with the same type, the responder MUST // choose a single one. if ((selected.length > 1) || (selected.length == 0) != (selectFrom.length == 0)) { return false; } if (selected.length == 0) return true; Transform chosenTransform = selected[0]; return Arrays.asList(selectFrom).contains(chosenTransform); }

Target:
static boolean isTransformSelectedFrom(Transform[] selected, Transform[] selectFrom) { // If the selected proposal has multiple transforms with the same type, the responder MUST // choose a single one. if ((selected.length > 1) || (selected.length == 0) != (selectFrom.length == 0)) { return false; } if (selected.length == 0) return true; return Arrays.asList(selectFrom).contains(selected[0]); }
Source:
private void prepareDnsTlsMeasurement(String hostname, InetAddress target) { // Since we iterate LinkProperties.getDnsServers() before PrivateDnsCfg.ips, if the entry // of |target| is found in the DnsTlsChecks map, then 1) the entry must have been created // when we iterated LinkProperties.getDnsServers() 2) we are iterating PrivateDnsCfg.ips // now. Thus, overwrite the entry in order to set SNI. if (!mDnsTlsChecks.containsKey(target) || !TextUtils.isEmpty(hostname)) { Measurement measurement = new Measurement(); measurement.thread = new Thread(new DnsTlsCheck(hostname, target, measurement)); mDnsTlsChecks.put(target, measurement); } }

Target:
private void prepareDnsTlsMeasurement(String hostname, InetAddress target) { // If |hostname| is not empty, |target| must be a private DNS server address resolved by // |hostname|. Allow to overwrite the entry in such case in order to carry SNI during SSL // handshake. if (mDnsTlsChecks.containsKey(target) && TextUtils.isEmpty(hostname)) return; Measurement measurement = new Measurement(); measurement.thread = new Thread(new DnsTlsCheck(hostname, target, measurement)); mDnsTlsChecks.put(target, measurement); }
Source:
public static @NonNull JsReplyProxyImpl forInvocationHandler( @NonNull /* JsReplyProxy */ InvocationHandler invocationHandler) { final JsReplyProxyBoundaryInterface boundaryInterface = BoundaryInterfaceReflectionUtil.castToSuppLibClass( JsReplyProxyBoundaryInterface.class, invocationHandler); return (JsReplyProxyImpl) boundaryInterface.getOrCreatePeer( () -> new JsReplyProxyImpl(boundaryInterface)); }

Target:
public static JsReplyProxyImpl forInvocationHandler( @NonNull /* JsReplyProxy */ InvocationHandler invocationHandler) { final JsReplyProxyBoundaryInterface boundaryInterface = BoundaryInterfaceReflectionUtil.castToSuppLibClass( JsReplyProxyBoundaryInterface.class, invocationHandler); return (JsReplyProxyImpl) boundaryInterface.getOrCreatePeer( () -> new JsReplyProxyImpl(boundaryInterface)); }
Source:
public int getSerialNumber() { enforceNetworkStackPermission(); return mSerialNumber; }

Target:
public int getSerialNumber() { return mSerialNumber; }
Source:
public void dump(PrintWriter pw) { // dump is thread-safe on SharedLog mLog.dump(null, pw, null); // dump connectivity module connector logs. ConnectivityModuleConnector.getInstance().dump(pw); pw.println(); }

Target:
public void dump(PrintWriter pw) { // dump is thread-safe on SharedLog mLog.dump(null, pw, null); pw.println(); }
Source:
public void testLinkPropertiesWithWakeOnLanForActiveNetwork() throws Exception { mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI); LinkProperties wifiLp = new LinkProperties(); wifiLp.setInterfaceName(WIFI_WOL_IFNAME); wifiLp.setWakeOnLanEnabled(true); // Default network switch should update ifaces. mWiFiNetworkAgent.connect(false); mWiFiNetworkAgent.sendLinkProperties(wifiLp); waitForIdle(); assertEquals(wifiLp, mService.getActiveLinkProperties()); reset(mStatsService); }

Target:
public void testLinkPropertiesWithWakeOnLanForActiveNetwork() throws Exception { mWiFiNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_WIFI); LinkProperties wifiLp = new LinkProperties(); wifiLp.setInterfaceName(WIFI_WOL_IFNAME); wifiLp.setWakeOnLanEnabled(false); // Default network switch should update ifaces. mWiFiNetworkAgent.connect(false); mWiFiNetworkAgent.sendLinkProperties(wifiLp); waitForIdle(); // ConnectivityService should have changed the wakeOnLanEnabled to true wifiLp.setWakeOnLanEnabled(true); assertEquals(wifiLp, mService.getActiveLinkProperties()); }
Source:
public boolean hasUseBackgroundNetworksPermission(int uid) { // mApps already checked both network and using restricted network permissions. If uid is in // the mApps list that means uid has one of permission at least. return mApps.containsKey(uid); }

Target:
public synchronized boolean hasUseBackgroundNetworksPermission(int uid) { // mApps already checked both network and using restricted network permissions. If uid is in // the mApps list that means uid has one of permission at least. return mApps.containsKey(uid); }
Source:
public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) { if (listener == null) return; String pkgName = mContext != null ? mContext.getOpPackageName() : "<unknown>"; if (DBG) { logd("register OnSubscriptionsChangedListener pkgName=" + pkgName + " listener=" + listener); } // We use the TelephonyRegistry as it runs in the system and thus is always // available. Where as SubscriptionController could crash and not be available TelephonyRegistryManager telephonyRegistryManager = (TelephonyRegistryManager) mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); if (telephonyRegistryManager != null) { telephonyRegistryManager.addOnSubscriptionsChangedListener(listener, listener.mExecutor); } }

Target:
public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) { if (listener == null) return; addOnSubscriptionsChangedListener(listener, listener.mExecutor); }
Source:
void clearNotification(@NotificationId final int id) { mNotificationManager.cancel(null /* tag */, id); }

Target:
private void clearNotification(@NotificationId final int id) { mNotificationManager.cancel(null /* tag */, id); }
Source:
public void onUserRestrictionsChanged() { // getUserRestrictions gets restriction for this process' user, which is the primary // user. This is fine because DISALLOW_CONFIG_TETHERING can only be set on the primary // user. See UserManager.DISALLOW_CONFIG_TETHERING. final Bundle restrictions = mUserManager.getUserRestrictions(); final boolean newlyDisallowed = restrictions.getBoolean(UserManager.DISALLOW_CONFIG_TETHERING); final boolean prevDisallowed = mDisallowTethering; mDisallowTethering = newlyDisallowed; final boolean tetheringDisallowedChanged = (newlyDisallowed != prevDisallowed); if (!tetheringDisallowedChanged) { return; } if (!newlyDisallowed) { // Clear the restricted notification when user is allowed to have tethering // function. mNotificationUpdater.tetheringRestrictionLifted(); return; } // Restricted notification is shown when tethering function is disallowed on // user's device. mNotificationUpdater.notifyTetheringDisabledByRestriction(); // Untether from all downstreams since tethering is disallowed. if (mWrapper.getTetheredIfaces().length != 0) { mWrapper.untetherAll(); } // TODO(b/148139325): send tetheringSupported on restriction change }

Target:
public void onUserRestrictionsChanged() { // getUserRestrictions gets restriction for this process' user, which is the primary // user. This is fine because DISALLOW_CONFIG_TETHERING can only be set on the primary // user. See UserManager.DISALLOW_CONFIG_TETHERING. final Bundle restrictions = mUserManager.getUserRestrictions(); final boolean newlyDisallowed = restrictions.getBoolean(UserManager.DISALLOW_CONFIG_TETHERING); final boolean prevDisallowed = mDisallowTethering; mDisallowTethering = newlyDisallowed; final boolean tetheringDisallowedChanged = (newlyDisallowed != prevDisallowed); if (!tetheringDisallowedChanged) { return; } if (!newlyDisallowed) { // Clear the restricted notification when user is allowed to have tethering // function. mNotificationUpdater.tetheringRestrictionLifted(); return; } // Restricted notification is shown when tethering function is disallowed on // user's device. mNotificationUpdater.notifyTetheringDisabledByRestriction(); // Untether from all downstreams since tethering is disallowed. mWrapper.untetherAll(); // TODO(b/148139325): send tetheringSupported on restriction change }
Source:
private void updateNotification() { final boolean tetheringInactive = mDownstreamTypesMask <= DOWNSTREAM_NONE; synchronized (mUpdateLock) { if (mTetheringRestricted) { setupRestrictedNotification(); } else if (tetheringInactive) { clearNotification(); } else { if (setupNotification()) { return; } // Tethering is active but no need shows notification. clearNotification(); } } }

Target:
private void updateNotification() { synchronized (mUpdateLock) { final boolean tetheringInactive = mDownstreamTypesMask <= DOWNSTREAM_NONE; if (tetheringInactive) { clearNotification(); } else { if (setupNotification()) { return; } // Tethering is active but no need shows notification. clearNotification(); } } }
Source:
public void setPriority(int priority) { int new_nice = NICE_VALUES[priority - 1]; Process.setThreadPriority(new_nice); }

Target:
public void setPriority(int priority) { //priority should range from 1 to 10 if (priority < 1) { priority = 1; } else if (priority > 10) { priority = 10; } Process.setThreadPriority(NICE_VALUES[priority - 1]); }
Source:
private void dismissKeyguard() { final ResolvableFuture<Void> future = ResolvableFuture.create(); KeyguardManager keyguardManager = getSystemService(KeyguardManager.class); keyguardManager.requestDismissKeyguard(this, new KeyguardManager.KeyguardDismissCallback() { @Override public void onDismissSucceeded() { future.set(null); } }); try { future.get(500, TimeUnit.MILLISECONDS); } catch (ExecutionException | InterruptedException | TimeoutException e) { // If this fails, then either it's unimportant for the test, or the test will // fail later Log.w("WebViewTestActivity", "Failed to dismiss keyguard"); } }

Target:
private void dismissKeyguard() { final ResolvableFuture<Void> future = ResolvableFuture.create(); KeyguardManager keyguardManager = getSystemService(KeyguardManager.class); keyguardManager.requestDismissKeyguard(this, new KeyguardManager.KeyguardDismissCallback() { @Override public void onDismissSucceeded() { future.set(null); } }); try { future.get(500, TimeUnit.MILLISECONDS); } catch (ExecutionException | InterruptedException | TimeoutException e) { // If this fails, then either it's unimportant for the test, or the test will // fail later Log.w("WebViewTestActivity", "Failed to dismiss keyguard", e); } }
Source:
private Set<Integer> getAvailableCameraLensFacing() { // Start with all camera directions Set<Integer> available = new LinkedHashSet<>(Arrays.asList(LensFacingConverter.values())); // If we're bound to a lifecycle, remove unavailable cameras if (mLifecycleOwner != null) { if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) { available.remove(CameraSelector.LENS_FACING_BACK); } if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT)) { available.remove(CameraSelector.LENS_FACING_FRONT); } } return available; }

Target:
private Set<Integer> getAvailableCameraLensFacing() { // Start with all camera directions Set<Integer> available = new LinkedHashSet<>(Arrays.asList(LensFacingConverter.values())); if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) { available.remove(CameraSelector.LENS_FACING_BACK); } if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT)) { available.remove(CameraSelector.LENS_FACING_FRONT); } return available; }
Source:
public static boolean isFeatureEnabled(@NonNull Context context, @NonNull String namespace, @NonNull String name) { final int propertyVersion = getDeviceConfigPropertyInt(namespace, name, 0 /* default value */); return isFeatureVersionEnabled(context, propertyVersion); }

Target:
public static boolean isFeatureEnabled(@NonNull Context context, @NonNull String namespace, @NonNull String name) { final int propertyVersion = getDeviceConfigPropertyInt(namespace, name, 0 /* default value */); return isFeatureEnabled(context, namespace, name, false); }
Source:
boolean isAePrecaptureRequired(TakePictureState state) { if (isCamera2LegacyDevice()) { // AE Precapture is not supported on LEGACY devices. Capturing a high-resolution // JPEG image will automatically trigger a precapture sequence before the // high-resolution capture. return false; } switch (getFlashMode()) { case FLASH_MODE_ON: return true; case FLASH_MODE_AUTO: return state.mPreCaptureState.getAeState() == AeState.FLASH_REQUIRED; case FLASH_MODE_OFF: return false; } throw new AssertionError(getFlashMode()); }

Target:
boolean isAePrecaptureRequired(TakePictureState state) { switch (getFlashMode()) { case FLASH_MODE_ON: return true; case FLASH_MODE_AUTO: return state.mPreCaptureState.getAeState() == AeState.FLASH_REQUIRED; case FLASH_MODE_OFF: return false; } throw new AssertionError(getFlashMode()); }
Source:
public static boolean isTestModeEnabled(Context context, Network network) { ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkCapabilities networkCapabilities = connectManager.getNetworkCapabilities(network); return networkCapabilities.hasCapability(NETWORK_CAPABILITY_TRANSPORT_TEST); }

Target:
public static boolean isTestModeEnabled(Context context, Network network) { ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkCapabilities networkCapabilities = connectManager.getNetworkCapabilities(network); if (networkCapabilities == null) { // Invalid network. Caller should be responsible for handling this error return false; } return networkCapabilities.hasCapability(NETWORK_CAPABILITY_TRANSPORT_TEST); }
Source:
public static boolean isTestModeEnabled(Context context, Network network) { ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkCapabilities networkCapabilities = connectManager.getNetworkCapabilities(network); if (networkCapabilities == null) { // Invalid network. Caller should be responsible for handling this error return false; } return networkCapabilities.hasCapability(NETWORK_CAPABILITY_TRANSPORT_TEST); }

Target:
public static boolean isTestModeEnabled(Context context, Network network) { ConnectivityManager connectManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkCapabilities networkCapabilities = connectManager.getNetworkCapabilities(network); return networkCapabilities != null && networkCapabilities.hasCapability(NETWORK_CAPABILITY_TRANSPORT_TEST); }
Source:
public void setStringValueFromFlag() throws Exception { final String certificateFileNameKey = "CertificateFileName"; // Backing up current CertificateFileName ConfigKey originalAuthenticationMethod = config.getEngineConfigLogic().fetchConfigKey(certificateFileNameKey, "general"); final String certificateFileNameNewValue = "/certs/"; final String version = "general"; setKeyAndValidate(certificateFileNameKey, certificateFileNameNewValue, version); // Restoring original value and making sure it was restored successfully restoreOriginalValue(certificateFileNameKey, originalAuthenticationMethod); }

Target:
public void setStringValueFromFlag() throws Exception { final String certificateFileNameKey = "CertificateFileName"; // Backing up current CertificateFileName ConfigKey originalAuthenticationMethod = config.getEngineConfigLogic().fetchConfigKey(certificateFileNameKey, "general"); final String certificateFileNameNewValue = "/certs/"; setKeyAndValidate(certificateFileNameKey, certificateFileNameNewValue, "general"); // Restoring original value and making sure it was restored successfully restoreOriginalValue(certificateFileNameKey, originalAuthenticationMethod); }
Source:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); // TODO: populate step name by bundle if (step.getDescription() == null) { step.setDescription(step.getStepName()); } step.setCorrelationId(correlationId); steps.add(step); return step; }

Target:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); step.setCorrelationId(correlationId); steps.add(step); return step; }
Source:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); step.setJobRepository(jobRepository); // TODO: populate step name by bundle if (step.getDescription() == null) { step.setDescription(step.getStepName()); } step.setCorrelationId(correlationId); steps.add(step); jobRepository.saveStep(step); jobRepository.updateJobLastUpdateTime(id, lastUpdateTime); return step; }

Target:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); // TODO: populate step name by bundle if (step.getDescription() == null) { step.setDescription(step.getStepName()); } step.setCorrelationId(correlationId); steps.add(step); return step; }
Source:
protected void EndWithFailure() { // we are setting 'Vm' since VmId is overriden and 'Vm' is null // (since 'Vm' is dependant on 'mVmId', which is not set here). setVm(DbFacade.getInstance().getVmDAO().getById(getVmId())); // next line is for retrieving the VmPool (and Vm, implicitly) from // the DB so we won't get a log-deadlock because of the transaction. vm_pools vmPool = getVmPool(); setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, getParameters().getImagesParameters().get(0), getCompensationContext()).getSucceeded()); if (!getSucceeded()) { log.warn("AttachUserToVmFromPoolAndRunCommand::EndWitFailure: EndAction of RunVm Failed"); } detachUserFromVmFromPool(); }

Target:
protected void EndWithFailure() { setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, getParameters().getImagesParameters().get(0), getCompensationContext()).getSucceeded()); if (!getSucceeded()) { log.warn("AttachUserToVmFromPoolAndRunCommand::EndWitFailure: EndAction of RunVm Failed"); } detachUserFromVmFromPool(); }
Source:
protected void removeVmRelatedEntitiesFromDb() { RemoveVmUsers(); RemoveVmNetwork(); new SnapshotsManager().removeSnapshots(getVmId()); // It is the responsibility of this command to erase the images , as it is also creates them removeVmImages(); RemoveVmStatic(); }

Target:
protected void removeVmRelatedEntitiesFromDb() { removeVmImages(); super.removeVmRelatedEntitiesFromDb(); }
Source:
public static ServicePolicyInterface getServicePolicyForVds(VDS vds) { ServicePolicyInterface retVal = null; Guid vdsGroupId = vds.getvds_group_id(); VDSGroup vdsGroup = vdsGroupDao.get(vdsGroupId); if (vdsGroup != null) { // In here we will test if the cluster is a gluster cluster, or a virt one, and create the policy accordingly retVal = virtServicePolicy; } return retVal; }

Target:
public static ServicePolicyInterface getServicePolicyForVds(VDS vds) { Guid vdsGroupId = vds.getvds_group_id(); VDSGroup vdsGroup = vdsGroupDao.get(vdsGroupId); // In here we will test if the cluster is a gluster cluster, or a virt one, and return the policy accordingly // In the meantime we return the virt one return virtServicePolicy; }
Source:
private VmInfoBuilderBase createBuilder() { if (VmDeviceCommonUtils.isOldClusterVersion(vm.getvds_group_compatibility_version())) // backward compatibility for 3.0 return new VmOldInfoBuilder(vm, createInfo); else return new VmInfoBuilder(vm, createInfo); }

Target:
private VmInfoBuilderBase createBuilder() { if (VmDeviceCommonUtils.isOldClusterVersion(vm.getvds_group_compatibility_version())) { // backward compatibility for 3.0 return new VmOldInfoBuilder(vm, createInfo); } else { return new VmInfoBuilder(vm, createInfo); } }
Source:
public boolean canMoveToMaintenance(VDS vds) { // In this case, if all the services can move the VDS to maintenance then we return true boolean retVal = true; for ( MonitoringStrategy monitoringStrategy : strategies ) { retVal = retVal && monitoringStrategy.canMoveToMaintenance(vds); if (retVal) { break; } } return retVal; }

Target:
public boolean canMoveToMaintenance(VDS vds) { // In this case, if all the services can move the VDS to maintenance then we return true for ( MonitoringStrategy monitoringStrategy : strategies ) { if (!monitoringStrategy.canMoveToMaintenance(vds)) { return false; } } return true; }
Source:
public boolean isMonitoringNeeded(VDS vds) { // In this case, if one of the services needs monitoring then we return true boolean retVal = false; for ( MonitoringStrategy monitoringStrategy : strategies ) { retVal = retVal || monitoringStrategy.isMonitoringNeeded(vds); if (retVal) { break; } } return retVal; }

Target:
public boolean isMonitoringNeeded(VDS vds) { // In this case, if one of the services needs monitoring then we return true for ( MonitoringStrategy monitoringStrategy : strategies ) { if (monitoringStrategy.isMonitoringNeeded(vds)) { return true; } } return false; }
Source:
public static ArrayList<Guid> getStorageIdList(String storageIds) { ArrayList<String> storageStringList = splitStringList(storageIds); ArrayList<Guid> storageGuidsList = new ArrayList<Guid>(); if (!(storageStringList == null || storageStringList.isEmpty())) { for (String storageGuidString : storageStringList) { storageGuidsList.add(Guid.createGuidFromString(storageGuidString)); } } // If list is empty return empty guid. if (storageGuidsList.isEmpty()) { storageGuidsList.add(Guid.Empty); } return storageGuidsList; }

Target:
public static ArrayList<Guid> getStorageIdList(String storageIds) { ArrayList<String> storageStringList = splitStringList(storageIds); ArrayList<Guid> storageGuidsList = new ArrayList<Guid>(); if (storageStringList != null) { for (String storageGuidString : storageStringList) { storageGuidsList.add(Guid.createGuidFromString(storageGuidString)); } } // If list is empty return empty guid. if (storageGuidsList.isEmpty()) { storageGuidsList.add(Guid.Empty); } return storageGuidsList; }
Source:
private void RemoveVdsFromCollection() { // ResourceManager.Instance.removeVds(VdsId); VDSReturnValue returnValue = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(getVdsId())); }

Target:
private void RemoveVdsFromCollection() { // ResourceManager.Instance.removeVds(VdsId); Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(getVdsId())); }
Source:
private void RemoveVdsFromCollection() { // ResourceManager.Instance.removeVds(VdsId); VDSReturnValue returnValue = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(getVdsId())); if (!returnValue.getSucceeded()) { errorType = AuditLogType.USER_FAILED_REMOVE_VDS; } }

Target:
private void RemoveVdsFromCollection() { // ResourceManager.Instance.removeVds(VdsId); VDSReturnValue returnValue = Backend.getInstance().getResourceManager() .RunVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(getVdsId())); }
Source:
private void setVmTemplateIdParameter() { Map<Boolean, VmTemplate> templateMap = // Direct LUN can not be on template so we can consider the disk as disk image. getDbFacade().getVmTemplateDAO().getAllForImage(((DiskImage) disk).getImageId()); if (!templateMap.values().isEmpty()) { setVmTemplateId(templateMap.values().iterator().next().getId()); } }

Target:
private void setVmTemplateIdParameter() { Map<Boolean, VmTemplate> templateMap = // Disk image is the only disk type that can be part of the template disks. getDbFacade().getVmTemplateDAO().getAllForImage(((DiskImage) disk).getImageId()); if (!templateMap.isEmpty()) { setVmTemplateId(templateMap.values().iterator().next().getId()); } }
Source:
public boolean validate(ConfigKey key, String value) { // check if value is file path if (StringUtils.isNotBlank(value) && new File(value).exists()) { return true; } // The only valid value is "Interactive" if (StringUtils.isNotBlank(value) && value.equals(INTERACTIVE_MODE)) { return true; } // or if we have the password in --admin-pass-file if (StringUtils.isNotBlank(parser.getAdminPassFile()) && new File(parser.getAdminPassFile()).exists()) { return true; } return false; }

Target:
public boolean validate(ConfigKey key, String value) { // check if value is file path if (StringUtils.isNotBlank(value) && new File(value).exists()) { return true; } // The only valid value is "Interactive" if (StringUtils.isNotBlank(value) && value.equalsIgnoreCase(INTERACTIVE_MODE)) { return true; } // or if we have the password in --admin-pass-file if (StringUtils.isNotBlank(parser.getAdminPassFile()) && new File(parser.getAdminPassFile()).exists()) { return true; } return false; }
Source:
private XmlRpcStruct generateOptions() { XmlRpcStruct options = new XmlRpcStruct(); options.add(VdsProperties.connectivityCheck, Boolean.toString(getParameters().isCheckConnectivity())); // VDSM uses the connectivity timeout only if 'connectivityCheck' is set to true if (getParameters().isCheckConnectivity()) { int connectivityTimeout = getParameters().getConectivityTimeout(); if (connectivityTimeout <= 0) { connectivityTimeout = Config.<Integer> GetValue(ConfigValues.NetworkConnectivityCheckTimeoutInSeconds); } options.add(VdsProperties.connectivityTimeout, connectivityTimeout); } return options; }

Target:
private XmlRpcStruct generateOptions() { XmlRpcStruct options = new XmlRpcStruct(); options.add(VdsProperties.connectivityCheck, Boolean.toString(getParameters().isCheckConnectivity())); // VDSM uses the connectivity timeout only if 'connectivityCheck' is set to true if (getParameters().isCheckConnectivity()) { options.add(VdsProperties.connectivityTimeout, getParameters().getConectivityTimeout()); } return options; }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getGlusterVolume() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID); return false; } setVdsGroupId(getGlusterVolume().getClusterId()); return true; }

Target:
protected boolean canDoAction() { if (getGlusterVolume() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_INVALID); return false; } setVdsGroupId(getGlusterVolume().getClusterId()); // super class canDoAction expects cluster id (VdsGroupId). if (!super.canDoAction()) { return false; } return true; }
Source:
protected void RemoveChildren(Guid snapshot) { List<Guid> children = new ArrayList<Guid>(); GetImageChildren(snapshot, children); Collections.reverse(children); for (Guid child : children) { RemoveSnapshot(getDiskImageDao().getSnapshotById(child)); } }

Target:
private void RemoveChildren(Guid snapshot) { List<Guid> children = new ArrayList<Guid>(); GetImageChildren(snapshot, children); Collections.reverse(children); for (Guid child : children) { RemoveSnapshot(getDiskImageDao().getSnapshotById(child)); } }
Source:
protected void endActionOnVmConfiguration() { if (getVm() != null) { if (getVm().getstatus() == VMStatus.ImageLocked) { VmHandler.unlockVm(getVm(), getCompensationContext()); } UpdateVmInSpm(getVm().getstorage_pool_id(), Arrays.asList(getVm())); } else { setCommandShouldBeLogged(false); log.warn("VmCommand::EndVmCommand: Vm is null - not performing EndAction on Vm"); } setSucceeded(true); }

Target:
protected void endActionOnVmConfiguration() { if (getVm() != null) { if (getVm().getstatus() == VMStatus.ImageLocked) { VmHandler.unlockVm(getVm(), getCompensationContext()); } UpdateVmInSpm(getVm().getstorage_pool_id(), Arrays.asList(getVm())); } else { setCommandShouldBeLogged(false); log.warn("VmCommand::EndVmCommand: Vm is null - not performing EndAction on Vm"); } }
Source:
void initFrontend() { // Set up Frontend event handlers Frontend.initEventsHandler(frontendEventsHandler); Frontend.getFrontendFailureEvent().addListener(frontendFailureEventListener); Frontend.getFrontendNotLoggedInEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { user.logout(); frontendFailureEventListener.hide(); } }); Frontend.setFilterQueries(filterFrontendQueries()); }

Target:
void initFrontend() { // Set up Frontend event handlers Frontend.initEventsHandler(frontendEventsHandler); Frontend.getFrontendFailureEvent().addListener(frontendFailureEventListener); Frontend.getFrontendNotLoggedInEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { user.logout(); } }); Frontend.setFilterQueries(filterFrontendQueries()); }
Source:
private List<StorageQuotaValidationParameter> getStorageQuotaListParameters() { List<StorageQuotaValidationParameter> list = new ArrayList<StorageQuotaValidationParameter>(); for (Disk disk : getParameters().getVm().getDiskMap().values()) { if(disk instanceof DiskImage){ DiskImage diskImage = (DiskImage)disk; list.add(new StorageQuotaValidationParameter(diskImage.getQuotaId(), imageToDestinationDomainMap.get(diskImage.getId()), diskImage.getSizeInGigabytes())); } } return list; }

Target:
private List<StorageQuotaValidationParameter> getStorageQuotaListParameters() { List<StorageQuotaValidationParameter> list = new ArrayList<StorageQuotaValidationParameter>(); for (Disk disk : getVm().getDiskMap().values()) { if(disk instanceof DiskImage){ DiskImage diskImage = (DiskImage)disk; list.add(new StorageQuotaValidationParameter(diskImage.getQuotaId(), //TODO: handle import more than once; imageToDestinationDomainMap.get(diskImage.getId()), diskImage.getSizeInGigabytes())); } } return list; }
Source:
public static boolean isValidVmNetwork(VmNetworkInterface iface, Map<String, Network> networksByName) { String networkName = iface.getNetworkName(); return (networksByName.containsKey(networkName) && networksByName.get(networkName).isVmNetwork()); }

Target:
public boolean isValidVmNetwork(VmNetworkInterface iface, Map<String, Network> networksByName) { String networkName = iface.getNetworkName(); return (networksByName.containsKey(networkName) && networksByName.get(networkName).isVmNetwork()); }
Source:
protected boolean canDoAction() { // check if SP exist setStoragePoolId(getParameters().getStoragePoolId()); if (getStoragePool() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); return false; } // Check if quota exist: if (getQuotaId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID); return false; } if (getDbFacade().getQuotaDAO().getById(getQuotaId()) == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NOT_EXIST); return false; } return true; }

Target:
protected boolean canDoAction() { // check if SP exist if (getStoragePool() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); return false; } // Check if quota exist: if (getQuotaId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID); return false; } if (getDbFacade().getQuotaDAO().getById(getQuotaId()) == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_NOT_EXIST); return false; } return true; }
Source:
public PermissionSubject(Guid objectId, VdcObjectType objectType, ActionGroup actionGroup, VdcBllMessages message) { super(); this.objectId = objectId; this.ObjectType = objectType; this.actionGroup = actionGroup; this.message = message; }

Target:
public PermissionSubject(Guid objectId, VdcObjectType objectType, ActionGroup actionGroup, VdcBllMessages message) { this.objectId = objectId; this.ObjectType = objectType; this.actionGroup = actionGroup; this.message = message; }
Source:
private Guid getBrickId(List<GlusterBrickEntity> bricksList, String qualifiedBrickName) { String[] brickParts = qualifiedBrickName.split(":", -1); if (brickParts.length != 2) { throw new RuntimeException("Invalid brick representation [" + qualifiedBrickName + "]"); } for (GlusterBrickEntity brick : bricksList) { // Compare the brickname with the existing volume brick if (brick.getQualifiedName().equals(qualifiedBrickName)) { return brick.getId(); } } return null; }

Target:
private Guid getBrickId(List<GlusterBrickEntity> bricksList, String qualifiedBrickName) { for (GlusterBrickEntity brick : bricksList) { // Compare the brickname with the existing volume brick if (brick.getQualifiedName().equals(qualifiedBrickName)) { return brick.getId(); } } // It is possible that the brick is not found, in cases where user has added more bricks to the volume directly // using gluster CLI (and this change has not been synced yet by the GlusterManager). return null; }
Source:
public void findMissingEnumNames() { // Find missing ConfigurationValues enum names in ConfigValues enum boolean missingKey = false; for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!configValuesEnumNames.contains(configValue.toString())) { log.error("Found missing key: " + configValue.toString()); missingKey = true; break; } } assertFalse(missingKey); }

Target:
public void findMissingEnumNames() { // Find missing ConfigurationValues enum names in ConfigValues enum boolean missingKey = false; for (ConfigurationValues configValue : ConfigurationValues.values()) { if (!configValuesEnumNames.contains(configValue.toString())) { log.error("Found missing key: " + configValue.toString()); missingKey = true; break; } } assertFalse("Found missing key: ", missingKey); }
Source:
protected void endWithFailure() { if (getMoveOrCopyImageOperation() == ImageOperation.Copy) { unLockImage(); if (getParameters().getAddImageDomainMapping()) { // remove image-storage mapping getImageStorageDomainMapDao().remove (new image_storage_domain_map_id(getParameters().getImageId(), getParameters().getStorageDomainId())); } revertTasks(); } else { unLockImage(); } setSucceeded(true); }

Target:
protected void endWithFailure() { unLockImage(); if (getMoveOrCopyImageOperation() == ImageOperation.Copy) { if (getParameters().getAddImageDomainMapping()) { // remove image-storage mapping getImageStorageDomainMapDao().remove (new image_storage_domain_map_id(getParameters().getImageId(), getParameters().getStorageDomainId())); } revertTasks(); } setSucceeded(true); }
Source:
protected File determineActualFile(final HttpServletRequest request, Locale locale) { File file = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); // Check if file is found. If not found go ahead and try and look up the English US locale version. if (null != file && !ServletUtils.canReadFile(file)) { file = ServletUtils.makeFileFromSanePath(replaceLocaleWithUSLocale(request.getPathInfo(), locale), base); } return file; }

Target:
protected File determineActualFile(final HttpServletRequest request, Locale locale) { File file = ServletUtils.makeFileFromSanePath(request.getPathInfo(), base); // Check if file is found. If not found go ahead and try and look up the English US locale version. if (file != null && !ServletUtils.canReadFile(file)) { file = ServletUtils.makeFileFromSanePath(replaceLocaleWithUSLocale(request.getPathInfo(), locale), base); } return file; }