Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
182f658a
Commit
182f658a
authored
Nov 14, 2014
by
Tom Evans
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #70 from SvenBunge/of-560_removePack200
OF-560: Remove pack200 decompression on startup
parents
d12942c8
b08a843a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
128 deletions
+3
-128
PluginManager.java
...va/org/jivesoftware/openfire/container/PluginManager.java
+0
-57
ServerStarter.java
...java/org/jivesoftware/openfire/starter/ServerStarter.java
+3
-71
No files found.
src/java/org/jivesoftware/openfire/container/PluginManager.java
View file @
182f658a
...
@@ -21,12 +21,10 @@
...
@@ -21,12 +21,10 @@
package
org
.
jivesoftware
.
openfire
.
container
;
package
org
.
jivesoftware
.
openfire
.
container
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileFilter
;
import
java.io.FileFilter
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.FilenameFilter
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
...
@@ -49,8 +47,6 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
...
@@ -49,8 +47,6 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarFile
;
import
java.util.jar.JarFile
;
import
java.util.jar.JarOutputStream
;
import
java.util.jar.Pack200
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipFile
;
import
org.dom4j.Attribute
;
import
org.dom4j.Attribute
;
...
@@ -1134,64 +1130,11 @@ public class PluginManager {
...
@@ -1134,64 +1130,11 @@ public class PluginManager {
}
}
zipFile
.
close
();
zipFile
.
close
();
// The lib directory of the plugin may contain Pack200 versions of the JAR
// file. If so, unpack them.
unpackArchives
(
new
File
(
dir
,
"lib"
));
}
}
catch
(
Exception
e
)
{
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
Log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
/**
* Converts any pack files in a directory into standard JAR files. Each
* pack file will be deleted after being converted to a JAR. If no
* pack files are found, this method does nothing.
*
* @param libDir the directory containing pack files.
*/
private
void
unpackArchives
(
File
libDir
)
{
// Get a list of all packed files in the lib directory.
File
[]
packedFiles
=
libDir
.
listFiles
(
new
FilenameFilter
()
{
public
boolean
accept
(
File
dir
,
String
name
)
{
return
name
.
endsWith
(
".pack"
);
}
});
if
(
packedFiles
==
null
)
{
// Do nothing since no .pack files were found
return
;
}
// Unpack each.
for
(
File
packedFile
:
packedFiles
)
{
try
{
String
jarName
=
packedFile
.
getName
().
substring
(
0
,
packedFile
.
getName
().
length
()
-
".pack"
.
length
());
// Delete JAR file with same name if it exists (could be due to upgrade
// from old Openfire release).
File
jarFile
=
new
File
(
libDir
,
jarName
);
if
(
jarFile
.
exists
())
{
jarFile
.
delete
();
}
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
packedFile
));
JarOutputStream
out
=
new
JarOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
new
File
(
libDir
,
jarName
))));
Pack200
.
Unpacker
unpacker
=
Pack200
.
newUnpacker
();
// Call the unpacker
unpacker
.
unpack
(
in
,
out
);
in
.
close
();
out
.
close
();
packedFile
.
delete
();
}
catch
(
Exception
e
)
{
Log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
}
/**
/**
...
...
src/java/org/jivesoftware/openfire/starter/ServerStarter.java
View file @
182f658a
...
@@ -20,11 +20,9 @@
...
@@ -20,11 +20,9 @@
package
org
.
jivesoftware
.
openfire
.
starter
;
package
org
.
jivesoftware
.
openfire
.
starter
;
import
java.io.*
;
import
org.jivesoftware.util.Log
;
import
java.util.jar.Pack200
;
import
java.util.jar.JarOutputStream
;
import
org.jivesoftware.util.Log
;
import
java.io.File
;
/**
/**
* Starts the core XMPP server. A bootstrap class that configures classloaders
* Starts the core XMPP server. A bootstrap class that configures classloaders
* to ensure easy, dynamic server startup.
* to ensure easy, dynamic server startup.
...
@@ -86,9 +84,6 @@ public class ServerStarter {
...
@@ -86,9 +84,6 @@ public class ServerStarter {
libDir
=
new
File
(
DEFAULT_LIB_DIR
);
libDir
=
new
File
(
DEFAULT_LIB_DIR
);
}
}
// Unpack any pack files.
unpackArchives
(
libDir
,
true
);
String
adminLibDirString
=
System
.
getProperty
(
"openfireHome"
);
String
adminLibDirString
=
System
.
getProperty
(
"openfireHome"
);
if
(
adminLibDirString
==
null
)
{
if
(
adminLibDirString
==
null
)
{
adminLibDirString
=
DEFAULT_ADMIN_LIB_DIR
;
adminLibDirString
=
DEFAULT_ADMIN_LIB_DIR
;
...
@@ -97,10 +92,7 @@ public class ServerStarter {
...
@@ -97,10 +92,7 @@ public class ServerStarter {
adminLibDirString
=
adminLibDirString
+
"/plugins/admin/webapp/WEB-INF/lib"
;
adminLibDirString
=
adminLibDirString
+
"/plugins/admin/webapp/WEB-INF/lib"
;
}
}
File
adminLibDir
=
new
File
(
adminLibDirString
);
File
adminLibDir
=
new
File
(
adminLibDirString
);
if
(
adminLibDir
.
exists
())
{
if
(!
adminLibDir
.
exists
())
{
unpackArchives
(
adminLibDir
,
false
);
}
else
{
Log
.
warn
(
"Admin Lib Directory "
+
adminLibDirString
+
Log
.
warn
(
"Admin Lib Directory "
+
adminLibDirString
+
" does not exist. Web admin console may not work."
);
" does not exist. Web admin console may not work."
);
}
}
...
@@ -132,64 +124,4 @@ public class ServerStarter {
...
@@ -132,64 +124,4 @@ public class ServerStarter {
}
}
return
parent
;
return
parent
;
}
}
/**
* Converts any pack files in a directory into standard JAR files. Each
* pack file will be deleted after being converted to a JAR. If no
* pack files are found, this method does nothing.
*
* @param libDir the directory containing pack files.
* @param printStatus true if status ellipses should be printed when unpacking.
*/
private
void
unpackArchives
(
File
libDir
,
boolean
printStatus
)
{
// Get a list of all packed files in the lib directory.
File
[]
packedFiles
=
libDir
.
listFiles
(
new
FilenameFilter
()
{
public
boolean
accept
(
File
dir
,
String
name
)
{
return
name
.
endsWith
(
".pack"
);
}
});
if
(
packedFiles
==
null
)
{
// Do nothing since no .pack files were found
return
;
}
// Unpack each.
boolean
unpacked
=
false
;
for
(
File
packedFile
:
packedFiles
)
{
try
{
String
jarName
=
packedFile
.
getName
().
substring
(
0
,
packedFile
.
getName
().
length
()
-
".pack"
.
length
());
// Delete JAR file with same name if it exists (could be due to upgrade
// from old Openfire release).
File
jarFile
=
new
File
(
libDir
,
jarName
);
if
(
jarFile
.
exists
())
{
jarFile
.
delete
();
}
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
packedFile
));
JarOutputStream
out
=
new
JarOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
new
File
(
libDir
,
jarName
))));
Pack200
.
Unpacker
unpacker
=
Pack200
.
newUnpacker
();
// Print something so the user knows something is happening.
if
(
printStatus
)
{
System
.
out
.
print
(
"."
);
}
// Call the unpacker
unpacker
.
unpack
(
in
,
out
);
in
.
close
();
out
.
close
();
packedFile
.
delete
();
unpacked
=
true
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
// Print newline if unpacking happened.
if
(
unpacked
&&
printStatus
)
{
System
.
out
.
println
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment