anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: paritytrading/philadelphia
Issue: philadelphia-client: Fix 'wait' command

The `wait` command is broken: it does not look at all received messages since being issued but just the last received message after each wait interval. This means that if `wait A` has been invoked and two messages with MsgType(35) values A and B, respectively, are received within one wait interval, the command only sees the MsgType(35) value B of the second message and continues waiting.

Fix the `wait` command so that it looks at all received messages since being issued.

Changed files:
applications/client/src/main/java/com/paritytrading/philadelphia/client/WaitCommand.java

diff --git a/applications/client/src/main/java/com/paritytrading/philadelphia/client/WaitCommand.java b/applications/client/src/main/java/com/paritytrading/philadelphia/client/WaitCommand.java
index 5a9588b..9d0d161 100644
--- a/applications/client/src/main/java/com/paritytrading/philadelphia/client/WaitCommand.java
+++ b/applications/client/src/main/java/com/paritytrading/philadelphia/client/WaitCommand.java
@@ -15,6 +15,8 @@
  */
 package com.paritytrading.philadelphia.client;
 
+import static java.util.stream.Collectors.*;
+
 import java.util.List;
 import java.util.Scanner;
 
@@ -32,11 +34,13 @@ class WaitCommand implements Command {
         if (arguments.hasNext())
             throw new IllegalArgumentException();
 
+        int fromIndex = client.getMessages().collect().size();
+
         while (true) {
             try {
                 Thread.sleep(WAIT_TIME_MILLIS);
 
-                if (msgType.equals(getLastMsgType(client.getMessages())))
+                if (getMsgTypes(client.getMessages(), fromIndex).contains(msgType))
                     break;
 
             } catch (InterruptedException e) {
@@ -60,13 +64,12 @@ class WaitCommand implements Command {
         return "wait <msg-type>";
     }
 
-    private static String getLastMsgType(Messages messages) {
-        List<Message> collection = messages.collect();
-
-        if (collection.isEmpty())
-            return null;
-
-        return collection.get(collection.size() - 1).getMsgType();
+    private static List<String> getMsgTypes(Messages messages, int fromIndex) {
+        return messages.collect()
+            .stream()
+            .skip(fromIndex)
+            .map(Message::getMsgType)
+            .collect(toList());
     }
 
 }
Repository: paritytrading/philadelphia
Issue: philadelphia-client: Fix command completion

Currently, command completion in Philadelphia Terminal Client is broken. Command completion should only take place on the first token. For example:
```
# Input:
> sen<TAB>

# Output:
> send
```
However, currently it takes place on subsequent tokens as well. This doesn't make sense, because the command is always the first token. For example:
```
# Input:
> send sen<TAB>

# Output:
> send send
```
It looks like this bug got introduced when we upgraded from JLine 2 to JLine 3 (369f7754d1c6a71b30f963232cb1777ce65475da).

Changed files:
applications/client/src/main/java/com/paritytrading/philadelphia/client/TerminalClient.java

diff --git a/applications/client/src/main/java/com/paritytrading/philadelphia/client/TerminalClient.java b/applications/client/src/main/java/com/paritytrading/philadelphia/client/TerminalClient.java
index 784cfb9..93dea2a 100644
--- a/applications/client/src/main/java/com/paritytrading/philadelphia/client/TerminalClient.java
+++ b/applications/client/src/main/java/com/paritytrading/philadelphia/client/TerminalClient.java
@@ -39,6 +39,8 @@ import org.jline.reader.EndOfFileException;
 import org.jline.reader.LineReader;
 import org.jline.reader.LineReaderBuilder;
 import org.jline.reader.UserInterruptException;
+import org.jline.reader.impl.completer.ArgumentCompleter;
+import org.jline.reader.impl.completer.NullCompleter;
 import org.jline.reader.impl.completer.StringsCompleter;
 import org.jvirtanen.config.Configs;
 
@@ -88,7 +90,9 @@ class TerminalClient implements Closeable {
 
     void run(List<String> lines) throws IOException {
         LineReader reader = LineReaderBuilder.builder()
-            .completer(new StringsCompleter(COMMAND_NAMES))
+            .completer(new ArgumentCompleter(
+                        new StringsCompleter(COMMAND_NAMES),
+                        new NullCompleter()))
             .build();
 
         if (lines.isEmpty())
Repository: uportal-project/uportal
Issue: Multiple text columns not supported by older Oracle versions.

Older Oracle versions, more accurately the Hibernate dialects, do not support multiple text (LONG) columns in a single table. Only PortletPerferenceImpl.java currently defines such a thing.

Changed files:
uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java

diff --git a/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java b/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java
index 504a8a5b5..658ea460d 100644
--- a/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java
+++ b/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java
@@ -77,8 +77,8 @@ public class PortletPreferenceImpl implements IPortletPreference, Cloneable {
     @Column(name = "ENTITY_VERSION")
     private final long entityVersion;
 
-    @Column(name = "PREF_NAME", length = 100000)
-    @Type(type = "org.hibernate.type.TextType")
+    @Column(name = "PREF_NAME", length = 100000, columnDefinition = "CLOB")
+    @Type(type = "org.hibernate.type.StringType")
     @Lob
     private String name = null;
 
@@ -89,8 +89,8 @@ public class PortletPreferenceImpl implements IPortletPreference, Cloneable {
     @JoinTable(name = "UP_PORTLET_PREF_VALUES", joinColumns = @JoinColumn(name = "PORTLET_PREF_ID"))
     @IndexColumn(name = "VALUE_ORDER")
     @Lob
-    @Column(name = "PREF_VALUE", length = 100000)
-    @Type(type = "org.hibernate.type.TextType")
+    @Column(name = "PREF_VALUE", length = 100000, columnDefinition = "CLOB")
+    @Type(type = "org.hibernate.type.StringType")
     @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
     @Fetch(FetchMode.JOIN)
     private List<String> values = new ArrayList<String>(0);
Repository: uportal-project/uportal
Issue: Db create fails on databases that do not support CLOB types

Error caused by Oracle supporting change that introduced setting a column to CLOB type.


Changed files:
uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java

diff --git a/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java b/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java
index e78b82038..81bb84b1d 100644
--- a/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java
+++ b/uPortal-content/uPortal-content-portlet/src/main/java/org/apereo/portal/portlet/dao/jpa/PortletPreferenceImpl.java
@@ -74,7 +74,7 @@ public class PortletPreferenceImpl implements IPortletPreference, Cloneable {
     @Column(name = "ENTITY_VERSION")
     private final long entityVersion;
 
-    @Column(name = "PREF_NAME", length = 100000, columnDefinition = "CLOB")
+    @Column(name = "PREF_NAME", length = 100000)
     @Type(type = "org.hibernate.type.StringType")
     @Lob
     private String name = null;
@@ -86,7 +86,7 @@ public class PortletPreferenceImpl implements IPortletPreference, Cloneable {
     @JoinTable(name = "UP_PORTLET_PREF_VALUES", joinColumns = @JoinColumn(name = "PORTLET_PREF_ID"))
     @IndexColumn(name = "VALUE_ORDER")
     @Lob
-    @Column(name = "PREF_VALUE", length = 100000, columnDefinition = "CLOB")
+    @Column(name = "PREF_VALUE", length = 100000)
     @Type(type = "org.hibernate.type.StringType")
     @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
     @Fetch(FetchMode.JOIN)
Repository: wso2/product-microgateway
Issue: Choreo Connect does not start in Windows 10 with Docker WSL

### Description:
The enforcer fails systematically in Exited status, and reporting the following error :
docker logs choreo-connect_enforcer_1
java.lang.IllegalArgumentException: Illegal base64 character a
        at java.base/java.util.Base64$Decoder.decode0(Unknown Source)
        at java.base/java.util.Base64$Decoder.decode(Unknown Source)
        at java.base/java.util.Base64$Decoder.decode(Unknown Source)
        at org.wso2.choreo.connect.enforcer.util.JWTUtils.getPrivateKey(JWTUtils.java:166)
        at org.wso2.choreo.connect.enforcer.util.FilterUtils.createClientKeyStore(FilterUtils.java:155)
        at org.wso2.choreo.connect.enforcer.config.ConfigHolder.loadOpaClientKeyStore(ConfigHolder.java:355)
        at org.wso2.choreo.connect.enforcer.config.ConfigHolder.<init>(ConfigHolder.java:110)
        at org.wso2.choreo.connect.enforcer.config.ConfigHolder.getInstance(ConfigHolder.java:118)
        at org.wso2.choreo.connect.enforcer.server.AuthServer.main(AuthServer.java:75)

### Steps to reproduce:

### Affected Product Version:
<!-- Members can use Affected/*** labels -->

### Environment details (with versions):
- OS: Windows/ Docker WSL
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/util/JWTUtils.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/util/JWTUtils.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/util/JWTUtils.java
index 02808ca66..20cd8802e 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/util/JWTUtils.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/util/JWTUtils.java
@@ -154,10 +154,7 @@ public class JWTUtils {
             Path keyPath = Paths.get(filePath);
             String key = Files.readString(keyPath, Charset.defaultCharset());
             String lineSeparator = System.lineSeparator();
-            // Change the lineSeparator to \\r\\n if it runs on WSL
-            if (System.getProperty("os.version").toLowerCase().contains("wsl")) {
-                lineSeparator = "\\r\\n";
-            }
+            
             strKeyPEM = key
                     .replace(Constants.BEGINING_OF_PRIVATE_KEY, "")
                     .replaceAll(lineSeparator, "")
Repository: wso2/product-microgateway
Issue: [websocket] Send only the payload of a single frame at a time from enforcer to router 

### Describe your problem(s)
- We decode the batched of frames at enforcer side to get the exact count of frames
- Thereafter, for each separate frame, we send a `WebSocketFrameResponse` back to the router
- In the `WebSocketFrameResponse` object, although the payload size is updated for a single frame, the payload itself is still the same as the batch of frames. 

### Describe your solution
The payload must also be set to suit the frame that belongs to the iteration of the loop.

### How will you implement it
<!-- If you like to suggest an approach or a design -->

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/websocket/WebSocketResponseObserver.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/websocket/WebSocketResponseObserver.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/websocket/WebSocketResponseObserver.java
index a641efb95..f40e6f44c 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/websocket/WebSocketResponseObserver.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/websocket/WebSocketResponseObserver.java
@@ -17,6 +17,7 @@
  */
 package org.wso2.choreo.connect.enforcer.websocket;
 
+import com.google.protobuf.ByteString;
 import io.grpc.stub.StreamObserver;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -78,7 +79,9 @@ public class WebSocketResponseObserver implements StreamObserver<WebSocketFrameR
                 if (framedata.getOpcode() == Opcode.TEXT || framedata.getOpcode() == Opcode.BINARY
                     || framedata.getOpcode() == Opcode.CONTINUOUS) {
                     WebSocketFrameRequest webSocketFrameRequestClone = webSocketFrameRequest.toBuilder()
-                            .setFrameLength(framedata.getPayloadData().remaining()).build();
+                            .setFrameLength(framedata.getPayloadData().remaining())
+                            .setPayload(ByteString.copyFrom(framedata.getPayloadData()))
+                            .build();
                     sendWebSocketFrameResponse(webSocketFrameRequestClone);
                 } else {
                     logger.debug("Websocket frame type not related to throttling: {}", framedata.getOpcode());
Repository: wso2/product-microgateway
Issue: Rename header operation policy

### Description:
<!-- Describe the issue -->
current implementation of rename_header written as equal to set_header policy.
but rename_header has a different attribute list and it should be renaming the header name, not just updating the header value.

### Steps to reproduce:

### Affected Product Version:
<!-- Members can use Affected/*** labels -->

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/interceptor/MediationPolicyFilter.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/interceptor/MediationPolicyFilter.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/interceptor/MediationPolicyFilter.java
index e08c8e3cd..51c67f2bf 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/interceptor/MediationPolicyFilter.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/interceptor/MediationPolicyFilter.java
@@ -48,11 +48,14 @@ public class MediationPolicyFilter implements Filter {
     private void applyPolicy(RequestContext requestContext, Policy policy) {
         //todo(amali) check policy order
         switch (policy.getTemplateName()) {
-            case "SET_HEADER":
-            case "RENAME_HEADER": {
+            case "SET_HEADER": {
                 addOrModifyHeader(requestContext, policy.getParameters());
                 break;
             }
+            case "RENAME_HEADER": {
+                renameHeader(requestContext, policy.getParameters());
+                break;
+            }
             case "REMOVE_HEADER": {
                 removeHeader(requestContext, policy.getParameters());
                 break;
@@ -82,6 +85,16 @@ public class MediationPolicyFilter implements Filter {
         requestContext.addOrModifyHeaders(headerName, headerValue);
     }
 
+    private void renameHeader(RequestContext requestContext, Map<String, String> policyAttrib) {
+        String currentHeaderName = policyAttrib.get("currentHeaderName");
+        String updatedHeaderValue = policyAttrib.get("updatedHeaderName");
+        if (requestContext.getHeaders().containsKey(currentHeaderName)) {
+            String headerValue = requestContext.getHeaders().get(currentHeaderName);
+            requestContext.getRemoveHeaders().add(currentHeaderName);
+            requestContext.addOrModifyHeaders(updatedHeaderValue, headerValue);
+        }
+    }
+
     private void removeHeader(RequestContext requestContext, Map<String, String> policyAttrib) {
         String headerName = policyAttrib.get("headerName");
         requestContext.getRemoveHeaders().add(headerName);
Repository: wso2/product-microgateway
Issue: UserId based deny policies are not working with InternalKey

### Description:
If the deny policy is using UserID, it won't be enforced properly as the userID is not populated correctly.

### Steps to reproduce:
Deploy an API.
Create a deny policy for the user `admin@carbon.super`.
Use InternalKey to invoke.

### Affected Product Version:
choreo-connect-1.0.0-rc1

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/throttle/ThrottleFilter.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/throttle/ThrottleFilter.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/throttle/ThrottleFilter.java
index a006c434e..5431fe990 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/throttle/ThrottleFilter.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/throttle/ThrottleFilter.java
@@ -132,7 +132,10 @@ public class ThrottleFilter implements Filter {
                 String appTenant = authContext.getSubscriberTenantDomain();
                 String clientIp = reqContext.getClientIp();
                 String apiTenantDomain = FilterUtils.getTenantDomainFromRequestURL(apiContext);
-                String authorizedUser = FilterUtils.buildUsernameWithTenant(authContext.getUsername(), appTenant);
+                // API Tenant Domain is required to be taken in order to support internal Key scenario.
+                // Using apiTenant is valid as the choreo connect does not work in multi-tenant mode.
+                String authorizedUser = FilterUtils.buildUsernameWithTenant(authContext.getUsername(),
+                        apiTenantDomain);
                 boolean isApiLevelTriggered = false;
 
                 if (!StringUtils.isEmpty(api.getTier())) {
@@ -290,7 +293,9 @@ public class ThrottleFilter implements Filter {
         String apiTier = getApiTier(api);
         String tenantDomain = FilterUtils.getTenantDomainFromRequestURL(apiContext);
         String appTenant = authContext.getSubscriberTenantDomain();
-        String authorizedUser = FilterUtils.buildUsernameWithTenant(authContext.getUsername(), appTenant);
+        // API Tenant Domain is required to be taken in order to support internal Key scenario.
+        // Using apiTenant is valid as the choreo connect does not work in multi-tenant mode.
+        String authorizedUser = FilterUtils.buildUsernameWithTenant(authContext.getUsername(), tenantDomain);
         String resourceTier;
         String resourceKey;
Repository: wso2/product-microgateway
Issue: Error reading event hub config

### Description:
Even the event hub config is enabled the config is not getting effected

### Steps to reproduce:
enable event hub config in the config.toml

### Affected Product Version:
<!-- Members can use Affected/*** labels -->

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer/src/main/java/org/wso2/micro/gateway/enforcer/config/dto/EventHubConfigurationDto.java

diff --git a/enforcer/src/main/java/org/wso2/micro/gateway/enforcer/config/dto/EventHubConfigurationDto.java b/enforcer/src/main/java/org/wso2/micro/gateway/enforcer/config/dto/EventHubConfigurationDto.java
index 4d07919ff..7c0b188cd 100644
--- a/enforcer/src/main/java/org/wso2/micro/gateway/enforcer/config/dto/EventHubConfigurationDto.java
+++ b/enforcer/src/main/java/org/wso2/micro/gateway/enforcer/config/dto/EventHubConfigurationDto.java
@@ -24,17 +24,17 @@ import java.util.Properties;
  * Holds the configurations related to connecting with APIM event hub node.
  */
 public class EventHubConfigurationDto {
-    private boolean enabled;
+    private boolean enable;
     private String serviceUrl;
     private int initDelay = 0;
     private Properties jmsConnectionParameters = new Properties();
 
     public boolean isEnabled() {
-        return enabled;
+        return enable;
     }
 
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
+    public void setEnable(boolean enable) {
+        this.enable = enable;
     }
 
     public String getServiceUrl() {
Repository: wso2/product-microgateway
Issue: When Denied Policies and Analytics Both are enabled, enforcer results in Null Pointer Error 

### Description:
$subject.  

### Steps to reproduce:
Enable analytics and start the microgateway.
Enable denied policy.

### Affected Product Version:
choreo-connect-0.9.0-beta

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java

diff --git a/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java b/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java
index 87b3dd2b5..f7c1c5f49 100644
--- a/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java
+++ b/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java
@@ -76,6 +76,14 @@ public class ChoreoFaultAnalyticsProvider implements AnalyticsDataProvider {
             switch (statusCode) {
                 case 401:
                 case 403:
+                    // For Denied policies, the status code remains 403, but it is categorized
+                    // under throttling
+                    if (requestContext.getProperties().containsKey(APIConstants.MessageFormat.ERROR_CODE)) {
+                        if (AnalyticsConstants.BLOCKED_ERROR_CODE == Integer.parseInt(requestContext.getProperties()
+                                        .get(APIConstants.MessageFormat.ERROR_CODE).toString())) {
+                            return FaultCategory.THROTTLED;
+                        }
+                    }
                     return FaultCategory.AUTH;
                 case 429:
                     return FaultCategory.THROTTLED;
Repository: wso2/product-microgateway
Issue: Analytics list down API list in the analytics tenant drop down

### Description:
Create multiple APIS for a tenant and invoke them. Each API will list as separate tenant in the analytics drop down.

### Steps to reproduce:
1. create a tenant domain abc.com
2. Create 2 apis with context /foo and /bar
3. Then invoke the APIs and go and view analytics
4. Under the tenant drop down it will list below 2 tenants, which are actually a 2 APIs of a single tenant
 
```
1. /t/abc.com/foo
2. /t/abc.com/bar
```

### Affected Product Version:
Post 0.9.0-beta

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java

diff --git a/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java b/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java
index fe9ca3f28..87b3dd2b5 100644
--- a/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java
+++ b/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/analytics/ChoreoFaultAnalyticsProvider.java
@@ -96,10 +96,10 @@ public class ChoreoFaultAnalyticsProvider implements AnalyticsDataProvider {
         api.setApiType(requestContext.getMatchedAPI().getAPIConfig().getApiType());
         api.setApiName(requestContext.getMatchedAPI().getAPIConfig().getName());
         api.setApiVersion(requestContext.getMatchedAPI().getAPIConfig().getVersion());
-        api.setApiCreatorTenantDomain(FilterUtils.getTenantDomainFromRequestURL(
-                requestContext.getMatchedAPI().getAPIConfig().getBasePath()) == null
-                ? APIConstants.SUPER_TENANT_DOMAIN_NAME
-                : requestContext.getMatchedAPI().getAPIConfig().getBasePath());
+        String tenantDomain = FilterUtils.getTenantDomainFromRequestURL(
+                requestContext.getMatchedAPI().getAPIConfig().getBasePath());
+        api.setApiCreatorTenantDomain(
+                tenantDomain == null ? APIConstants.SUPER_TENANT_DOMAIN_NAME : tenantDomain);
         api.setOrganizationId(requestContext.getMatchedAPI().getAPIConfig().getOrganizationId());
         return api;
     }
Repository: wso2/product-microgateway
Issue: Websocket APIs cannot be invoked due to NPE.

### Description:

Websocket APIs cannot be invoked due to NPE in enforcer. 

### Steps to reproduce:
start choreo-connect-with-apim
Deploy websocketAPI 
Invoke the API with a valid token obtained from devportal

### Affected Product Version:
choreo-connect-1.0.0-beta2-snapshot

### Environment details (with versions):
- OS:
- Client:
- Env (Docker/K8s):

---
### Optional Fields
#### Related Issues:
<!-- Any related issues from this/other repositories-->

#### Suggested Labels:
<!--Only to be used by non-members-->

#### Suggested Assignees:
<!--Only to be used by non-members-->


Changed files:
enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java

diff --git a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java
index a93a71489..fbe71d153 100644
--- a/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java
+++ b/enforcer-parent/enforcer/src/main/java/org/wso2/choreo/connect/enforcer/security/AuthFilter.java
@@ -234,7 +234,10 @@ public class AuthFilter implements Filter {
         }
 
         ResourceConfig resourceConfig = requestContext.getMatchedResourcePath();
-        if (resourceConfig.getEndpoints().containsKey(keyType)) {
+        // In websockets case, the endpoints object becomes null. Hence it would result
+        // in a NPE, if it is not checked.
+        if (resourceConfig.getEndpoints() != null &&
+                resourceConfig.getEndpoints().containsKey(keyType)) {
             EndpointCluster endpointCluster = resourceConfig.getEndpoints().get(keyType);
 
             // Apply resource level retry headers
Repository: cloudslang/cloud-slang
Issue: Uninformative error message in CLI when missing spaces before 'required' keyword

When there are missing spaces before input's 'required' keyword, for example:
flow:
  inputs:
    - input:
      required: true

 and trying to run the flow in the CLI, you get an uninformative error message:
Command failed java.lang.RuntimeException: java.lang.RuntimeException: Error transforming source: flow_with_required_input.sl to a Slang model. null


Changed files:
cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java

diff --git a/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java b/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java
index 5f92c01c4..1da4637a7 100644
--- a/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java
+++ b/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java
@@ -34,7 +34,7 @@ public abstract class AbstractInputsTransformer {
             Map.Entry<String, ?> entry = ((Map<String, ?>) rawInput).entrySet().iterator().next();
             Object entryValue = entry.getValue();
             if(entryValue == null){
-                throw new RuntimeException("Could not transform Input : " + rawInput + " Since it has a null value");
+                throw new RuntimeException("Could not transform Input : " + rawInput + " Since it has a null value.\\n\\nMake sure a value is specified or that indentation is properly done.");
             }
             if (entryValue instanceof Map) {
                 // - some_inputs:
Repository: cloudslang/cloud-slang
Issue: Double title 'Flow outputs'

The behavior of the "Flow outputs" messages are changed in CLI. The flow outputs were grouped as a single block. Now we have  'Flow outputs' title for each output:

E.g.:
Flow outputs:
- return_result = Reservation{region=us-east-1, reservationId=r-4cfb859b, instances=[RunningInstance{region=us-east...

Flow outputs:
- return_code = 0


Changed files:
cloudslang-cli/src/main/java/io/cloudslang/lang/cli/services/SyncTriggerEventListener.java

diff --git a/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/services/SyncTriggerEventListener.java b/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/services/SyncTriggerEventListener.java
index 9d2e636e9..160497ad7 100644
--- a/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/services/SyncTriggerEventListener.java
+++ b/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/services/SyncTriggerEventListener.java
@@ -107,8 +107,8 @@ public class SyncTriggerEventListener implements ScoreEventListener{
                         && data.containsKey(LanguageEventData.PATH)
                         && data.get(LanguageEventData.PATH).equals(EXEC_START_PATH)) {
                     Map<String, Serializable> outputs = extractNotEmptyOutputs(data);
+                    printWithColor(Ansi.Color.WHITE, "\\nFlow outputs:");
                     for (String key : outputs.keySet()) {
-                        printWithColor(Ansi.Color.WHITE, "\\nFlow outputs:");
                         printWithColor(Ansi.Color.WHITE, "- " + key + " = " + outputs.get(key));
                     }
                 }
Repository: cloudslang/cloud-slang
Issue: preCompile API returns input object which contains input name as default value

When the input has required / overridable / encrypted  field (the value doesn’t matter), and has no default value, the expression field of Input object contains the input name during the precompile API.


Changed files:
cloudslang-compiler/src/test/java/io/cloudslang/lang/compiler/modeller/transformers/InputsTransformerTest.java
cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java

diff --git a/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java b/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java
index 6c1274a1c..142c0ea26 100644
--- a/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java
+++ b/cloudslang-compiler/src/main/java/io/cloudslang/lang/compiler/modeller/transformers/AbstractInputsTransformer.java
@@ -68,8 +68,7 @@ public abstract class AbstractInputsTransformer {
                 (boolean) props.get(OVERRIDABLE_KEY);
         boolean defaultSpecified = props.containsKey(DEFAULT_KEY);
         String inputName = entry.getKey();
-        String expression = defaultSpecified ? props.get(DEFAULT_KEY)
-                                                    .toString() : inputName;
+        String expression = defaultSpecified ? props.get(DEFAULT_KEY).toString() : null;
         String systemPropertyName = (String) props.get(SYSTEM_PROPERTY_KEY);
 
         if (!overridable && !defaultSpecified && StringUtils.isEmpty(systemPropertyName)) {
diff --git a/cloudslang-compiler/src/test/java/io/cloudslang/lang/compiler/modeller/transformers/InputsTransformerTest.java b/cloudslang-compiler/src/test/java/io/cloudslang/lang/compiler/modeller/transformers/InputsTransformerTest.java
index 3e410d053..7ef3af27f 100644
--- a/cloudslang-compiler/src/test/java/io/cloudslang/lang/compiler/modeller/transformers/InputsTransformerTest.java
+++ b/cloudslang-compiler/src/test/java/io/cloudslang/lang/compiler/modeller/transformers/InputsTransformerTest.java
@@ -105,7 +105,7 @@ public class InputsTransformerTest {
         @SuppressWarnings("unchecked") List<Input> inputs = inputTransformer.transform(inputsMap);
         Input input = inputs.get(4);
         Assert.assertEquals("input5", input.getName());
-        Assert.assertEquals("input5", input.getExpression());
+        Assert.assertEquals(null, input.getExpression());
         Assert.assertEquals(true, input.isEncrypted());
         Assert.assertEquals(true, input.isRequired());
     }
Repository: cloudslang/cloud-slang
Issue: schedule slang flow fails on inputs passed as unmodifiable collection

- also the run time exception is fired from Slang language and not from score as ScoreEvent.Error


Changed files:
score-lang-api/src/main/java/org/openscore/lang/api/SlangImpl.java

diff --git a/score-lang-api/src/main/java/org/openscore/lang/api/SlangImpl.java b/score-lang-api/src/main/java/org/openscore/lang/api/SlangImpl.java
index e1757282e..f81201970 100644
--- a/score-lang-api/src/main/java/org/openscore/lang/api/SlangImpl.java
+++ b/score-lang-api/src/main/java/org/openscore/lang/api/SlangImpl.java
@@ -80,7 +80,8 @@ public class SlangImpl implements Slang {
 		Map<String, Serializable> executionContext = new HashMap<>();
 		RunEnvironment runEnv = new RunEnvironment(systemProperties);
 		executionContext.put(ScoreLangConstants.RUN_ENV, runEnv);
-		executionContext.put(ScoreLangConstants.USER_INPUTS_KEY, (Serializable)runInputs);
+	        Map<String, ? extends Serializable> clonedRunInputs = new HashMap<>(runInputs);
+		executionContext.put(ScoreLangConstants.USER_INPUTS_KEY, (Serializable) clonedRunInputs);
 		TriggeringProperties triggeringProperties = TriggeringProperties.create(compilationArtifact.getExecutionPlan()).setDependencies(compilationArtifact.getDependencies())
 			.setContext(executionContext);
 		return score.trigger(triggeringProperties);
Repository: cloudslang/cloud-slang
Issue: Failed to compile flow which uses subflow located in file in the same folder

Let's say we have flow flow_system_properties_subflow.sl in flow_system_properties_subflow.sl which uses simplecp.flows.flow_system_properties_subflow_level1 which located in file simplecp.flows.flow_system_properties_subflow_level1.sl located in the same folder

When executing cli with command

run --f c:/Temp/slang/tests/SimpleCp/flow_system_properties_subflow.sl --cp c:/Temp/slang/tests

We get error

Command failed java.lang.RuntimeException: java.lang.RuntimeException: Reference: 'simplecp.flows.flow_system_properties_subflow_level1' in executable: 'flow_system_properties_subflow', wasn't found in path

When executing command with specifying --cp with flow path

run --f c:/Temp/slang/tests/SimpleCp/flow_system_properties_subflow.sl --cp c:/Temp/slang/tests/SimpleCp

We get error

Command failed java.lang.RuntimeException: java.lang.IllegalArgumentException: Source flow_system_properties_subflow has dependencies but no path was given to the compiler


Changed files:
cloudslang-cli/src/main/java/io/cloudslang/lang/cli/utils/CompilerHelperImpl.java

diff --git a/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/utils/CompilerHelperImpl.java b/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/utils/CompilerHelperImpl.java
index 9cd5a57f7..b3db9c95a 100644
--- a/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/utils/CompilerHelperImpl.java
+++ b/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/utils/CompilerHelperImpl.java
@@ -86,8 +86,6 @@ public class CompilerHelperImpl implements CompilerHelper{
         }
         for (String dependency:dependencies) {
             Collection<File> dependenciesFiles = FileUtils.listFiles(new File(dependency), SLANG_FILE_EXTENSIONS, true);
-            dependenciesFiles = select(dependenciesFiles, having(on(File.class).getPath(), not(containsString(SP_DIR))));
-            dependenciesFiles = select(dependenciesFiles, having(on(File.class).getPath(), not(containsString(INPUT_DIR))));
             depsSources.addAll(convert(dependenciesFiles, new Converter<File, SlangSource>() {
                 @Override
                 public SlangSource convert(File from) {
Repository: hashgraph/hedera-services
Issue: SuiteRunner's PayerID creation when failed should fall back to Default ID

<!--  Thanks for submitting a bug report!  Before submitting:
1. Try searching the existing issues to see if your issue has already been reported
2. If you're reporting a security vulnerability, please email security@hedera.com instead of opening an issue
-->

**Summary of the defect**
When the process of creating a unique payer ID for a SuiteRunner fails, the payer ID is set to an empty string which is invalid and thus creating invalid transactions in the following steps. 

**How to reproduce (if possible)**
Run any suiteRunner Spec which can break initial account creation, like sending a **cryptocreate** txn to a **publictestnet** state with wrong keys.


Changed files:
test-clients/src/main/java/com/hedera/services/bdd/suites/SuiteRunner.java

diff --git a/test-clients/src/main/java/com/hedera/services/bdd/suites/SuiteRunner.java b/test-clients/src/main/java/com/hedera/services/bdd/suites/SuiteRunner.java
index b896ebf365..29c8e0ac9c 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/suites/SuiteRunner.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/suites/SuiteRunner.java
@@ -129,6 +129,7 @@ import java.util.stream.Stream;
 
 import static com.hedera.services.bdd.spec.HapiSpecSetup.NodeSelection.FIXED;
 import static com.hedera.services.bdd.spec.HapiSpecSetup.TlsConfig.OFF;
+import static com.hedera.services.bdd.spec.transactions.TxnUtils.isIdLiteral;
 import static com.hedera.services.bdd.suites.HapiApiSuite.FinalOutcome;
 import static java.util.concurrent.CompletableFuture.runAsync;
 import static java.util.stream.Collectors.groupingBy;
@@ -146,7 +147,7 @@ public class SuiteRunner {
 
 	private static final int EXPECTED_DEV_NETWORK_SIZE = 3;
 	private static final int EXPECTED_CI_NETWORK_SIZE = 4;
-	private static final String DEFAULT_PAYER_ID = "2";
+	private static final String DEFAULT_PAYER_ID = "0.0.2";
 
 	public static int expectedNetworkSize = EXPECTED_DEV_NETWORK_SIZE;
 
@@ -374,6 +375,9 @@ public class SuiteRunner {
 			Thread.sleep(r.nextInt(5000));
 			new CryptoCreateForSuiteRunner(nodes, defaultNode).runSuiteAsync();
 			Thread.sleep(2000);
+			if(!isIdLiteral(payerId)){
+				payerId = DEFAULT_PAYER_ID;
+			}
 		} catch (InterruptedException e) {
 			e.printStackTrace();
 		}
Repository: hashgraph/hedera-services
Issue: QueryFailuresSpec suite's getsExpectedRejection should return FILE_DELETED as pre-check status

**Summary of the defect**
When querying the file contents of a deleted file. Instead it returns pre-check status as OK.

**How to reproduce (if possible)**
Please refer to QueryFailuresSpec.java source code.

**Service logs (if applicable)**
```
...
```
**Environment:**
- OS: [e.g. Ubuntu 18.04]
- Java: [e.g. OpenJDK 11.0.4]
- Hedera Services Version: [e.g. 0.0.5]
- HAPI Version: [e.g. 0.0.5]

**Additional Context**
Add any other context about the problem here. Attach any logs here, if applicable.


Changed files:
test-clients/src/main/java/com/hedera/services/bdd/suites/file/negative/QueryFailuresSpec.java

diff --git a/test-clients/src/main/java/com/hedera/services/bdd/suites/file/negative/QueryFailuresSpec.java b/test-clients/src/main/java/com/hedera/services/bdd/suites/file/negative/QueryFailuresSpec.java
index f36f8ed184..e6b2a37499 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/suites/file/negative/QueryFailuresSpec.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/suites/file/negative/QueryFailuresSpec.java
@@ -34,6 +34,7 @@ import static com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec;
 import static com.hedera.services.bdd.spec.queries.QueryVerbs.getFileContents;
 import static com.hedera.services.bdd.spec.queries.QueryVerbs.getFileInfo;
 import static com.hedera.services.bdd.spec.transactions.TxnVerbs.*;
+import static com.hedera.services.bdd.spec.utilops.UtilVerbs.sleepFor;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.FILE_DELETED;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_FILE_ID;
 import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.MAX_FILE_SIZE_EXCEEDED;
@@ -73,6 +74,7 @@ public class QueryFailuresSpec extends HapiApiSuite {
 						getFileInfo("tbd")
 								.nodePayment(1_234L)
 								.hasAnswerOnlyPrecheck(OK)
+								.hasDeleted(true)
 						        .logged()
 				);
 	}
Repository: hashgraph/hedera-services
Issue: Find out why UmbrellaRedux only send out ~50% of required operations for HCS requests

**Summary of the defect**
While doing perf test, UmbrellaRedux seems to only send out 50% of configured requests rate.

**How to reproduce (if possible)**

Check out the nightly JRS regression HCS perf test config.

**Service logs (if applicable)**
```
...
```
**Environment:**
- OS: [e.g. Ubuntu 18.04]
- Java: [e.g. OpenJDK 11.0.4]
- Hedera Services Version: [e.g. 0.0.5]
- HAPI Version: [e.g. 0.0.5]

**Additional Context**
None


Changed files:
test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/providers/ops/consensus/RandomMessageSubmit.java

diff --git a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/providers/ops/consensus/RandomMessageSubmit.java b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/providers/ops/consensus/RandomMessageSubmit.java
index 6580d7ce18..7f9b0bd8f5 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/providers/ops/consensus/RandomMessageSubmit.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/providers/ops/consensus/RandomMessageSubmit.java
@@ -98,10 +98,6 @@ public class RandomMessageSubmit implements OpProvider {
                         .hasKnownStatusFrom(permissibleOutcomes)
                         .hasPrecheckFrom(STANDARD_PERMISSIBLE_PRECHECKS);
 
-                if (r.nextBoolean()) {
-                        op = op.usePresetTimestamp();
-                }
-
                 return Optional.of(op);
         }
 }
Repository: hashgraph/hedera-services
Issue: JRS nightly regression AWS-Services-Daily-SoftwareUpdate-4N-1C/ServicesState-Recovery-300-7m failed in RecoverStateValidator step

**Summary of the defect**
Please refer to the error logs below.

**How to reproduce (if possible)**
https://hedera-hashgraph.slack.com/archives/CKWHL8R9A/p1598863554228600

**Service logs (if applicable)**
```
---- RecoverStateValidator FAILED validation ----
<<INFO>>
Node 0 finished recover run and resume normally as expected
Node 2 finished recover run and resume normally as expected
<<ERROR>>
Node 1 did not save recover state as expected !
Node 3 did not save recover state as expected !

```
**Environment:**
- OS: [e.g. Ubuntu 18.04]
- Java: [e.g. OpenJDK 11.0.4]
- Hedera Services Version: [e.g. 0.0.5]
- HAPI Version: [e.g. 0.0.5]

**Additional Context**
Add any other context about the problem here. Attach any logs here, if applicable.


Changed files:
test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java
test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java

diff --git a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java
index 279c6226ee..7be32ad6f4 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/spec/infrastructure/OpProvider.java
@@ -82,6 +82,6 @@ public interface OpProvider {
 
 	String UNIQUE_PAYER_ACCOUNT = "uniquePayerAccount";
 	long UNIQUE_PAYER_ACCOUNT_INITIAL_BALANCE = 50_000_000_000L;
-	long TRANSACTION_FEE = 500_000_000L;
+	long TRANSACTION_FEE = 5_000_000_000L;
 
 }
diff --git a/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java b/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java
index 9b95d6b757..3eb44d8a4c 100644
--- a/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java
+++ b/test-clients/src/main/java/com/hedera/services/bdd/spec/transactions/TxnUtils.java
@@ -247,7 +247,6 @@ public class TxnUtils {
 				.setSeconds(instant.getEpochSecond() + offsetSecs)
 				.setNanos(candidateNano).build();
 
-		log.info("timestamp : {}", uniqueTS);
 		return uniqueTS;
 	}
Repository: hashgraph/hedera-services
Issue: Always use (oldExpiration + effectiveRenewalPeriod) for newExpiration in auto-renew

**Summary of the defect**
The `RenewalProcess` is using (consensusTime + effectiveRenewalPeriod) as the new expiration in the record for an auto-renewed account. 

This is a mismatch with the actual new expiration that uses the (oldExpiration + effectiveRenewalPeriod).

**Suggested fix**
Just use (oldExpiration + effectiveRenewalPeriod) for both.

Changed files:
hedera-node/src/test/java/com/hedera/services/state/expiry/renewal/RenewalProcessTest.java
hedera-node/src/main/java/com/hedera/services/state/expiry/renewal/RenewalProcess.java

diff --git a/hedera-node/src/main/java/com/hedera/services/state/expiry/renewal/RenewalProcess.java b/hedera-node/src/main/java/com/hedera/services/state/expiry/renewal/RenewalProcess.java
index 6e2beebaf6..f3b997397c 100644
--- a/hedera-node/src/main/java/com/hedera/services/state/expiry/renewal/RenewalProcess.java
+++ b/hedera-node/src/main/java/com/hedera/services/state/expiry/renewal/RenewalProcess.java
@@ -99,7 +99,7 @@ public class RenewalProcess {
 		final long renewalFee = usageAssessment.fee();
 
 		helper.renewLastClassifiedWith(renewalFee, effPeriod);
-		recordsHelper.streamCryptoRenewal(accountId, renewalFee, longNow + effPeriod);
+		recordsHelper.streamCryptoRenewal(accountId, renewalFee, lastClassified.getExpiry() + effPeriod);
 	}
 
 	private void processDetachedAccountGracePeriodOver(MerkleEntityId accountId) {
diff --git a/hedera-node/src/test/java/com/hedera/services/state/expiry/renewal/RenewalProcessTest.java b/hedera-node/src/test/java/com/hedera/services/state/expiry/renewal/RenewalProcessTest.java
index 21cdd0cef8..f10b2acf27 100644
--- a/hedera-node/src/test/java/com/hedera/services/state/expiry/renewal/RenewalProcessTest.java
+++ b/hedera-node/src/test/java/com/hedera/services/state/expiry/renewal/RenewalProcessTest.java
@@ -204,6 +204,6 @@ class RenewalProcessTest {
 		// then:
 		assertTrue(wasTouched);
 		verify(helper).renewLastClassifiedWith(fee, actualRenewalPeriod);
-		verify(recordsHelper).streamCryptoRenewal(key, fee, now + actualRenewalPeriod);
+		verify(recordsHelper).streamCryptoRenewal(key, fee, now - 1 + actualRenewalPeriod);
 	}
 }