This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
2b223ca8
Commit
2b223ca8
authored
3 years ago
by
Daniel Crazzolara
Browse files
Options
Downloads
Patches
Plain Diff
Renamed tmp directory to tmp-import to avoid exceptions
parent
efb7586f
2 merge requests
!188
Merging Peer Reviewing et. al to Master
,
!164
211 peer reviewing functionality
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/at/ac/uibk/gitsearch/service/ExerciseService.java
+11
-11
11 additions, 11 deletions
...in/java/at/ac/uibk/gitsearch/service/ExerciseService.java
src/main/java/at/ac/uibk/gitsearch/service/GitlabService.java
+1
-1
1 addition, 1 deletion
...main/java/at/ac/uibk/gitsearch/service/GitlabService.java
with
12 additions
and
12 deletions
src/main/java/at/ac/uibk/gitsearch/service/ExerciseService.java
+
11
−
11
View file @
2b223ca8
...
...
@@ -46,7 +46,7 @@ public class ExerciseService {
/**
* Retrieve a zipped Artemis Exercise from a given URL
* and store it in 'tmp' directory
* and store it in 'tmp
-import
' directory
* @param exerciseUrl the url of the exposed exercise
* @throws ArtemisImportError
*/
...
...
@@ -75,7 +75,7 @@ public class ExerciseService {
* - Copy, commit and push files to the new repository
*
* @param exerciseInfo of the exercise to import
* @param exerciseToken of the stored exercise (in '/tmp' directory) to import
* @param exerciseToken of the stored exercise (in '/tmp
-import
' directory) to import
*/
public
void
importExercise
(
ArtemisExerciseInfo
exerciseInfo
,
String
exerciseToken
,
Integer
gitlabGroupId
)
throws
GitLabApiException
,
GitAPIException
,
IOException
{
applyExerciseInfoChanges
(
exerciseInfo
,
exerciseToken
);
...
...
@@ -87,9 +87,9 @@ public class ExerciseService {
if
(
repo
==
null
)
{
throw
new
JGitInternalException
(
"Repository couldn't be cloned."
);
}
gitlabService
.
commitAndPushToRepo
(
repo
,
new
File
(
"tmp"
,
exerciseToken
));
gitlabService
.
commitAndPushToRepo
(
repo
,
new
File
(
"tmp
-import
"
,
exerciseToken
));
FileUtils
.
deleteDirectory
(
new
File
(
"tmp"
,
exerciseToken
));
FileUtils
.
deleteDirectory
(
new
File
(
"tmp
-import
"
,
exerciseToken
));
}
/**
...
...
@@ -101,8 +101,8 @@ public class ExerciseService {
ObjectMapper
mapper
=
new
ObjectMapper
(
new
YAMLFactory
());
mapper
.
enable
(
DeserializationFeature
.
READ_ENUMS_USING_TO_STRING
)
.
enable
(
MapperFeature
.
ACCEPT_CASE_INSENSITIVE_ENUMS
);
ArtemisExerciseInfo
artemisExerciseInfo
=
mapper
.
readValue
(
new
File
(
"tmp/"
+
exerciseToken
,
"artemis.yaml"
),
ArtemisExerciseInfo
.
class
);
ExerciseInfo
exerciseInfo
=
mapper
.
readValue
(
new
File
(
"tmp/"
+
exerciseToken
,
"metadata.yaml"
),
ExerciseInfo
.
class
);
ArtemisExerciseInfo
artemisExerciseInfo
=
mapper
.
readValue
(
new
File
(
"tmp
-import
/"
+
exerciseToken
,
"artemis.yaml"
),
ArtemisExerciseInfo
.
class
);
ExerciseInfo
exerciseInfo
=
mapper
.
readValue
(
new
File
(
"tmp
-import
/"
+
exerciseToken
,
"metadata.yaml"
),
ExerciseInfo
.
class
);
artemisExerciseInfo
.
appendExerciseInfo
(
exerciseInfo
);
return
artemisExerciseInfo
;
}
...
...
@@ -113,12 +113,12 @@ public class ExerciseService {
* @param subDir name of the tmp-subdirectory
*/
private
void
storeZipInTmp
(
ZipInputStream
zipInputStream
,
String
subDir
)
throws
IOException
{
if
(!
new
File
(
"tmp"
).
exists
())
{
if
(!
new
File
(
"tmp"
).
mkdir
())
{
throw
new
IOException
(
"Could not create missing '/tmp' directory"
);
if
(!
new
File
(
"tmp
-import
"
).
exists
())
{
if
(!
new
File
(
"tmp
-import
"
).
mkdir
())
{
throw
new
IOException
(
"Could not create missing '/tmp
-import
' directory"
);
}
}
File
tmpDir
=
new
File
(
"tmp"
,
subDir
);
File
tmpDir
=
new
File
(
"tmp
-import
"
,
subDir
);
if
(!
tmpDir
.
mkdir
())
{
throw
new
IOException
(
"Temporary exercise directory could not be created"
);
}
...
...
@@ -165,7 +165,7 @@ public class ExerciseService {
ObjectMapper
mapper
=
new
ObjectMapper
(
new
YAMLFactory
()
.
enable
(
YAMLGenerator
.
Feature
.
INDENT_ARRAYS
)
.
disable
(
YAMLGenerator
.
Feature
.
WRITE_DOC_START_MARKER
));
mapper
.
writeValue
(
new
File
(
"tmp/"
+
exerciseToken
,
"metadata.yaml"
),
exerciseInfo
.
getExerciseInfoOnly
());
mapper
.
writeValue
(
new
File
(
"tmp
-import
/"
+
exerciseToken
,
"metadata.yaml"
),
exerciseInfo
.
getExerciseInfoOnly
());
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/main/java/at/ac/uibk/gitsearch/service/GitlabService.java
+
1
−
1
View file @
2b223ca8
...
...
@@ -238,7 +238,7 @@ public class GitlabService {
*/
public
Repository
checkoutRepo
(
String
repoUrl
)
throws
IOException
{
String
repoDirName
=
repoUrl
.
split
(
"/"
)[
repoUrl
.
split
(
"/"
).
length
-
1
];
File
dst
=
new
File
(
"tmp"
,
repoDirName
);
File
dst
=
new
File
(
"tmp
-import
"
,
repoDirName
);
if
(
dst
.
exists
())
{
log
.
debug
(
"Temporary directory '{}' already exists, removing it."
,
dst
.
getPath
());
FileUtils
.
deleteDirectory
(
dst
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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