/** * <code>optional .hbase.pb.NameBytesPair exception = 2;</code> * * <pre> * If the operation failed globally for this region, this exception is set * </pre> */ public Builder mergeException(org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair value) { if (exceptionBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && exception_ != org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.getDefaultInstance()) { exception_ = org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair.newBuilder(exception_).mergeFrom(value).buildPartial(); } else { exception_ = value; } onChanged(); } else { exceptionBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /**
assertTrue(resultList.get(0).getException().getValue().isEmpty()); assertEquals("org.apache.hadoop.hbase.DoNotRetryIOException", resultList.get(1).getException().getName()); assertTrue(Bytes.toString(resultList.get(1).getException().getValue().toByteArray()) .contains( "org.apache.hadoop.hbase.security.visibility.InvalidLabelException: " + "Label 'public' is not set for the user testUser")); assertTrue(resultList.get(2).getException().getValue().isEmpty()); try (Connection connection = ConnectionFactory.createConnection(conf); Table ht = connection.getTable(LABELS_TABLE_NAME)) {
/** * Convert a stringified protocol buffer exception Parameter to a Java Exception * * @param parameter the protocol buffer Parameter to convert * @return the converted Exception * @throws IOException if failed to deserialize the parameter */ @SuppressWarnings("unchecked") public static Throwable toException(final NameBytesPair parameter) throws IOException { if (parameter == null || !parameter.hasValue()) return null; String desc = parameter.getValue().toStringUtf8(); String type = parameter.getName(); try { Class<? extends Throwable> c = (Class<? extends Throwable>)Class.forName(type, true, ClassLoaderHolder.CLASS_LOADER); Constructor<? extends Throwable> cn = null; try { cn = c.getDeclaredConstructor(String.class); return cn.newInstance(desc); } catch (NoSuchMethodException e) { // Could be a raw RemoteException. See HBASE-8987. cn = c.getDeclaredConstructor(String.class, String.class); return cn.newInstance(type, desc); } } catch (Exception e) { throw new IOException(e); } }
if (hasException()) { result = result && getException() .equals(other.getException());
if (hasException()) { result = result && getException() .equals(other.getException());
if (hasException()) { result = result && getException() .equals(other.getException());
/** * Convert a stringified protocol buffer exception Parameter to a Java Exception * * @param parameter the protocol buffer Parameter to convert * @return the converted Exception * @throws IOException if failed to deserialize the parameter */ @SuppressWarnings("unchecked") public static Throwable toException(final NameBytesPair parameter) throws IOException { if (parameter == null || !parameter.hasValue()) return null; String desc = parameter.getValue().toStringUtf8(); String type = parameter.getName(); try { Class<? extends Throwable> c = (Class<? extends Throwable>)Class.forName(type, true, CLASS_LOADER); Constructor<? extends Throwable> cn = null; try { cn = c.getDeclaredConstructor(String.class); return cn.newInstance(desc); } catch (NoSuchMethodException e) { // Could be a raw RemoteException. See HBASE-8987. cn = c.getDeclaredConstructor(String.class, String.class); return cn.newInstance(type, desc); } } catch (Exception e) { throw new IOException(e); } }
@Override protected Message callExecService(Descriptors.MethodDescriptor method, Message request, Message responsePrototype) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Call: "+method.getName()+", "+request.toString()); } final ClientProtos.CoprocessorServiceCall call = ClientProtos.CoprocessorServiceCall.newBuilder() .setRow(ByteStringer.wrap(HConstants.EMPTY_BYTE_ARRAY)) .setServiceName(method.getService().getFullName()) .setMethodName(method.getName()) .setRequest(request.toByteString()).build(); CoprocessorServiceResponse result = ProtobufUtil.execService(connection.getMaster(), call); Message response = null; if (result.getValue().hasValue()) { Message.Builder builder = responsePrototype.newBuilderForType(); ProtobufUtil.mergeFrom(builder, result.getValue().getValue()); response = builder.build(); } else { response = responsePrototype.getDefaultInstanceForType(); } if (LOG.isTraceEnabled()) { LOG.trace("Master Result is value=" + response); } return response; }
@Override protected Message callExecService(Descriptors.MethodDescriptor method, Message request, Message responsePrototype) throws IOException { if (LOG.isTraceEnabled()) { LOG.trace("Call: " + method.getName() + ", " + request.toString()); } final ClientProtos.CoprocessorServiceCall call = ClientProtos.CoprocessorServiceCall.newBuilder() .setRow(ByteStringer.wrap(HConstants.EMPTY_BYTE_ARRAY)) .setServiceName(method.getService().getFullName()).setMethodName(method.getName()) .setRequest(request.toByteString()).build(); CoprocessorServiceResponse result = ProtobufUtil.execRegionServerService(connection.getClient(serverName), call); Message response = null; if (result.getValue().hasValue()) { Message.Builder builder = responsePrototype.newBuilderForType(); ProtobufUtil.mergeFrom(builder, result.getValue().getValue()); response = builder.build(); } else { response = responsePrototype.getDefaultInstanceForType(); } if (LOG.isTraceEnabled()) { LOG.trace("Result is value=" + response); } return response; } }
/** * Convert a stringified protocol buffer exception Parameter to a Java Exception * * @param parameter the protocol buffer Parameter to convert * @return the converted Exception * @throws IOException if failed to deserialize the parameter */ @SuppressWarnings("unchecked") public static Throwable toException(final NameBytesPair parameter) throws IOException { if (parameter == null || !parameter.hasValue()) return null; String desc = parameter.getValue().toStringUtf8(); String type = parameter.getName(); try { Class<? extends Throwable> c = (Class<? extends Throwable>)Class.forName(type, true, ClassLoaderHolder.CLASS_LOADER); Constructor<? extends Throwable> cn = null; try { cn = c.getDeclaredConstructor(String.class); return cn.newInstance(desc); } catch (NoSuchMethodException e) { // Could be a raw RemoteException. See HBASE-8987. cn = c.getDeclaredConstructor(String.class, String.class); return cn.newInstance(type, desc); } } catch (Exception e) { throw new IOException(e); } }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse other = (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse) obj; boolean result = true; result = result && (hasRegion() == other.hasRegion()); if (hasRegion()) { result = result && getRegion() .equals(other.getRegion()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair other = (org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair) obj; boolean result = true; result = result && (hasName() == other.hasName()); if (hasName()) { result = result && getName() .equals(other.getName()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse other = (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse) obj; boolean result = true; result = result && (hasRegion() == other.hasRegion()); if (hasRegion()) { result = result && getRegion() .equals(other.getRegion()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse other = (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResponse) obj; boolean result = true; result = result && (hasRegion() == other.hasRegion()); if (hasRegion()) { result = result && getRegion() .equals(other.getRegion()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair other = (org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair) obj; boolean result = true; result = result && (hasName() == other.hasName()); if (hasName()) { result = result && getName() .equals(other.getName()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionActionResult)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionActionResult other = (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionActionResult) obj; boolean result = true; result = result && getResultOrExceptionList() .equals(other.getResultOrExceptionList()); result = result && (hasException() == other.hasException()); if (hasException()) { result = result && getException() .equals(other.getException()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResult)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResult other = (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.CoprocessorServiceResult) obj; boolean result = true; result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair other = (org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair) obj; boolean result = true; result = result && (hasName() == other.hasName()); if (hasName()) { result = result && getName() .equals(other.getName()); } result = result && (hasValue() == other.hasValue()); if (hasValue()) { result = result && getValue() .equals(other.getValue()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionActionResult)) { return super.equals(obj); } org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionActionResult other = (org.apache.hadoop.hbase.protobuf.generated.ClientProtos.RegionActionResult) obj; boolean result = true; result = result && getResultOrExceptionList() .equals(other.getResultOrExceptionList()); result = result && (hasException() == other.hasException()); if (hasException()) { result = result && getException() .equals(other.getException()); } result = result && getUnknownFields().equals(other.getUnknownFields()); return result; }