Magento-2 exception printing is disabled by default

i was having an error on my webpage exception printing is disabled by default so i looked for solution and i found an answer to change the local.xml.sample. into local.xml after doing this i have a new error called Item (Magento\Catalog\Model\Category\Interceptor) with the same ID "40" already exists. can somebody tell me what to do here because i can’t found magento/catalog/model/category/intercepter anywhere?

Getting the exception: “Operation is not valid due to the current state of the object” when calling SPUtility.GetPrincipalsInGroup()

When calling the method:

Microsoft.SharePoint.Utilities.SPUtility.GetPrincipalsInGroup(SPWeb web, String input, Int32 maxCount, Boolean& reachedMaxCount) 

I get the following stack trace:

System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider.GetUsersInRole(SPWeb web, String roleName, Int32 maxCount, Boolean& reachedMaxCount)
at Microsoft.SharePoint.Utilities.SPUtility.GetPrincipalsInGroup(SPWeb web, String input, Int32 maxCount, Boolean& reachedMaxCount)

This particular code is running remotely at a customer site, so I am unable to attach a debugger. This works locally and in staging outside of the customer’s site. The local site, staging and the customer’s production environment all use Claims-Based-Authentication and Windows Authentication.

Any ideas as to what could cause this exception?

System.InvalidOperationException(An exception was thrown while attempting to evaluate a LINQ query parameter expression)

I don’t know what’s wrong with my LINQ query, everything looks fine but I got above error on the following code: if (!dbcontext.AndroidUser.Any(user => user.Equals(value.UserName))) Here’s my complete code for RegisterController.cs.

 using System;  using System.Collections.Generic;  using System.Linq;  using System.Text;  using System.Threading.Tasks;  using APITesting.Models;  using APITesting.Utils;  using Microsoft.AspNetCore.Mvc;  using Newtonsoft.Json;   namespace APITesting.Controllers  {  [Route("api/[controller]")]  public class RegisterController : Controller  { NoNameRestaurantContext dbcontext = new NoNameRestaurantContext();  // POST api/<controller> [HttpPost] public string Post([FromBody]AndroidUser value) {     //First we need to check that user is existing in database.     if (!dbcontext.AndroidUser.Any(user => user.Equals                (value.UserName)))     {         AndroidUser user = new AndroidUser();         user.UserName = value.UserName;         user.Hash = Convert.ToBase64String(Common.GetRandomHash(16));         user.Password = Convert.ToBase64String(Common.HashPassword(             Encoding.ASCII.GetBytes(value.Password),             Convert.FromBase64String(user.Hash)));          //Save to Database          try         {             dbcontext.Add(user);             dbcontext.SaveChanges();             return JsonConvert.SerializeObject("Register Successfully");         }         catch (Exception ex)         {             return JsonConvert.SerializeObject(ex.Message);         }     }     else     {         return JsonConvert.SerializeObject("User is existing in Database");     }    }   }  } 

and for Common.cs class that I used to convert my password to hashPassword.

 using System;  using System.Collections.Generic;  using System.Linq;  using System.Security.Cryptography;  using System.Threading.Tasks;   namespace APITesting.Utils  {  public class Common  { /*  *   * FUNCTION TO CREATE RANDOM HASH STRING  *   */ public static byte[] GetRandomHash(int length) {     var random = new RNGCryptoServiceProvider();     byte[] hash = new byte[length];     random.GetNonZeroBytes(hash);     return hash; } /*  *   * FUNCTION TO CREATE PASSWORD WITH HASH  *   */ public static byte[] HashPassword(byte[] password, byte[] hash) {     HashAlgorithm algorithm = new SHA256Managed();     byte[] plainTextWithHashByte = new byte[password.Length + hash.Length];     for (int i = 0; i < password.Length; i++)     {         plainTextWithHashByte[i] = password[i];     }     for (int i = 0; i < hash.Length; i++)     {         plainTextWithHashByte[password.Length + i] = hash[i];     }     return algorithm.ComputeHash(plainTextWithHashByte);   }  } } 

I am following this tutorial: https://www.youtube.com/watch?v=b6T0_j7I9CE

Exception in thread “main” java.lang.IllegalStateException: The driver executable is a directory: C:\Users\Micky\OneDrive\Desktop\chromedriver.exe

Exception in thread “main” java.lang.IllegalStateException: The driver executable is a directory: C:\Users\Micky\OneDrive\Desktop\chromedriver.exe at com.google.common.base.Preconditions.checkState(Preconditions.java:585) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:148) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141) at org.openqa.selenium.chrome.ChromeDriverService.access$ 000(ChromeDriverService.java:35) at org.openqa.selenium.chrome.ChromeDriverService$ Builder.findDefaultExecutable(ChromeDriverService.java:159) at org.openqa.selenium.remote.service.DriverService$ Builder.build(DriverService.java:355) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at Demo.main(Demo.java:13)

Tried adding chromedriver as an environment variable, mapping it to its path. Checked that all required jars are present

import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver;

public class Demo {

public static void main(String[] args)  {     // TODO Auto-generated method stub      // cREATE DRIVER OBJECT FOR CHROME BROWSER     System.setProperty("webdriver.chrome.driver", "C:\Users\Micky\OneDrive\Desktop\chromedriver.exe");      WebDriver driver = new ChromeDriver();      driver.get("http://google.com");    } 

}

Expected – Google webpage should load. Actual – Exception in thread “main” java.lang.IllegalStateException: The driver executable is a directory: C:\Users\Micky\OneDrive\Desktop\chromedriver.exe at com.google.common.base.Preconditions.checkState(Preconditions.java:585) at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:148) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:141) at org.openqa.selenium.chrome.ChromeDriverService.access$ 000(ChromeDriverService.java:35) at org.openqa.selenium.chrome.ChromeDriverService$ Builder.findDefaultExecutable(ChromeDriverService.java:159) at org.openqa.selenium.remote.service.DriverService$ Builder.build(DriverService.java:355) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at Demo.main(Demo.java:13)

Erro Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException

Estou fazendo um projeto da faculdade, em que dê para cadastrar, alterar, excluir e consultar um produto. Na parte de consultar, eu tento buscar pelo ID. Só que acontece este erro e eu não estou conseguindo resolver.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException     at Modelo.Dao.ProdutoDAO.getID(ProdutoDAO.java:75)     at org.me.projetopoo.AlterarProduto.btnPesquisarActionPerformed(AlterarProduto.java:349)     at org.me.projetopoo.AlterarProduto.access$  400(AlterarProduto.java:16)     at org.me.projetopoo.AlterarProduto$  5.actionPerformed(AlterarProduto.java:195)     at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)     at javax.swing.AbstractButton$  Handler.actionPerformed(AbstractButton.java:2348)     at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)     at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)     at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)     at java.awt.Component.processMouseEvent(Component.java:6539)     at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)     at java.awt.Component.processEvent(Component.java:6304)     at java.awt.Container.processEvent(Container.java:2239)     at java.awt.Component.dispatchEventImpl(Component.java:4889)     at java.awt.Container.dispatchEventImpl(Container.java:2297)     at java.awt.Component.dispatchEvent(Component.java:4711)     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535)     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476)     at java.awt.Container.dispatchEventImpl(Container.java:2283)     at java.awt.Window.dispatchEventImpl(Window.java:2746)     at java.awt.Component.dispatchEvent(Component.java:4711)     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)     at java.awt.EventQueue.access$  500(EventQueue.java:97)     at java.awt.EventQueue$  3.run(EventQueue.java:709)     at java.awt.EventQueue$  3.run(EventQueue.java:703)     at java.security.AccessController.doPrivileged(Native Method)     at java.security.ProtectionDomain$  JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)     at java.security.ProtectionDomain$  JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)     at java.awt.EventQueue$  4.run(EventQueue.java:733)     at java.awt.EventQueue$  4.run(EventQueue.java:731)     at java.security.AccessController.doPrivileged(Native Method)     at java.security.ProtectionDomain$  JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)     at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)     at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 

O código de ProdutoDAO está assim:

    public List<Produtos> getID(String id) {         List<Produtos> resultados = null;      Connection con = null;     try {         con = ConexaoBD.getConnection();     } catch (ClassNotFoundException ex) {         Logger.getLogger(UsuarioDAO.class.getName()).log(Level.SEVERE, null, ex);     }      ResultSet resultSet = null;     PreparedStatement stmt = null;      try {          stmt = con.prepareStatement("select * from tabproduto where id_produto = ?");         stmt.setString(1, id);          while (resultSet.next()) {             resultados.add(new Produtos(                     resultSet.getInt("ID_PRODUTO"),                     resultSet.getString("NOME"),                     resultSet.getString("QUANTIDADE"),                     resultSet.getString("DATA_FAB"),                     resultSet.getString("LOTE"),                     resultSet.getString("OBS")));         }      } catch (SQLException ex) {         ex.printStackTrace();     } finally {         ConexaoBD.closeConnection(con, stmt, resultSet);     }      return resultados; } 

O código do botão pesquisar está assim:

private void btnPesquisarActionPerformed(java.awt.event.ActionEvent evt) {
resultado = dao.getID(txtID.getText());

    numero = resultado.size();      if (numero != 0) {         indice = 0;         indiceEntrada = resultado.get(indice);          txtID.setText(String.valueOf(indiceEntrada.getId()));         txtNome.setText(indiceEntrada.getNome());         txtQtd.setText(indiceEntrada.getQtd());         txtFab.setText(indiceEntrada.getFab());         txtLote.setText(indiceEntrada.getLote());         txtObs.setText(indiceEntrada.getObs());     } } 

No debug aparece assim

Debug

A parte de inserir está funcionando corretamente. Não estou conseguindo consultar. 🙁

SharePoint 2013 workflow is suspended. and prompt the error “An unhandled exception occurred during the execution of the workflow instance.”

As title, May I Know any steps to solve the problems. Many thanks.

Exception: Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ArgumentNullException: Value cannot be null. Parameter name: Input at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

How exception handling is related to object oriented programming? [duplicate]

This question already has an answer here:

  • Are exceptions an OOP concept? 8 answers

As a programmer, I have write lines of code everyday using object oriented programming concept where i used each and every concepts of OOPS and during which i also deal with exception handling in java. But some where i read that

Exception handling is feature of OOP. (True/False)

Is it really true that Exception handling is a part of oops ? I’am confused with this thing that how exception handling is related to oops ,can someone explain me how is it.

Situation where an exception can’t be caught in Django view

I’m quite happy with this delete view:

def price_unit_delete(request, pk):     pu = PriceUnit.objects.get(pk=pk)     template = 'includes/modal/modal_form.html'     if request.POST:         pu.delete()         template = 'dashboard_staff/settings/includes/priceunits.html'     ctx = {'action': reverse("dashboard_staff:settings_delete_priceunit", args=(pu.pk, )),            'title': 'do you ?',            'form': PriceUnitDeleteForm(),            'priceunits': PriceUnit.objects.all()}     return TemplateResponse(request, template, ctx) 

Sometimes you can’t delete an item which is referenced somewhere else as a foreign key and it fails. I thought to catch this integrity error (firstly raised by psycopg2 and secondly by django.db itself) using a try block.

Effectively you can do in python console:

# in case of ```o``` being referenced somewhere else, returns False def delete(o):    try:        o.delete()    except:        return False 

I naively thought to include such a block in the view like this:

    if request.POST:         try:             pu.delete()         except:             return JsonResponse({'data': _(                 "You can't delete this object as it is used somewhere else."             )}, status=400) 

And in this case the exception is not caught. I wrote this view as a CBV as well, it fails to catch the exception too.

If I type a assert False in the try, it works fine. Is there a reason why it doesn’t work in case of Integrity exception?

Using RDD.map(func), but func throws exception when casting string to int

Attempting to use the map() function on a Spark 2.4.3 RDD. Ridiculously simple code below, but it fails with exception: ValueError: invalid literal for int() with base 10: ‘number’
This code functions properly in regular python:

s = 'a,1' sp = s.split(',') n = int(sp[1]) print(n) 

But the code below fails unless the int() function is removed.

Data is a CSV file that looks exactly like this: letter,number a,1 b,2 c,3 d,4 e,5

from pyspark import SparkConf, SparkContext  sparkConf = SparkConf().setAppName("RDD play") sc = SparkContext(conf = sparkConf)  rd = sc.textFile('.../two_columns.csv')  rd.take(10)   def upperval(x):     l = x.split(',')     return [l[0], int(l[1])]  rd.map(upperval).take(10) 

Expected result is an RDD where the original row values have been converted to a list — each containing a string and and int.

Runtime: FATAL EXCEPTION: main Process data parcel size 1245464 bytes error [on hold]

It’s a puzzle game App.two Activity All source codes

GameActivity.java

public class GameActivity extends AppCompatActivity {     private static final String TAG = "GameActivity";    public static final int SPAN_COUNT = 3;    public static final int BLANK_BRICK = 8;    public static final int[][] GOAL_STATUS = {{0, 1, 2}, {3, 4, 5}, {6, 7, BLANK_BRICK}};    public static final int MAIL_GAME_STARTED = 100;    public static final int MAIL_STEP_MOVED = 101;    public static final int MAIL_GAME_WON = 102;    public static final int REQUEST_CODE_CHOOSE_PICTURE = 100;     private Bitmap mFullBitmap;    private Bitmap[] mBitmapBricks = new Bitmap[SPAN_COUNT * SPAN_COUNT];    private Timer mTimer;    private long mStartTime;    private int mStepCount;     private TextView mTvTime;    private TextView mTvStep;    private Button mBtnChooseAndStart;    @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {         Window window = getWindow();         window.requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);         window.setEnterTransition(new Explode());         window.setExitTransition(new Explode());     }         setContentView(R.layout.activity_game);      Mailbox.getInstance().atHome(this);      mTvTime = findViewById(R.id.tv_time);     mTvStep = findViewById(R.id.tv_step);     mBtnChooseAndStart = findViewById(R.id.btn_choose_and_start); }     @Override protected void onDestroy() {     super.onDestroy();     Mailbox.getInstance().leave(this); }  @SuppressLint("RestrictedApi") private void startActivityForNewPicture() {     Intent intent = new Intent(this, ChooseActivity.class);     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {         startActivityForResult(                 intent, REQUEST_CODE_CHOOSE_PICTURE,                 ActivityOptionsCompat.makeSceneTransitionAnimation(                         this,                         findViewById(R.id.btn_change_picture),                         getString(R.string.bottom_button_trans_name)).toBundle());     } else {         startActivityForResult(intent, REQUEST_CODE_CHOOSE_PICTURE);     } }  @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {     super.onActivityResult(requestCode, resultCode, data);     if (requestCode == REQUEST_CODE_CHOOSE_PICTURE) {         if (resultCode == RESULT_OK) {             handleChooseResult(data.getData());         }     } }  private void handleChooseResult(Uri uri) {     try {         Bitmap bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));          // Delete the cache file CropImage generated         IOUtils.deleteFile(uri.getPath());          // Scale the bitmap to a proper size, avoiding waste of memory         View container = findViewById(R.id.fl_board_container);         assert container != null;         int paddingHorizontal = container.getPaddingLeft() + container.getPaddingRight();         int paddingVertical = container.getPaddingTop() + container.getPaddingBottom();         mFullBitmap = Bitmap.createScaledBitmap(                 bitmap,                 container.getWidth() - paddingHorizontal,                 container.getHeight() - paddingVertical,                 false);          cutBitmapIntoPieces();         mBitmapBricks[SPAN_COUNT * SPAN_COUNT - 1] = BitmapFactory.decodeResource(getResources(), R.drawable.blank_brick);          startNewGame();     } catch (FileNotFoundException e) {         e.printStackTrace();     } }  private void cutBitmapIntoPieces() {     int dividerWidth = (int) getResources().getDimension(R.dimen.brick_divider_width);     int brickWidth = (mFullBitmap.getWidth() - dividerWidth * (SPAN_COUNT - 1)) / SPAN_COUNT;     int brickHeight = (mFullBitmap.getHeight() - dividerWidth * (SPAN_COUNT - 1)) / SPAN_COUNT;     for (int i = 0; i < SPAN_COUNT; i++) {         for (int j = 0; j < SPAN_COUNT; j++) {             mBitmapBricks[i * SPAN_COUNT + j] = Bitmap.createBitmap(                     mFullBitmap,                     j * (brickWidth + dividerWidth),                     i * (brickHeight + dividerWidth),                     brickWidth, brickHeight);         }     } }  private void startNewGame() {     mBtnChooseAndStart.setVisibility(View.GONE);     getSupportFragmentManager()             .beginTransaction()             .replace(R.id.fl_board_container, GameFragment.newInstance(mBitmapBricks, GOAL_STATUS))             .commit(); }  @OnMailReceived public void onMailReceived(Mail mail) {     if (mail.from == GameFragment.class) {         switch ((int) mail.content) {             case MAIL_GAME_STARTED:                 L.d(TAG, "Game started");                 onGameStarted();                 break;             case MAIL_STEP_MOVED:                 L.d(TAG, "Moved");                 onStepMoved();                 break;             case MAIL_GAME_WON:                 L.d(TAG, "Game won");                 onGameWon();                 break;         }     } }  @SuppressLint("SetTextI18n") private void onGameStarted() {     mStepCount = 0;     mTvStep.setText(String.valueOf(mStepCount));     mTvTime.setText("00:00");      mStartTime = System.currentTimeMillis();     mTimer = new Timer();     mTimer.schedule(new TimerTask() {         @SuppressLint("SimpleDateFormat")         @Override         public void run() {             runOnUiThread(new Runnable() {                 @Override                 public void run() {                     long nowTime = System.currentTimeMillis();                     Date span = new Date(nowTime - mStartTime);                     SimpleDateFormat format = new SimpleDateFormat("mm:ss");                     mTvTime.setText(format.format(span));                 }             });         }     }, 0, 1000); }  private void onStepMoved() {     mStepCount++;     mTvStep.setText(String.valueOf(mStepCount)); }  private void onGameWon() {     mTimer.cancel();     mTimer.purge();     App.getMainHandler().postDelayed(new Runnable() {         @Override         public void run() {             getSupportFragmentManager()                     .beginTransaction()                     .replace(R.id.fl_board_container, WinFragment.newInstance(mFullBitmap))                     .commit();               new AlertDialog.Builder(GameActivity.                     this)                     .setTitle(getString(R.string.result))                     .setMessage(String.format(getString(R.string.win_prompt_format), mTvTime.getText().toString(), mTvStep.getText().toString()))                     .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {                         @Override                         public void onClick(DialogInterface dialog, int which) {                             startNewGame();                         }                     })                     .show();               /*             UIUtils.toast(                     GameActivity.this,                     String.format(getString(R.string.win_prompt_format), mTvTime.getText().toString(), mTvStep.getText().toString()),                     true);              */          }     }, 500); }  public void changePicture(View view) {     startActivityForNewPicture(); }  public void restart(View view) {     if (mFullBitmap == null) {         // Not started, so cannot restart         UIUtils.toast(this, getString(R.string.not_started));         return;     }      new AlertDialog.Builder(this)             .setTitle(getString(R.string.restart))             .setMessage(getString(R.string.confirm_restart_msg))             .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {                 @Override                 public void onClick(DialogInterface dialog, int which) {                     startNewGame();                 }             })             .setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {                 @Override                 public void onClick(DialogInterface dialog, int which) {                     dialog.dismiss();                 }             })             .show(); }  public void lookUpOriginalPicture(View view) {     if (mFullBitmap == null) {         // Not started, so cannot restart         UIUtils.toast(this, getString(R.string.not_started));         return;     }      View alertView = View.inflate(this, R.layout.dialog_loop_up, null);     ImageView imageView = alertView.findViewById(R.id.iv_image);     imageView.setImageBitmap(mFullBitmap);     final AlertDialog dialog = new AlertDialog.Builder(this)             .setView(alertView)             .create();     alertView.setOnTouchListener(new View.OnTouchListener() {         @SuppressLint("ClickableViewAccessibility")         @Override         public boolean onTouch(View v, MotionEvent event) {             dialog.dismiss();             return true;         }     });     dialog.show(); }  public void chooseAndStart(View view) {     startActivityForNewPicture(); } } 

ChooseActivity.java

public class ChooseActivity extends AppCompatActivity { private static final int CHOOSER_SPAN_COUNT = 2;  private final int[] mResIds = new int[]{         R.mipmap.pic_1, R.mipmap.pic_2, R.mipmap.pic_3,         R.mipmap.pic_4, R.mipmap.pic_5, R.mipmap.pic_6,         R.mipmap.pic_7, R.mipmap.pic_8 };  private Uri[] mUris = new Uri[mResIds.length];   private static String[] PERMISSIONS_STORAGE = {         Manifest.permission.READ_EXTERNAL_STORAGE,         Manifest.permission.WRITE_EXTERNAL_STORAGE};  private static int REQUEST_PERMISSION_CODE = 1;  @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_choose);      for (int i = 0; i < mResIds.length; i++) {         mUris[i] = ResUtils.getUriOfResource(this, mResIds[i]);     }      initView(); }  private void initView() {     RecyclerView recyclerView = findViewById(R.id.rv_pics);     assert recyclerView != null;     CommonRecyclerViewAdapter<Uri> adapter = new CommonRecyclerViewAdapter<Uri>(this, mUris, R.layout.choose_pic_item) {         @Override         public void onItemViewAppear(ViewHolder holder, Uri uri, int position) {             holder.setViewImageResource(R.id.iv_image, mResIds[position]);         }     };     adapter.setOnItemClickListener(new CommonRecyclerViewAdapter.OnItemClickListener() {         @Override         public void onItemClick(View view, int position) {             returnUri(mUris[position]);         }     });     recyclerView.setAdapter(adapter);     recyclerView.setLayoutManager(new GridLayoutManager(this, CHOOSER_SPAN_COUNT));     recyclerView.addItemDecoration(new SquareGridSpacingItemDecoration(this, R.dimen.brick_divider_width)); }  public void chooseFromGallery(View view) {      if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {         if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {             ActivityCompat.requestPermissions(this, PERMISSIONS_STORAGE, REQUEST_PERMISSION_CODE);         }     }      Intent intent = new Intent(Intent.ACTION_GET_CONTENT);     intent.setType("image/*");     startActivityForResult(intent, CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE); }  @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {     super.onRequestPermissionsResult(requestCode, permissions, grantResults);     if (requestCode == REQUEST_PERMISSION_CODE) {         for (int i = 0; i < permissions.length; i++) {             Log.i("MainActivity", "perm:" + permissions[i] + ",res:" + grantResults[i]);         }     } }     @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {     super.onActivityResult(requestCode, resultCode, data);     switch (requestCode) {         case CropImage.PICK_IMAGE_CHOOSER_REQUEST_CODE: {             if (resultCode == RESULT_OK) {                 CropImage.activity(Objects.requireNonNull(data.getData()))                         .setActivityTitle(getString(R.string.crop))                         .setAspectRatio(1, 1)                         .setFixAspectRatio(true)                         .start(this);             }             break;         }         case CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE: {             if (resultCode == RESULT_OK) {                 CropImage.ActivityResult result = CropImage.getActivityResult(data);                 returnUri(result.getUri());             }             break;         }     } }  private void returnUri(Uri uri) {     Intent intent = new Intent();     intent.setData(uri);     setResult(RESULT_OK, intent);     finish(); } } 

How can I modify the source code?