Skip to content
Open
Show file tree
Hide file tree
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 @@ -199,8 +199,7 @@ class Controller(

override def handleBackpressure(isBackpressured: Boolean): Unit = {}

// adopted solution from
// https://stackoverflow.com/questions/54228901/right-way-of-exception-handling-when-using-akka-actors
// Use AllForOneStrategy to stop all children on any fatal error and report it to the client.
override val supervisorStrategy: SupervisorStrategy =
AllForOneStrategy(maxNrOfRetries = 0, withinTimeRange = 1.minute) {
case e: Throwable =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,9 @@ import javax.websocket.server.{HandshakeRequest, ServerEndpointConfig}
import scala.jdk.CollectionConverters.{ListHasAsScala, _}

/**
* This configurator extracts HTTPSession and associates it to ServerEndpointConfig,
* allow it to be accessed by Websocket connections.
* <pre>
* See <a href="https://stackoverflow.com/questions/17936440/accessing-httpsession-
* from-httpservletrequest-in-a-web-socket-serverendpoint"></a>
* </pre>
* This configurator extracts user identity from the HTTP handshake request
* and associates it with the ServerEndpointConfig, allowing it to be
* accessed by WebSocket connections.
*/
class ServletAwareConfigurator extends ServerEndpointConfig.Configurator with LazyLogging {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ object PhysicalOp {
}
}

// @JsonIgnore is not working when directly annotated to fields of a case class
// https://stackoverflow.com/questions/40482904/jsonignore-doesnt-work-in-scala-case-class
// In Scala case classes, @JsonIgnore on constructor parameters is not recognized by Jackson.
// Use @JsonIgnoreProperties at the class level instead.
@JsonIgnoreProperties(
Array(
"opExecInitInfo", // function type, ignore it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1483,17 +1483,33 @@ class JsonSchemaGenerator(
}

def generateTitleFromPropertyName(propertyName: String): String = {
// Code found here: http://stackoverflow.com/questions/2559759/how-do-i-convert-camelcase-into-human-readable-names-in-java
val s = propertyName.replaceAll(
String.format(
"%s|%s|%s",
"(?<=[A-Z])(?=[A-Z][a-z])",
"(?<=[^A-Z])(?=[A-Z])",
"(?<=[A-Za-z])(?=[^A-Za-z])"
),
" "
)
// Insert spaces at camelCase/PascalCase boundaries and letter-to-non-letter transitions.
val builder = new StringBuilder
for (i <- propertyName.indices) {
val c = propertyName(i)
if (i > 0) {
val prev = propertyName(i - 1)
val isCurrentUpper = c.isUpper
val isPrevUpper = prev.isUpper
val isPrevLetter = prev.isLetter
val isCurrentLetter = c.isLetter
val nextIsLower = i + 1 < propertyName.length && propertyName(i + 1).isLower

// Space before uppercase that follows a non-uppercase char (e.g., "camelCase" or "123Value")
// Space before uppercase in an acronym run when next char is lowercase (e.g., "XMLParser")
// Space before a non-letter that follows a letter (e.g., "test123")
if (
(isCurrentUpper && !isPrevUpper) ||
(isCurrentUpper && isPrevUpper && nextIsLower) ||
(!isCurrentLetter && isPrevLetter)
) {
builder.append(' ')
}
}
builder.append(c)
}

val s = builder.toString()
// Make the first letter uppercase
s.substring(0, 1).toUpperCase() + s.substring(1)
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/custom-webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ module.exports = {
],
},
],
// this is required for loading .wasm (and other) files.
// For context, see https://stackoverflow.com/a/75252098 and https://github.com/angular/angular-cli/issues/24617
// Enable URL handling in webpack's JavaScript parser, required for loading .wasm files.
// See https://github.com/angular/angular-cli/issues/24617
parser: {
javascript: {
url: true,
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/app/common/service/user/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ export class AuthService {
const expirationTime = this.jwtHelperService.getTokenExpirationDate()?.getTime();
const token = AuthService.getAccessToken();
if (token !== null && !this.jwtHelperService.isTokenExpired(token) && expirationTime !== undefined) {
// use timer with ignoreElements to avoid event being immediately triggered (in RxJS 7)
// see https://stackoverflow.com/questions/70013573/how-to-replicate-delay-from-rxjs-6-x
// In RxJS 7, timer emits immediately then completes. Using ignoreElements() suppresses
// the emitted value so the complete callback fires only after the specified delay.
this.tokenExpirationSubscription = timer(expirationTime - new Date().getTime())
.pipe(ignoreElements())
.subscribe(() => this.logout());
.subscribe({ complete: () => this.logout() });
}
}

Expand Down
5 changes: 2 additions & 3 deletions frontend/src/app/common/type/generic-web-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
*/

/**
* make sure do not add const/declare before enum here.
* Const enums are removed during transpiration in JS so you can not use them at runtime.
* Source: https://stackoverflow.com/questions/50365598/typescript-runtime-error-cannot-read-property-of-undefined-enum
* Do not use `const enum` here. Const enums are inlined at compile time and removed
* from the emitted JavaScript, which causes runtime errors if the enum is accessed dynamically.
*/
export enum GenericWebResponseCode {
SUCCESS = 0,
Expand Down
Loading