Java Code Examples for org.apache.hadoop.io.Text#DEFAULT_MAX_LEN

The following examples show how to use org.apache.hadoop.io.Text#DEFAULT_MAX_LEN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractDelegationTokenIdentifier.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  if (owner.getLength() > Text.DEFAULT_MAX_LEN) {
    throw new IOException("owner is too long to be serialized!");
  }
  if (renewer.getLength() > Text.DEFAULT_MAX_LEN) {
    throw new IOException("renewer is too long to be serialized!");
  }
  if (realUser.getLength() > Text.DEFAULT_MAX_LEN) {
    throw new IOException("realuser is too long to be serialized!");
  }
  writeImpl(out);
}
 
Example 2
Source File: TestDelegationToken.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testOverlongDtidSerialization() throws IOException {
  byte[] bigBuf = new byte[Text.DEFAULT_MAX_LEN + 1];
  for (int i = 0; i < bigBuf.length; i++) {
    bigBuf[i] = 0;
  }
  assertFalse(testDelegationTokenIdentiferSerializationRoundTrip(
      new Text(bigBuf), new Text("renewer"), new Text("realUser")));
  assertFalse(testDelegationTokenIdentiferSerializationRoundTrip(
      new Text("owner"), new Text(bigBuf), new Text("realUser")));
  assertFalse(testDelegationTokenIdentiferSerializationRoundTrip(
      new Text("owner"), new Text("renewer"), new Text(bigBuf)));
}
 
Example 3
Source File: AbstractDelegationTokenIdentifier.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Override
public void write(DataOutput out) throws IOException {
  if (owner.getLength() > Text.DEFAULT_MAX_LEN) {
    throw new IOException("owner is too long to be serialized!");
  }
  if (renewer.getLength() > Text.DEFAULT_MAX_LEN) {
    throw new IOException("renewer is too long to be serialized!");
  }
  if (realUser.getLength() > Text.DEFAULT_MAX_LEN) {
    throw new IOException("realuser is too long to be serialized!");
  }
  writeImpl(out);
}
 
Example 4
Source File: TestDelegationToken.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testOverlongDtidSerialization() throws IOException {
  byte[] bigBuf = new byte[Text.DEFAULT_MAX_LEN + 1];
  for (int i = 0; i < bigBuf.length; i++) {
    bigBuf[i] = 0;
  }
  assertFalse(testDelegationTokenIdentiferSerializationRoundTrip(
      new Text(bigBuf), new Text("renewer"), new Text("realUser")));
  assertFalse(testDelegationTokenIdentiferSerializationRoundTrip(
      new Text("owner"), new Text(bigBuf), new Text("realUser")));
  assertFalse(testDelegationTokenIdentiferSerializationRoundTrip(
      new Text("owner"), new Text("renewer"), new Text(bigBuf)));
}