Skip to content

Commit

Permalink
absent option --rootdir corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Heinecke committed Jun 4, 2023
1 parent e405996 commit ae49f58
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changes

## Version 2.22.3
* bug concerning --rootdir corrected

## Version 2.22.2
* MISC shortcut correction, `mod addmisc` added
* new test
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM openjdk:17-alpine

ARG VERSION=2.22.0
# docker build --build-arg 2.22.0 -t jheinecke/conllueditor:2.22.0 .
# docker build --build-arg 2.22.0 -t jheinecke/conllueditor:latest .
ARG VERSION=2.22.3
# docker build --build-arg 2.22.3 -t jheinecke/conllueditor:2.22.3 .
# docker build --build-arg 2.22.3 -t jheinecke/conllueditor:latest .
# docker run -t --rm --name conllueditor -p 5555:5555 --user 1000:1000 -v </absolute/path/to/datadir>:/data --env filename=tt.conllu jheinecke/conllueditor:latest
# docker push jheinecke/conllueditor:2.22.0
# docker push jheinecke/conllueditor:2.22.3
# docker push jheinecke/conllueditor:latest

# docker exec -it conllueditor /bin/sh
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The editor provides the following functionalities:
* adding Translit= values to the MISC column (transliterating the FORM column) see section [Transliteration](#transliteration)
* finding similar or identical sentence in a list of CoNLL-U files, see section [Find Similar Sentences](#find-similar-sentences)

Current version: 2.22.2 (see [change history](CHANGES.md))
Current version: 2.22.3 (see [change history](CHANGES.md))

ConlluEditor can also be used as front-end to display the results of dependency parsing in the same way as the editor.
* dependency tree/dependency hedge
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
author Johannes Heinecke
version 2.22.2 as of 22nd May 2023
version 2.22.3 as of 4th June 2023
-->

<modelVersion>4.0.0</modelVersion>
<groupId>com.orange.labs</groupId>
<artifactId>ConlluEditor</artifactId>
<version>2.22.2</version>
<version>2.22.3</version>
<packaging>jar</packaging>

<properties>
Expand Down
20 changes: 14 additions & 6 deletions src/main/java/com/orange/labs/httpserver/ServeurHTTP.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** This library is under the 3-Clause BSD License
Copyright (c) 2018-2021, Orange S.A.
Copyright (c) 2018-2023, Orange S.A.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -28,7 +28,7 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@author Johannes Heinecke
@version 2.10.0 as of 10th January 2021
@version 2.22.3 as of 4th June 2023
*/
package com.orange.labs.httpserver;

Expand Down Expand Up @@ -105,14 +105,17 @@ public ServeurHTTP(int port, /*ConlluEditor */ Object e, String rootdir, int deb
HttpServer server = HttpServer.create(new InetSocketAddress(this.port), 0);

String indexhtml = null;
String indexjs = null;
if (e instanceof ConlluEditor) {
ce = (ConlluEditor) e;
server.createContext("/edit/", new EditHandler(ce));
indexhtml = "index.html";
indexjs = "edit.js";
} else if (e instanceof ParserClient) {
pc = (ParserClient) e;
server.createContext("/parse/", new ParseHandler(pc));
indexhtml = "parse.html";
indexjs = "parse.js";
} else {
System.err.println("Bad Context: " + e);
System.exit(11);
Expand All @@ -128,18 +131,23 @@ public ServeurHTTP(int port, /*ConlluEditor */ Object e, String rootdir, int deb
s = URLDecoder.decode(s, "UTF-8");
rootdir = s;
System.err.println("calculated rootdir from .jar: " + s);
}

if (rootdir != null) {
} else {
Path rdir = new File(rootdir).toPath();
if (!Files.exists(rdir)) {
throw new IOException(rootdir + " does not exist");
}
if (!Files.isDirectory(rdir)) {
throw new IOException(rootdir + " is not a directory");
}
server.createContext("/", new FileHandler(rootdir, indexhtml));
if (!Files.exists(new File(rootdir, indexhtml).toPath())) {
throw new IOException(rootdir + " does contain '" + indexhtml + "'");
}
if (!Files.exists(new File(rootdir, indexjs).toPath())) {
throw new IOException(rootdir + " does contain '" + indexjs + "'");
}
}

server.createContext("/", new FileHandler(rootdir, indexhtml));
server.setExecutor(null);

String hostname = "localhost";
Expand Down

2 comments on commit ae49f58

@jerekupari
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the new release zip is missing the .jar from target/.

And, I haven't read java in 20 years, but should " does contain '" read " does not contain '"

@jheinecke
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! I did this too rapidly. It has been corrected and the release is complete as well. Thanks!

Please sign in to comment.