Skip to content

Commit 3df5ce0

Browse files
committed
minor cleanup
1 parent ea53f19 commit 3df5ce0

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

apps/updateserver/rest/UpdateProvider.cfc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -751,31 +751,31 @@ component {
751751
MARK: artifactDownloader
752752
*/
753753

754-
private function artifactDownloader(type,version) {
754+
private function artifactDownloader( type, version ) {
755755
var _url=createArtifactIfNecessary( type, version );
756756
header statuscode="302" statustext="Found";
757757
if (structKeyExists(local,"_url")) {
758-
header name="Content-disposition" value="attachment;filename=#listlast(local._url,'\/')#";
758+
header name="Content-disposition" value="attachment;filename=#listlast( _url, '\/' )#";
759759
if (left( application.coreS3Root, 3 ) == "s3:"){
760-
header name="Location" value=local._url;
760+
header name="Location" value=_url;
761761
} else {
762762
// route thru /localDevRepo
763-
header name="Location" value=rewriteLocalMaven({_url})._url;
763+
header name="Location" value=rewriteLocalMaven( { _url } )._url;
764764
}
765765
} else {
766766
// is this reachable, need to handle local dev repo? src is obviously wrong
767-
header name="Location" value="#LUCEE_MAVEN_CDN#/#arguments.version#/lucee-#arguments.version#.war";
767+
header name="Location" value="#LUCEE_MAVEN_CDN#/#arguments.version#/lucee-#arguments.version#.#arguments.type#";
768768
}
769769
}
770770

771771
/*
772772
MARK: createArtifactIfNecessary
773773
*/
774774

775-
private function createArtifactIfNecessary(type,version) {
776-
var versionData=services.VersionUtils::toVersion(arguments.version);
777-
var s3=new services.legacy.S3(variables.s3Root);
778-
var data=s3.getLuceeVersionsDetail(versionData.display);
775+
private function createArtifactIfNecessary( type , version ) {
776+
var versionData=services.VersionUtils::toVersion( arguments.version );
777+
var s3=new services.legacy.S3( variables.s3Root );
778+
var data=s3.getLuceeVersionsDetail( versionData.display );
779779

780780
logger("createArtifactIfNecessary(#type#,#version#) ---");
781781

@@ -809,6 +809,7 @@ component {
809809
content type="text/plain";
810810
header statuscode="429" statustext="Still Building";
811811
echo("artifact #encodeForHtml(type)# for version #encodeForHtml(version)# does not exist yet, but we triggered the build for it. Try again in a couple minutes.");
812+
abort;
812813
}
813814

814815
private function createArtifactURL(type,version) {

apps/updateserver/services/legacy/ArtifactBuilder.cfc

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ component {
2525
list = arguments.specType;
2626
if ( !isNull( data[ arguments.specType ] ) ) return; // already built
2727
} else {
28+
// zero is built by the build process and not handled here
2829
list="lco,war,light,express";
2930
if (includingForgeBox)
3031
list&=",forgebox,forgebox-light";
@@ -132,6 +133,7 @@ component {
132133
}
133134
catch( e ){
134135
logger(text=e.message, type="error", exception=e);
136+
trg = e.message;
135137
}
136138
finally {
137139
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
@@ -163,8 +165,13 @@ component {
163165
var build={};
164166
loop list="extensions,common,website,war" item="local.name" {
165167
var tmp=curr & "build/" & name & "/";
166-
if ( name == "extensions" && !directoryExists( tmp ) )
167-
directoryCreate( tmp, true );
168+
if ( !directoryExists( tmp ) ){
169+
if ( name == "extensions" ){
170+
directoryCreate( tmp, true );
171+
} else {
172+
throw( message="Required build directory missing: " & tmp );
173+
}
174+
}
168175
if ( name == "war" ){
169176
tmp = curr & "build/" & warTemplateFolder & "/";
170177
}
@@ -186,6 +193,7 @@ component {
186193
}
187194
catch( e ){
188195
logger(text=e.message, type="error", exception=e);
196+
trg = e.message;
189197
}
190198
finally {
191199
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
@@ -235,7 +243,7 @@ component {
235243

236244
// unzip core
237245
var lcoFile=tmpLoader & sep & "core" & sep & "core.lco";
238-
local.tmpCore=temp & "lucee-core-" & createUniqueId(); // the jar
246+
var tmpCore=temp & "lucee-core-" & createUniqueId(); // the jar
239247
directoryCreate(tmpCore);
240248
zip action="unzip" file=lcoFile destination=tmpCore;
241249

@@ -258,7 +266,7 @@ component {
258266
if ( fileExists( lcoFile ) ) fileDelete( lcoFile );
259267
zip action="zip" source=tmpCore file=lcoFile;
260268
// zip loader
261-
local.tmpLoaderFile=temp&"lucee-loader-"&createUniqueId()&".jar";
269+
var tmpLoaderFile=temp&"lucee-loader-"&createUniqueId()&".jar";
262270
zip action="zip" source=tmpLoader file=tmpLoaderFile;
263271

264272
//if(fileExists(light)) fileDelete(light);
@@ -273,6 +281,7 @@ component {
273281
}
274282
catch( e ){
275283
logger(text=e.message, type="error", exception=e);
284+
trg = e.message;
276285
}
277286
finally {
278287
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
@@ -316,12 +325,18 @@ component {
316325
var local_tomcat_templates = curr & "build/servers"
317326
if ( checkVersionGTE( arguments.version, 6, 2, 1 ) ) {
318327
logger("Using Tomcat 11" );
328+
if ( !structKeyExists( expressTemplates, 'tomcat-11' ) )
329+
throw( message="No Tomcat 11 express template found for version #arguments.version#" );
319330
zip action="unzip" file="#local_tomcat_templates#/#expressTemplates['tomcat-11']#" destination=tmpTom;
320331
} else if ( checkVersionGTE( arguments.version, 6, 2 ) ) {
321332
logger("Using Tomcat 10" );
333+
if ( !structKeyExists( expressTemplates, 'tomcat-10' ) )
334+
throw( message="No Tomcat 10 express template found for version #arguments.version#" );
322335
zip action="unzip" file="#local_tomcat_templates#/#expressTemplates['tomcat-10']#" destination=tmpTom;
323336
} else {
324337
logger("Using Tomcat 9" );
338+
if ( !structKeyExists( expressTemplates, 'tomcat-9' ) )
339+
throw( message="No Tomcat 9 express template found for version #arguments.version#" );
325340
zip action="unzip" file="#local_tomcat_templates#/#expressTemplates['tomcat-9']#" destination=tmpTom;
326341
}
327342

@@ -342,6 +357,7 @@ component {
342357
}
343358
catch( e ){
344359
logger(text=e.message, type="error", exception=e);
360+
trg = e.message;
345361
}
346362
finally {
347363
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);
@@ -378,9 +394,9 @@ component {
378394
// create the war
379395
var war=temp & "/engine.war";
380396
if ( arguments.light ) {
381-
local.lightJar = createLight(jar, version, false, temp);
382-
if ( !fileExists( local.lightJar ) )
383-
throw "ERROR: forgebox light, createLight didn't produce a jar [#local.lightJar#]";
397+
var lightJar = createLight(jar, version, false, temp);
398+
if ( !fileExists( lightJar ) )
399+
throw "ERROR: forgebox light, createLight didn't produce a jar [#lightJar#]";
384400
}
385401

386402
zip action="zip" file=war overwrite=true {
@@ -419,6 +435,7 @@ component {
419435
}
420436
catch( e ){
421437
logger(text=e.message, type="error", exception=e);
438+
trg = e.message;
422439
}
423440
finally {
424441
if (!isNull(temp) && directoryExists(temp)) directoryDelete(temp,true);

apps/updateserver/services/legacy/MavenRepo.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ component {
345345
local.jar=getArtifactDirectory()&"lucee-light-"&version&".jar"; // the jar
346346
if(!structKeyExists(url,"makefresh") && fileExists(jar)) return jar;
347347

348-
setting requesttimeout="10000";
348+
setting requesttimeout="1000";
349349
var loader=getLoader(version);
350350
//try{
351351
createLight(loader,jar);

apps/updateserver/services/legacy/S3.cfc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ component {
6464
try {
6565
cfhttp( url=downloadRefeshUrl );
6666
} catch (e){
67-
throw(message="error returned updating download server [#downloadRefeshUrl#]", cause=e);
67+
logger(message="error returned updating download server [#downloadRefeshUrl#]", exception=e, type="error");
6868
}
6969
} else {
7070
logger("Versions updated, not pinging due to missing application.downloadsUrl");
7171
}
7272
}
7373
}
74-
return application.s3Versions = data;
74+
application.s3Versions = data;
7575
} catch (e){
7676
systemOutput( "error directory listing versions on s3", true );
7777
throw( message="cannot read versions from s3 directory", cause=e );
7878
}
79-
systemOutput("s3Versions.list [#runId#] FETCHED #numberFormat(getTickCount()-start)#ms, #qry.recordcount# files on s3 found",1,1);
79+
systemOutput("s3Versions.list [#runId#] FETCHED #numberFormat(getTickCount()-start)#ms, #len(data)# files on s3 found",1,1);
8080
}
8181
if ( !structKeyExists( application, "s3Versions" ) ){
8282
// lock timed out, still use cache if found
@@ -137,7 +137,7 @@ component {
137137
MARK: Add
138138
*/
139139
public function add(required string type, required string version) {
140-
setting requesttimeout="10000000";
140+
setting requesttimeout="1000";
141141

142142
logger("-------- add:#type# --------");
143143
var data = getLuceeVersionsDetail(version);
@@ -167,7 +167,7 @@ component {
167167
MARK: Add Missing
168168
*/
169169
public function addMissing(includingForgeBox=false, skipMaven=false) {
170-
setting requesttimeout="1000000";
170+
setting requesttimeout="1000";
171171
systemOutput("start:"&now(),1,1);
172172
var started = getTickCount();
173173

0 commit comments

Comments
 (0)