anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: alphawallet/alpha-wallet-android
Issue: "Scan QR Code" from Browser Tab home shows "Invalid Scan Result"

This only occurs on the home screen of the browser "My DApps", "Discover DApps", "History"...
This does not occur if a webpage is loaded. In that scenario the QR-code url loads successfully.

Changed files:
app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java

diff --git a/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java b/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java
index 0e8621d0a..8a537e904 100644
--- a/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java
+++ b/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java
@@ -9,6 +9,7 @@ import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Bundle;
+import android.os.Handler;
 import android.preference.PreferenceManager;
 import android.support.annotation.NonNull;
 import android.support.annotation.Nullable;
@@ -161,6 +162,8 @@ public class DappBrowserFragment extends Fragment implements OnSignTransactionLi
     private TextView balance;
     private TextView symbol;
 
+    private final Handler handler;
+
     private String currentWebpageTitle;
     private String currentFragment;
 
@@ -183,6 +186,7 @@ public class DappBrowserFragment extends Fragment implements OnSignTransactionLi
         myDappsFragment = new MyDappsFragment();
         discoverDappsFragment = new DiscoverDappsFragment();
         browserHistoryFragment = new BrowserHistoryFragment();
+        handler = new Handler();
     }
 
     @Override
@@ -1084,7 +1088,7 @@ public class DappBrowserFragment extends Fragment implements OnSignTransactionLi
                             else
                             {
                                 //attempt to go to site
-                                loadUrl(qrCode);
+                                loadUrlRemote(qrCode);
                             }
                         }
                     }
@@ -1107,6 +1111,15 @@ public class DappBrowserFragment extends Fragment implements OnSignTransactionLi
         }
     }
 
+    /**
+     * Loads URL from remote process; this converts a request to load URL which isn't on the app's thread
+     * @param qrCode
+     */
+    private void loadUrlRemote(final String qrCode)
+    {
+        handler.post(() -> loadUrl(qrCode));
+    }
+
     private void showCameraDenied()
     {
         if (getActivity() == null) return;
Repository: alphawallet/alpha-wallet-android
Issue: cDAI tokenscript is incorrectly bound to DAI card

Should only apply to the cDAI card but is also attached to the regular DAI card. 

Changed files:
app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java

diff --git a/app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java b/app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java
index 2dcce0588..f1e3f2232 100644
--- a/app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java
+++ b/app/src/main/java/com/alphawallet/app/service/AssetDefinitionService.java
@@ -272,12 +272,13 @@ public class AssetDefinitionService implements ParseResult, AttributeInterface
         //try cache
         if (cachedDefinition != null)
         {
-            for (String contractName : cachedDefinition.contracts.keySet())
+            //only match holding token
+            ContractInfo holdingContracts = cachedDefinition.contracts.get(cachedDefinition.holdingToken);
+            if (holdingContracts != null && holdingContracts.addresses.containsKey(chainId))
             {
-                if (cachedDefinition.contracts.get(contractName).addresses.containsKey(chainId)
-                    && cachedDefinition.contracts.get(contractName).addresses.get(chainId).contains(address))
+                for (String addr : holdingContracts.addresses.get(chainId))
                 {
-                    return cachedDefinition;
+                    if (addr.equalsIgnoreCase(address.toLowerCase())) return cachedDefinition;
                 }
             }
         }
Repository: alphawallet/alpha-wallet-android
Issue: Can you adopt a pet dog success?

Please open the websitehttp://112.124.104.209:3000/ in alpha-wallet-android DAPP browser with selecting the network of the ropsten test network.
Click "Adopt" Button when to adopt a dog. Can it be success?
I can't get sucess, and I want to know how to debug in alpha-wallet-android DAPP browser ?

Changed files:
app/src/main/java/io/stormbird/wallet/repository/EthereumNetworkRepository.java, app/src/main/java/io/stormbird/wallet/ui/DappBrowserFragment.java

diff --git a/app/src/main/java/io/stormbird/wallet/repository/EthereumNetworkRepository.java b/app/src/main/java/io/stormbird/wallet/repository/EthereumNetworkRepository.java
index 5f50695b3..4c0c31651 100644
--- a/app/src/main/java/io/stormbird/wallet/repository/EthereumNetworkRepository.java
+++ b/app/src/main/java/io/stormbird/wallet/repository/EthereumNetworkRepository.java
@@ -33,7 +33,7 @@ public class EthereumNetworkRepository implements EthereumNetworkRepositoryType
 			new NetworkInfo(ETHEREUM_NETWORK_NAME, ETH_SYMBOL,
                     "https://mainnet.infura.io/v3/da3717f25f824cc1baa32d812386d93f",
                     "https://etherscan.io/tx/",1, true,
-							"https://ethereum.awallet.io/",
+							"https://mainnet.infura.io/v3/da3717f25f824cc1baa32d812386d93f",
 							"https://api.etherscan.io/"),
            new NetworkInfo(CLASSIC_NETWORK_NAME, ETC_SYMBOL,
                     "https://mewapi.epool.io/",
@@ -44,7 +44,7 @@ public class EthereumNetworkRepository implements EthereumNetworkRepositoryType
 			new NetworkInfo(KOVAN_NETWORK_NAME, ETH_SYMBOL,
                     "https://kovan.infura.io/v3/da3717f25f824cc1baa32d812386d93f",
                     "https://kovan.etherscan.io/tx/", 42, false,
-							null,
+							"https://kovan.infura.io/v3/da3717f25f824cc1baa32d812386d93f",
 							"https://api-kovan.etherscan.io/"),
 			new NetworkInfo(ROPSTEN_NETWORK_NAME, ETH_SYMBOL,
 							"http://66.96.208.58:8545/",
diff --git a/app/src/main/java/io/stormbird/wallet/ui/DappBrowserFragment.java b/app/src/main/java/io/stormbird/wallet/ui/DappBrowserFragment.java
index 53002ef27..33c0178ac 100644
--- a/app/src/main/java/io/stormbird/wallet/ui/DappBrowserFragment.java
+++ b/app/src/main/java/io/stormbird/wallet/ui/DappBrowserFragment.java
@@ -185,8 +185,10 @@ public class DappBrowserFragment extends Fragment implements
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
             WebView.setWebContentsDebuggingEnabled(BuildConfig.DEBUG);
         }
-        web3.setChainId(1);
-        web3.setRpcUrl(C.ETH_RPC_URL);
+        web3.setChainId(networkInfo.chainId);
+        String rpcURL = networkInfo.rpcServerUrl;
+        if (networkInfo.backupNodeUrl != null) rpcURL = networkInfo.backupNodeUrl;
+        web3.setRpcUrl(rpcURL);
         web3.setWalletAddress(new Address(wallet.address));
 
         web3.setWebChromeClient(new WebChromeClient() {
Repository: alphawallet/alpha-wallet-android
Issue: Problem bookmarking with mydapps in browser

- Go to browser tab
- Navigate to any page (eg twitter.com)
- Tap "..." in top right corner, then "Add to My DApps"
  - Title: "Twitter. It's what's happening / Twitter"
  - Address: "https://mobile.twitter.com/"
- Change Title and/or URL, tap done
- Tap "Add" (returns to twitter)
- Tap Browser tab, shows original text. Expect: changed title
- Tap twitter icon, goes to original URL. Expect: changed URL

Changed files:
app/src/main/java/com/alphawallet/app/ui/AddEditDappActivity.java, app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java

diff --git a/app/src/main/java/com/alphawallet/app/ui/AddEditDappActivity.java b/app/src/main/java/com/alphawallet/app/ui/AddEditDappActivity.java
index c41e94a4c..f93b6fd85 100644
--- a/app/src/main/java/com/alphawallet/app/ui/AddEditDappActivity.java
+++ b/app/src/main/java/com/alphawallet/app/ui/AddEditDappActivity.java
@@ -78,7 +78,10 @@ public class AddEditDappActivity extends BaseActivity {
                 button.setText(R.string.action_add);
                 name.setText(dapp.getName());
                 url.setText(dapp.getUrl());
-                button.setOnClickListener(v -> add(dapp));
+                button.setOnClickListener(v -> {
+                    dapp.setName(name.getEditableText().toString());
+                    dapp.setUrl(url.getEditableText().toString());
+                    add(dapp); });
                 break;
             }
             case MODE_EDIT: {
@@ -86,7 +89,9 @@ public class AddEditDappActivity extends BaseActivity {
                 button.setText(R.string.action_save);
                 url.setText(dapp.getUrl());
                 name.setText(dapp.getName());
-                button.setOnClickListener(v -> save(dapp));
+                button.setOnClickListener(v -> {
+                    save(dapp);
+                });
                 break;
             }
             default: {
diff --git a/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java b/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java
index 6f4fb2992..d7741dd3c 100644
--- a/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java
+++ b/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java
@@ -345,7 +345,8 @@ public class DappBrowserFragment extends Fragment implements OnSignTransactionLi
         else
         {
             attachFragment(dappHomeFragment, DAPP_HOME);
-            urlTv.getText().clear();
+            if (urlTv != null)
+                urlTv.getText().clear();
             if (web3 != null)
                 web3.stopLoading();
         }
Repository: alphawallet/alpha-wallet-android
Issue: With a new install, ALL is empty until we tap to CURRENCY and back

i.e. the Ethereum card doesn't show up.

~~Doesn't happen if I create a new wallet.~~ [updated to remove confusion]

Xiaomi. 7.1.2 N2G47H.

Changed files:
app/src/awallet/java/com/alphawallet/app/repository/EthereumNetworkRepository.java

diff --git a/app/src/awallet/java/com/alphawallet/app/repository/EthereumNetworkRepository.java b/app/src/awallet/java/com/alphawallet/app/repository/EthereumNetworkRepository.java
index 743479046..3178c1a72 100644
--- a/app/src/awallet/java/com/alphawallet/app/repository/EthereumNetworkRepository.java
+++ b/app/src/awallet/java/com/alphawallet/app/repository/EthereumNetworkRepository.java
@@ -9,6 +9,8 @@ import com.alphawallet.app.entity.NetworkInfo;
 import com.alphawallet.app.service.TickerService;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
 public class EthereumNetworkRepository extends EthereumNetworkBase
@@ -37,7 +39,7 @@ public class EthereumNetworkRepository extends EthereumNetworkBase
 
     public static List<Integer> addDefaultNetworks()
     {
-        return new ArrayList<>(EthereumNetworkRepository.MAINNET_ID);
+        return new ArrayList<>(Collections.singletonList(EthereumNetworkRepository.MAINNET_ID));
     }
 
     public static String getNodeURLByNetworkId(int networkId) {
Repository: branchmetrics/react-native-branch-deep-linking-attribution
Issue: Crash when opening a link on Android (2.0.0-beta.2)

This is due to a recent change in 2.0.0-beta.2. A fix will be released quickly.

```
04-26 14:33:32.218 12830-12830/com.webview_example W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference
04-26 14:33:32.219 12830-12830/com.webview_example W/System.err:     at io.branch.rnbranch.RNBranchModule$1.onInitFinished(RNBranchModule.java:96)
```

Changed files:
android/src/main/java/io/branch/rnbranch/RNBranchModule.java

diff --git a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java
index a95d0bef..3e49511a 100644
--- a/android/src/main/java/io/branch/rnbranch/RNBranchModule.java
+++ b/android/src/main/java/io/branch/rnbranch/RNBranchModule.java
@@ -93,9 +93,9 @@ public class RNBranchModule extends ReactContextBaseJavaModule {
                 BranchUniversalObject branchUniversalObject =  BranchUniversalObject.getReferredBranchUniversalObject();
                 LinkProperties linkProperties = LinkProperties.getReferredLinkProperties();
 
-                Branch.BranchUniversalReferralInitListener listener = initListener.get();
-                if (listener != null) {
-                    listener.onInitFinished(branchUniversalObject, linkProperties, error);
+                if (initListener != null) {
+                    Branch.BranchUniversalReferralInitListener listener = initListener.get();
+                    if (listener != null) listener.onInitFinished(branchUniversalObject, linkProperties, error);
                 }
                 generateLocalBroadcast(referringParams, uri, branchUniversalObject, linkProperties, error);
             }