Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -659,15 +659,19 @@ public static FeatureEntitlement GetFeatureEntitlement(String featureName) throw
* @throws UnsupportedEncodingException
*/
public static String GetLicenseMetadata(String key) throws LexActivatorException, UnsupportedEncodingException {
int status;

ByteBuffer buffer = ByteBuffer.allocate(256);
status = LexActivatorNative.GetLicenseMetadata(key, buffer, 256);
int bufferSize = 256;
while (bufferSize <= 4096) {
ByteBuffer buffer = ByteBuffer.allocate(bufferSize);
int status = LexActivatorNative.GetLicenseMetadata(key, buffer, bufferSize);
if (LA_OK == status) {
return new String(buffer.array(), "UTF-8").trim();
}

throw new LexActivatorException(status);
if (status != LexActivatorException.LA_E_BUFFER_SIZE) {
throw new LexActivatorException(status);
}
bufferSize *= 2;
}
throw new LexActivatorException(LexActivatorException.LA_E_BUFFER_SIZE);
}

/**
Expand Down
Loading