Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
7d017c8c
Commit
7d017c8c
authored
10 years ago
by
hg
Browse files
Options
Downloads
Plain Diff
Merge OpenOLAT 9.4 to OpenOLAT 10.0 with 267542b23e14f1e7ae909d3e76b451d1317cd378
parents
3f11f4e2
c0c5c747
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/org/olat/ims/qti/process/DecompressibleInputStream.java
+68
-0
68 additions, 0 deletions
...a/org/olat/ims/qti/process/DecompressibleInputStream.java
src/main/java/org/olat/ims/qti/process/FilePersister.java
+2
-1
2 additions, 1 deletion
src/main/java/org/olat/ims/qti/process/FilePersister.java
with
70 additions
and
1 deletion
src/main/java/org/olat/ims/qti/process/DecompressibleInputStream.java
0 → 100644
+
68
−
0
View file @
7d017c8c
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package
org.olat.ims.qti.process
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InvalidClassException
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectStreamClass
;
import
org.olat.core.logging.OLog
;
import
org.olat.core.logging.Tracing
;
/**
*
* http://stackoverflow.com/questions/795470/how-to-deserialize-an-object-persisted-in-a-db-now-when-the-object-has-different
*
* @author jorge, java forums
*
*/
public
class
DecompressibleInputStream
extends
ObjectInputStream
{
private
static
final
OLog
log
=
Tracing
.
createLoggerFor
(
DecompressibleInputStream
.
class
);
public
DecompressibleInputStream
(
InputStream
in
)
throws
IOException
{
super
(
in
);
}
@Override
protected
ObjectStreamClass
readClassDescriptor
()
throws
IOException
,
ClassNotFoundException
{
ObjectStreamClass
resultClassDescriptor
=
super
.
readClassDescriptor
();
// initially streams descriptor
Class
<?>
localClass
=
Class
.
forName
(
resultClassDescriptor
.
getName
());
// the class in the local JVM that this descriptor represents.
if
(
localClass
==
null
)
{
log
.
error
(
"No local class for "
+
resultClassDescriptor
.
getName
());
return
resultClassDescriptor
;
}
ObjectStreamClass
localClassDescriptor
=
ObjectStreamClass
.
lookup
(
localClass
);
if
(
localClassDescriptor
!=
null
)
{
// only if class implements serializable
final
long
localSUID
=
localClassDescriptor
.
getSerialVersionUID
();
final
long
streamSUID
=
resultClassDescriptor
.
getSerialVersionUID
();
if
(
streamSUID
!=
localSUID
)
{
// check for serialVersionUID mismatch.
final
StringBuilder
s
=
new
StringBuilder
(
"Overriding serialized class version mismatch: "
);
s
.
append
(
"local serialVersionUID = "
).
append
(
localSUID
).
append
(
" stream serialVersionUID = "
).
append
(
streamSUID
);
Exception
e
=
new
InvalidClassException
(
s
.
toString
());
log
.
warn
(
s
.
toString
(),
e
);
resultClassDescriptor
=
localClassDescriptor
;
}
}
return
resultClassDescriptor
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/org/olat/ims/qti/process/FilePersister.java
+
2
−
1
View file @
7d017c8c
...
...
@@ -156,7 +156,7 @@ public class FilePersister implements Persister {
}
is
=
new
FileInputStream
(
new
File
(
fSerialDir
,
QTI_FILE
));
BufferedInputStream
bis
=
new
BufferedInputStream
(
is
,
262144
);
ObjectInputStream
oistream
=
new
Object
InputStream
(
bis
);
ObjectInputStream
oistream
=
new
Decompressible
InputStream
(
bis
);
o
=
oistream
.
readObject
();
oistream
.
close
();
is
.
close
();
...
...
@@ -166,6 +166,7 @@ public class FilePersister implements Persister {
}
}
catch
(
Exception
e
)
{
log
.
error
(
""
,
e
);
try
{
if
(
is
!=
null
)
is
.
close
();
}
catch
(
IOException
e1
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment