adoroszlai commented on a change in pull request #1182:
URL: https://github.com/apache/hadoop-ozone/pull/1182#discussion_r452724470



##########
File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/security/OzoneTokenIdentifier.java
##########
@@ -77,6 +79,119 @@ public Text getKind() {
     return KIND_NAME;
   }
 
+  /** Instead of relying on proto serialization, this
+   *  provides  explicit serialization for OzoneTokenIdentifier.
+   * @return byte[]
+   */
+  public byte[] toUniqueSerilizedKey() {
+    ByteBuffer result =
+        ByteBuffer.allocate(4096);
+    result.order(ByteOrder.BIG_ENDIAN);
+    try {
+      result.putLong(getIssueDate());
+      result.putInt(getMasterKeyId());
+      result.putInt(getSequenceNumber());
+
+      result.putLong(getMaxDate());
+
+      result.putInt(getOwner().toString().length());
+      result.put(getOwner().toString().getBytes());

Review comment:
       Findbugs:
   
   ```
   H I Dm: Found reliance on default encoding in 
org.apache.hadoop.ozone.security.OzoneTokenIdentifier.toUniqueSerilizedKey(): 
String.getBytes()  At OzoneTokenIdentifier.java:[line 98]
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to