Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Issue 4 (DoUnlock NPEs on concurrent Mac/non-Mac client access) #5

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
fb41c6f
Resolved issue where one Mac client access permanently sets the
jackgene Jan 5, 2014
697a4f9
Made instance variables final where possible, mode protected variables
jackgene Jan 5, 2014
4e556f3
Made methods only used by ResourceLocks package private to guarantee it
jackgene Jan 5, 2014
3007f98
Made add/remove lockedObjectOwner synchronized, since it's invoke
jackgene Jan 5, 2014
0a4bf68
Made LockedObject shared variables volatile.
jackgene Jan 5, 2014
60f001c
Removed TODO comments.
jackgene Jan 5, 2014
36f309d
Made DoUnlock state variables final so that we can be more certain the
jackgene Jan 5, 2014
7c568e1
Reduced mutability and visibility of shared state to help determine what
jackgene Jan 5, 2014
e93d86f
Made shared mutable state volatile.
jackgene Jan 5, 2014
40beb2a
Made ResourceLocks#checkTimeouts synchronized.
jackgene Jan 5, 2014
92c31b3
Removed unused variable from DoLock.
jackgene Jan 5, 2014
daab9b1
Made immutable state variables final in DoLock. DoLock#execute will need
jackgene Jan 5, 2014
56a5701
Log instead of printStackTrace() on LockFailedException in
jackgene Jan 5, 2014
68e97ff
Allow getlastmodified on collections.
jackgene Jan 30, 2014
5c12f6a
Fixed unit tests.
Feb 4, 2014
34eed54
Merge branch 'master' of https://github.com/jackgene/webdav-servlet
Feb 4, 2014
9082961
Implemented workaround for shared variable mutation issue.
jackgene Feb 4, 2014
32c6355
Removed unused variable.
jackgene Feb 4, 2014
c6c4fa3
Upgraded Gradle, and simplified build to the bare minimum required to
jackgene Feb 4, 2014
272ce8a
Re-introduced and upgraded gradle wrapper.
jackgene Feb 4, 2014
d92b32b
Removed unused file, and updated .gitignore.
jackgene Feb 4, 2014
e58ccc3
Added gradle wrapper jar.
jackgene Feb 4, 2014
905ec78
Added .gitignore.
jackgene Feb 4, 2014
675eb53
Flushed output more aggressively.
jackgene Feb 4, 2014
a61d639
Added serialVersionUID, removed unused imports.
jackgene Feb 4, 2014
f0c9f84
Removed/ignored more unused stuff.
jackgene Feb 4, 2014
ef09d06
Ignored bin.
jackgene Feb 4, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .cvsignore

This file was deleted.

11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
bin/
target/

# Gradle
.gradle
build

# Eclipse
.classpath
.project
.settings
Binary file removed build-libs/gradle-wrapper.jar
Binary file not shown.
Binary file removed build-libs/jetty-6.1.14.zip
Binary file not shown.
172 changes: 43 additions & 129 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,157 +13,71 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

archivesBaseName = 'webdav-servlet'
project.group = 'net.sf.webdav-servlet'
project.version = '2.1-dev'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'

usePlugin('war')
usePlugin('jetty')
archivesBaseName = 'webdav-servlet'
group = 'net.sf.webdav-servlet'
version = '2.0.2.JACKGENE-SNAPSHOT'

sourceCompatibility = 1.5
targetCompatibility = 1.5

dependencies {
addMavenRepo()
repositories {
if (rootProject.hasProperty('repositories.MAVEN_CENTRAL_MIRROR_URL')) {
maven {
url getProperty('repositories.MAVEN_CENTRAL_MIRROR_URL')
}
} else {
mavenCentral()
}
}

providedCompile "javax.servlet:servlet-api:2.4"
dependencies {
compile "javax.servlet:servlet-api:2.4"

compile "org.slf4j:slf4j-api:1.4.3"
compile "org.slf4j:slf4j-log4j12:1.4.3"
compile "log4j:log4j:1.2.12"
testCompile "junit:junit:4.4"
testCompile "org.jmock:jmock:2.4.0"
testCompile "org.springframework:spring-webmvc:2.5.2"
testCompile "org.springframework:spring-mock:2.0.7"

addConfiguration("jettyRuntime")
jettyRuntime "org.mortbay.jetty:jsp-2.1:6.1.14", "org.mortbay.jetty:jetty-annotations:6.1.14"
}

defaultTasks "help"

createTask ('help') {
println " "
println "available goals:"
println " clean \t\tcleans the build folder"
println " test \t\t\truns the test suite"
println " eclipse \t\tcreates eclipse project files"
println " jettyRun \t\tstarts with jetty webserver"
println " "
println "useful flags :"
println " -Dskip.test \t\tskip execution of tests"
println " "
println "examples"
println " ./gradlew clean dists -Dskip.test \tbuilds the distribution and skip the tests"
}

createTask('wrapper', type: Wrapper).configure {
urlRoot = 'http://dist.codehaus.org/gradle/'
gradleVersion = '0.5'
jarPath = 'build-libs'
testRuntime "org.slf4j:slf4j-log4j12:1.4.3"
}

test {
include '**/*Test.class'
exclude '**/net/sf/webdav/testutil/**/*Test.class'
}

String jettyArtifactVersion = 'jetty-6.1.14'
File jettyDistribution = new File(buildDir, jettyArtifactVersion)

libs {
archive_jar.enabled=true

jar(classifier: 'sources') {
fileSet(dir: 'src/main/java')
}

jar(classifier: 'javadoc') {
fileSet(dir: new File(buildDir, "docs/javadoc"))
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

archive_javadoc_jar.dependsOn('javadoc')

dists {
zip() {
String zipRoot = "$archivesBaseName-${project.version}"
zipFileSet(dir: new File(buildDir, jettyArtifactVersion), prefix: zipRoot)
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

archive_zip.doFirst() {
ant.unzip(src: new File("build-libs", jettyArtifactVersion+".zip"), dest: buildDir)

ant.delete(dir: new File(jettyDistribution, 'patches'))
ant.delete(dir: new File(jettyDistribution, 'modules'))
ant.delete(dir: new File(jettyDistribution, 'jxr'))
ant.delete(dir: new File(jettyDistribution, 'javadoc'))
ant.delete(dir: new File(jettyDistribution, 'extras'))
ant.delete(dir: new File(jettyDistribution, 'distribution'))
ant.delete(dir: new File(jettyDistribution, 'contrib'))
ant.delete(dir: new File(jettyDistribution, 'examples'))
ant.delete(dir: new File(jettyDistribution, 'contexts'))
ant.delete(dir: new File(jettyDistribution, 'webapps'))
ant.delete(file: new File(jettyDistribution, 'pom.xml'))
ant.delete(file: new File(jettyDistribution, 'README.txt'))
ant.delete(file: new File(jettyDistribution, 'VERSION.txt'))

ant.mkdir(dir: new File(jettyDistribution, 'contexts'))
ant.mkdir(dir: new File(jettyDistribution, 'webapps'))

ant.unzip(src: archive_war.archivePath, dest: new File(jettyDistribution, 'webapps/ROOT'))

ant.copy(file: 'src/main/scripts/start.sh', todir: jettyDistribution)
artifacts {
archives sourcesJar
archives javadocJar
}


jettyRun {
contextPath = '/'
scanIntervalSeconds = 2
useTestClasspath = true
connectors = configure(new org.mortbay.jetty.nio.SelectChannelConnector()) {
port = 8088
maxIdleTime = 60000
if (rootProject.hasProperty('uploadArchives.my.edu.clhs.baseRepositoryUrl')) {
uploadArchives {
ext.BASE_REPOSITORY_URL = getProperty('uploadArchives.my.edu.clhs.baseRepositoryUrl')
repositories {
mavenDeployer {
repository(url: "${BASE_REPOSITORY_URL}/release")
snapshotRepository(url: "${BASE_REPOSITORY_URL}/snapshot")
pom.whenConfigured { pom ->
pom.dependencies.removeAll { dep ->
dep.groupId == 'javax.servlet' && dep.artifactId == 'servlet-api'
}
}
}
}
}
}
}.doFirst { jettyRun ->
jettyRun.additionalRuntimeJars = dependencies.jettyRuntime.resolve() as List
}


createTask('android-webapp', dependsOn:'compile') {
File generatedClasses = new File(buildDir, 'generated-classes')
def webappClassPath = dependencies.resolve("compile");
def excludeArtifacts = ['servlet-api'];
webappClassPath.each {jarFile ->
excludeArtifacts.each {excludeArtifact ->
if (jarFile.toString().indexOf(excludeArtifact) == -1) {
ant.unzip(src: jarFile, dest: generatedClasses)
}
}
}

File androidWebapp = new File(buildDir, 'android-webapp/exploded')
androidWebapp.mkdirs();
File androidWebAppLib = new File(androidWebapp, "WEB-INF/lib");
androidWebAppLib.mkdirs();

String dxPath = System.getProperty("dxTool");
String argument1 = '--dex'
String argument2 = '--core-library'
String argument3 = '--output='+new File(androidWebAppLib, "classes.zip").getAbsolutePath();
String argument4 = '--positions=lines'
String argument5 = new File(buildDir, "classes").getAbsolutePath();
String argument6 = new File(buildDir, "generated-classes").getAbsolutePath();

def command = """${dxPath} ${argument1} ${argument2} ${argument3} ${argument4} ${argument5} ${argument6}"""// Create the String
println command
def proc = command.execute()
proc.waitFor()

ant.copy(file: 'src/main/webapp/WEB-INF/web.xml', todir: new File(androidWebapp, "WEB-INF"))
ant.war(destfile: new File(buildDir, "android-webapp/webdav-servlet.war"), basedir: androidWebapp, webxml: 'src/main/webapp/WEB-INF/web.xml')


}
task wrapper(type: Wrapper)
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon Feb 03 21:09:06 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
Loading