Common exceptions encountered by Hbase Delete: Exception in thread "main" java.lang.UnsupportedOperationException

Source: Internet
Author: User

An error occurred while HBase was performing a bulk delete:
Exception in thread "main" Java.lang.UnsupportedOperationExceptionat Java.util.AbstractList.remove ( Abstractlist.java:161) at Org.apache.hadoop.hbase.client.HTable.delete (Htable.java:852)

This exception is very common, the remove operation is not supported, why do not support the situation? When checking the code, we found that the parameter list was created by Arrays.aslist ().

Obviously, the problem is this place, arrays.aslist () return is actually an implementation arraylist inside the Arrays class:

   /**     * @serialinclude*/    Private Static classArraylist<e>extendsAbstractlist<e>Implementsrandomaccess, java.io.Serializable {Private Static Final LongSerialversionuid = -2764017481108945198l; Private Finale[] A; ArrayList (e[] array) {if(array==NULL)                Throw NewNullPointerException (); A=Array; }         Public intsize () {returna.length; }         Publicobject[] ToArray () {returnA.clone (); }         Public<T>t[] ToArray (t[] a) {intSize =size (); if(A.length <size)returnArrays.copyof ( This. A, size, (Class<?extendsT[]>) A.getclass ()); System.arraycopy ( This. A, 0, a, 0, size); if(A.length >size) A[size]=NULL; returnA; }         PublicE Get (intindex) {            returnA[index]; }         PublicE Set (intindex, E Element) {E OldValue=A[index]; A[index]=element; returnOldValue; }         Public intindexOf (Object o) {if(o==NULL) {                 for(inti=0; i<a.length; i++)                    if(a[i]==NULL)                        returni; } Else {                 for(inti=0; i<a.length; i++)                    if(O.equals (A[i]))returni; }            return-1; }         Public Booleancontains (Object o) {returnIndexOf (o)! =-1; }    }

Arrays.arraylist inheritance to abstractlist,abstractlist itself does not support delete operations, and arrays.arraylist does not reproduce the Remove method, so if you pass Arrays.aslist () Creates a ArrayList, and if the Remove method is called, a unsupportedoperationexception exception occurs.

Common exceptions encountered by Hbase Delete: Exception in thread "main" java.lang.UnsupportedOperationException

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.