Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7233210

Browse files
committed
Make pluginVersion an constructor option
PluginManagerCore is throwing a null pointer exception when used in thetests.
1 parenteef5bb3 commit7233210

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

‎src/main/kotlin/com/coder/gateway/CoderGatewayConnectionProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class CoderGatewayConnectionProvider : GatewayConnectionProvider {
140140
if (token==null) {// User aborted.
141141
throwIllegalArgumentException("Unable to connect to$deploymentURL,$TOKEN is missing")
142142
}
143-
val client=CoderRestClient(deploymentURL, token.first, settings.headerCommand)
143+
val client=CoderRestClient(deploymentURL, token.first, settings.headerCommand,null)
144144
returntry {
145145
Pair(client, client.me().username)
146146
}catch (ex:AuthenticationResponseException) {

‎src/main/kotlin/com/coder/gateway/sdk/CoderRestClientService.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,30 @@ class CoderRestClientService {
4545
* @throws [AuthenticationResponseException] if authentication failed.
4646
*/
4747
funinitClientSession(url:URL,token:String,headerCommand:String?):User {
48-
client=CoderRestClient(url, token, headerCommand)
48+
client=CoderRestClient(url, token, headerCommand,null)
4949
me= client.me()
5050
buildVersion= client.buildInfo().version
5151
isReady=true
5252
return me
5353
}
5454
}
5555

56-
classCoderRestClient(varurl:URL,vartoken:String,varheaderCommand:String?) {
56+
classCoderRestClient(varurl:URL,vartoken:String,
57+
privatevarheaderCommand:String?,
58+
privatevarpluginVersion:String?,
59+
) {
5760
privatevar httpClient:OkHttpClient
5861
privatevar retroRestClient:CoderV2RestFacade
5962

6063
init {
6164
val gson:Gson=GsonBuilder().registerTypeAdapter(Instant::class.java,InstantConverter()).setPrettyPrinting().create()
62-
val pluginVersion=PluginManagerCore.getPlugin(PluginId.getId("com.coder.gateway"))!!// this is the id from the plugin.xml
65+
if (pluginVersion.isNullOrBlank()) {
66+
pluginVersion=PluginManagerCore.getPlugin(PluginId.getId("com.coder.gateway"))!!.version// this is the id from the plugin.xml
67+
}
6368

6469
httpClient=OkHttpClient.Builder()
6570
.addInterceptor { it.proceed(it.request().newBuilder().addHeader("Coder-Session-Token", token).build()) }
66-
.addInterceptor { it.proceed(it.request().newBuilder().addHeader("User-Agent","Coder Gateway/${pluginVersion.version} (${SystemInfo.getOsNameAndVersion()};${SystemInfo.OS_ARCH})").build()) }
71+
.addInterceptor { it.proceed(it.request().newBuilder().addHeader("User-Agent","Coder Gateway/${pluginVersion} (${SystemInfo.getOsNameAndVersion()};${SystemInfo.OS_ARCH})").build()) }
6772
.addInterceptor {
6873
var request= it.request()
6974
val headers= getHeaders(url, headerCommand)

‎src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
256256
deployments[dir]?:try {
257257
val url=Path.of(dir).resolve("url").readText()
258258
val token=Path.of(dir).resolve("session").readText()
259-
DeploymentInfo(CoderRestClient(url.toURL(), token, settings.headerCommand))
259+
DeploymentInfo(CoderRestClient(url.toURL(), token, settings.headerCommand,null))
260260
}catch (e:Exception) {
261261
logger.error("Unable to create client from$dir", e)
262262
DeploymentInfo(error="Error trying to read$dir:${e.message}")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp