mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-01 14:41:46 +00:00
REPO-4969: -merge branch 'master' into support/SP/8.50.N
This commit is contained in:
72
pom.xml
72
pom.xml
@@ -27,8 +27,8 @@
|
||||
</distributionManagement>
|
||||
|
||||
<properties>
|
||||
<dependency.alfresco-core.version>7.26</dependency.alfresco-core.version>
|
||||
<dependency.cxf.version>3.3.2</dependency.cxf.version>
|
||||
<dependency.alfresco-core.version>7.27</dependency.alfresco-core.version>
|
||||
<dependency.cxf.version>3.3.5</dependency.cxf.version>
|
||||
<!-- Files to exclude from SonarQube analysis -->
|
||||
<sonar.exclusions>
|
||||
source/java/org/alfresco/repo/search/impl/parsers/CMIS*er.java,
|
||||
@@ -83,7 +83,7 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -171,7 +171,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcmail-jdk15on</artifactId>
|
||||
<version>1.62</version>
|
||||
<version>1.64</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
@@ -189,7 +189,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>28.0-jre</version>
|
||||
<version>28.2-jre</version>
|
||||
</dependency>
|
||||
<!-- upgrade dependency from TIKA -->
|
||||
<dependency>
|
||||
@@ -201,7 +201,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>2.0.15</version>
|
||||
<version>2.0.17</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
@@ -228,19 +228,12 @@
|
||||
<dependency>
|
||||
<groupId>org.jibx</groupId>
|
||||
<artifactId>jibx-run</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>1.3.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>2.9.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>2.9.9</version>
|
||||
<version>2.10.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -249,17 +242,6 @@
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
<!-- the cxf libs were updated, see dependencyManagement section -->
|
||||
<dependency>
|
||||
<groupId>org.apache.chemistry.opencmis</groupId>
|
||||
<artifactId>chemistry-opencmis-client-impl</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.chemistry.opencmis</groupId>
|
||||
<artifactId>chemistry-opencmis-commons-impl</artifactId>
|
||||
@@ -282,16 +264,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.woodstox</groupId>
|
||||
<artifactId>woodstox-core-asl</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
<!-- This is now deployed at:
|
||||
| http://artifacts.alfresco.com/nexus/content/repositories/thirdparty/org/acegisecurity/acegi-security/0.8.2_patched/
|
||||
-->
|
||||
@@ -308,12 +280,7 @@
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.11.0-alfresco-patched-20180402</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xpp3</groupId>
|
||||
<artifactId>xpp3</artifactId>
|
||||
<version>1.1.3_8</version>
|
||||
<version>2.12.0-alfresco-patched-20191004</version>
|
||||
</dependency>
|
||||
<!-- Tika -->
|
||||
<dependency>
|
||||
@@ -340,27 +307,12 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gagravarr</groupId>
|
||||
<artifactId>vorbis-java-core</artifactId>
|
||||
<version>0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gagravarr</groupId>
|
||||
<artifactId>vorbis-java-tika</artifactId>
|
||||
<version>0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.juniversalchardet</groupId>
|
||||
<artifactId>juniversalchardet</artifactId>
|
||||
<version>1.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<version>4.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -371,8 +323,8 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>1.10.19</version>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2005-2015 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
@@ -511,13 +511,22 @@ boost
|
||||
|
||||
ftsTermOrPhrase
|
||||
:
|
||||
(fieldReference COLON) => fieldReference COLON
|
||||
(fieldReferenceWithPrefix COLON) => fieldReferenceWithPrefix COLON
|
||||
(
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
-> ^(PHRASE FTSPHRASE fieldReference slop?)
|
||||
-> ^(PHRASE FTSPHRASE fieldReferenceWithPrefix slop?)
|
||||
|
|
||||
ftsWord ((fuzzy) => fuzzy)?
|
||||
-> ^(TERM ftsWord fieldReference fuzzy?)
|
||||
-> ^(TERM ftsWord fieldReferenceWithPrefix fuzzy?)
|
||||
)
|
||||
|
|
||||
(fieldReferenceWithoutPrefix COLON) => fieldReferenceWithoutPrefix COLON
|
||||
(
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
-> ^(PHRASE FTSPHRASE fieldReferenceWithoutPrefix slop?)
|
||||
|
|
||||
ftsWord ((fuzzy) => fuzzy)?
|
||||
-> ^(TERM ftsWord fieldReferenceWithoutPrefix fuzzy?)
|
||||
)
|
||||
|
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
@@ -532,13 +541,22 @@ ftsExactTermOrPhrase
|
||||
:
|
||||
EQUALS
|
||||
(
|
||||
(fieldReference COLON) => fieldReference COLON
|
||||
(fieldReferenceWithPrefix COLON) => fieldReferenceWithPrefix COLON
|
||||
(
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
-> ^(EXACT_PHRASE FTSPHRASE fieldReference slop?)
|
||||
-> ^(EXACT_PHRASE FTSPHRASE fieldReferenceWithPrefix slop?)
|
||||
|
|
||||
ftsWord ((fuzzy) => fuzzy)?
|
||||
-> ^(EXACT_TERM ftsWord fieldReference fuzzy?)
|
||||
-> ^(EXACT_TERM ftsWord fieldReferenceWithPrefix fuzzy?)
|
||||
)
|
||||
|
|
||||
(fieldReferenceWithoutPrefix COLON) => fieldReferenceWithoutPrefix COLON
|
||||
(
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
-> ^(EXACT_PHRASE FTSPHRASE fieldReferenceWithoutPrefix slop?)
|
||||
|
|
||||
ftsWord ((fuzzy) => fuzzy)?
|
||||
-> ^(EXACT_TERM ftsWord fieldReferenceWithoutPrefix fuzzy?)
|
||||
)
|
||||
|
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
@@ -554,13 +572,22 @@ ftsTokenisedTermOrPhrase
|
||||
:
|
||||
TILDA
|
||||
(
|
||||
(fieldReference COLON) => fieldReference COLON
|
||||
(fieldReferenceWithPrefix COLON) => fieldReferenceWithPrefix COLON
|
||||
(
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
-> ^(PHRASE FTSPHRASE fieldReference slop?)
|
||||
-> ^(PHRASE FTSPHRASE fieldReferenceWithPrefix slop?)
|
||||
|
|
||||
ftsWord ((fuzzy) => fuzzy)?
|
||||
-> ^(TERM ftsWord fieldReference fuzzy?)
|
||||
-> ^(TERM ftsWord fieldReferenceWithPrefix fuzzy?)
|
||||
)
|
||||
|
|
||||
(fieldReferenceWithoutPrefix COLON) => fieldReferenceWithoutPrefix COLON
|
||||
(
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
-> ^(PHRASE FTSPHRASE fieldReferenceWithoutPrefix slop?)
|
||||
|
|
||||
ftsWord ((fuzzy) => fuzzy)?
|
||||
-> ^(TERM ftsWord fieldReferenceWithoutPrefix fuzzy?)
|
||||
)
|
||||
|
|
||||
FTSPHRASE ((slop)=> slop)?
|
||||
@@ -772,18 +799,26 @@ range_right
|
||||
-> EXCLUSIVE
|
||||
;
|
||||
|
||||
/* Need to fix the generated parser for extra COLON check ??*/
|
||||
|
||||
fieldReference
|
||||
:
|
||||
fieldReferenceWithPrefix
|
||||
| fieldReferenceWithoutPrefix;
|
||||
|
||||
fieldReferenceWithoutPrefix
|
||||
:
|
||||
AT?
|
||||
(
|
||||
(prefix) => prefix
|
||||
| uri
|
||||
)?
|
||||
uri?
|
||||
identifier
|
||||
->
|
||||
^(FIELD_REF identifier prefix? uri?)
|
||||
^(FIELD_REF identifier uri?)
|
||||
;
|
||||
|
||||
fieldReferenceWithPrefix
|
||||
:
|
||||
AT?
|
||||
prefix identifier
|
||||
->
|
||||
^(FIELD_REF identifier prefix)
|
||||
;
|
||||
|
||||
tempReference
|
||||
@@ -1340,7 +1375,7 @@ ID
|
||||
( '0'..'9' | '$' | '#' | F_ESC )*
|
||||
)?
|
||||
( 'a'..'z' | 'A'..'Z' | '_' )
|
||||
( 'a'..'z' | 'A'..'Z' | '0'..'9' | '_' | '$' | '#' | F_ESC )*
|
||||
( 'a'..'z' | 'A'..'Z' | '0'..'9' | '-' | '_' | '$' | '#' | F_ESC )*
|
||||
;
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,46 @@
|
||||
# Antlr Grammars
|
||||
|
||||
The grammar files in this package (e.g. `FTS.g`) are written using the Antlr 3 syntax.
|
||||
The java lexer and parser files are generated from the grammar files, along with the files
|
||||
containing the tokens.
|
||||
|
||||
The easiest way to make changes to the grammar files is by using
|
||||
[AntlrWorks 1.5](https://www.antlr3.org/download.html). This can be used to step through the
|
||||
evaluations made while parsing troublesome input, and can help visualise the resulting
|
||||
decision tree. AntlrWorks includes a menu option to compile the grammar, and will generate
|
||||
replacements for the existing files.
|
||||
|
||||
AntlrWorks will fail to parse the grammar file if it contains references to unknown classes
|
||||
(for example FTS.g contains references to MismatchedTokenException and FTSQueryException).
|
||||
To work around this issue then temporarily replace these exceptions with RuntimeExceptions.
|
||||
Once changes to the grammar have been completed then these can either be manually fixed in
|
||||
the generated output or compilation can be done via the command line. This requires the
|
||||
[antlr jar](http://www.antlr3.org/download/antlr-3.5.2-complete-no-st3.jar) to be downloaded:
|
||||
```bash
|
||||
java -jar ~/Downloads/antlr-3.5.2-complete-no-st3.jar -o . src/main/java/org/alfresco/repo/search/impl/parsers/FTS.g
|
||||
```
|
||||
|
||||
For some grammars then Antlr generates Java files that cannot be compiled due to the
|
||||
64KB limit on methods. Attempting to compile this code will result in the error "Code too
|
||||
large". In particular this is true of [FTS.g](FTS.g). To work around this issue then once
|
||||
the code has been generated using Antlr it must be refactored to ensure no single method is
|
||||
too large. For example, in [FTSParser.java](FTSParser.java) several larger blocks of code
|
||||
have been manually extracted to smaller methods that look like:
|
||||
```java
|
||||
private int specialStateTransition7(int LA17_9)
|
||||
{
|
||||
int s;
|
||||
s = -1;
|
||||
if ( (LA17_9==STAR) ) {s = 25;}
|
||||
else if ( (LA17_9==DOTDOT) && (synpred3_FTS())) {s = 27;}
|
||||
else if ( (LA17_9==COMMA||LA17_9==DOT) && (synpred5_FTS())) {s = 28;}
|
||||
...
|
||||
else if ( (LA17_9==MINUS) && (synpred5_FTS())) {s = 57;}
|
||||
return s;
|
||||
}
|
||||
```
|
||||
|
||||
To verify the grammar behaves how we expect then there are unit tests in
|
||||
`org.alfresco.repo.search.impl.parsers`. These use gunit files to specify expected input and
|
||||
output pairs for different entry points in the grammar. More details about guint file can
|
||||
be found on the [Antlr 3 wiki](https://theantlrguy.atlassian.net/wiki/spaces/ANTLR3/pages/2687338/gUnit+-+Grammar+Unit+Testing).
|
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
package org.alfresco.util;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -37,11 +36,13 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.jar.JarEntry;
|
||||
@@ -81,7 +82,7 @@ public abstract class ConfigFileFinder
|
||||
AtomicBoolean somethingRead = new AtomicBoolean(false);
|
||||
|
||||
// Try reading resources in a jar
|
||||
final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI());
|
||||
if (jarFile.isFile())
|
||||
{
|
||||
readFromJar(jarFile, path, log, successReadingConfig, somethingRead);
|
||||
@@ -89,11 +90,15 @@ public abstract class ConfigFileFinder
|
||||
else
|
||||
{
|
||||
// Try reading resources from disk
|
||||
URL url = getClass().getClassLoader().getResource(path);
|
||||
if (url != null)
|
||||
Iterator<URL> pathUrls = getClass().getClassLoader().getResources(path).asIterator();
|
||||
while(pathUrls.hasNext())
|
||||
{
|
||||
String urlPath = url.getPath();
|
||||
readFromDisk(urlPath, log, successReadingConfig, somethingRead);
|
||||
URL url = pathUrls.next();
|
||||
if (url != null)
|
||||
{
|
||||
String urlPath = url.getPath();
|
||||
readFromDisk(urlPath, log, successReadingConfig, somethingRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +113,7 @@ public abstract class ConfigFileFinder
|
||||
log.debug("No config read from "+path);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
catch (IOException | URISyntaxException e)
|
||||
{
|
||||
log.error("Error reading from "+path, e);
|
||||
successReadingConfig.set(false);
|
||||
@@ -203,7 +208,7 @@ public abstract class ConfigFileFinder
|
||||
boolean successReadingConfig = true;
|
||||
try
|
||||
{
|
||||
JsonNode jsonNode = jsonObjectMapper.readValue(reader, new TypeReference<JsonNode>() {});
|
||||
JsonNode jsonNode = jsonObjectMapper.readValue(reader, JsonNode.class);
|
||||
String readFromMessage = readFrom + ' ' + path;
|
||||
if (log.isTraceEnabled())
|
||||
{
|
||||
|
@@ -21,6 +21,8 @@ ftsQuery:
|
||||
"test_txt_woof" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM test_txt_woof))))"
|
||||
"test,txt,woof" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM test , txt , woof))))"
|
||||
"test\:txt\:woof" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM test\\:txt\\:woof))))"
|
||||
"name-dash:file" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM file (FIELD_REF name-dash)))))"
|
||||
"name-dash:file.txt" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM file . txt (FIELD_REF name-dash)))))"
|
||||
"+\++" -> "(DISJUNCTION (CONJUNCTION (MANDATORY (TERM \\++))))"
|
||||
".txt" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM . txt))))"
|
||||
"*.txt" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM * . txt))))"
|
||||
@@ -60,6 +62,7 @@ ftsQuery:
|
||||
"10" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM 10))))"
|
||||
"-10" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM -10))))"
|
||||
"cm_content.mimetype:\"text/plain\"" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (PHRASE \"text/plain\" (FIELD_REF cm_content.mimetype)))))"
|
||||
"name:file.txt" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM file . txt (FIELD_REF name)))))"
|
||||
"10.10.pdf" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM 10 . 10 . pdf))))"
|
||||
"TYPE:cm:content" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM content (FIELD_REF cm (PREFIX TYPE))))))"
|
||||
"TYPE:content" -> "(DISJUNCTION (CONJUNCTION (DEFAULT (TERM content (FIELD_REF TYPE)))))"
|
||||
@@ -190,8 +193,10 @@ ftsTest:
|
||||
|
||||
ftsTermOrPhrase:
|
||||
"name:woof" -> "(TERM woof (FIELD_REF name))"
|
||||
"name:woof.txt" -> "(TERM woof . txt (FIELD_REF name))"
|
||||
"cm_name:woof" -> "(TERM woof (FIELD_REF cm_name))"
|
||||
"cm:name:woof" -> "(TERM woof (FIELD_REF name (PREFIX cm)))"
|
||||
"content.mimetype:woof.txt" -> "(TERM woof . txt (FIELD_REF content.mimetype))"
|
||||
"{http://www.alfresco.org/model/content/1.0}name:woof" -> "(TERM woof (FIELD_REF name (NAME_SPACE {http://www.alfresco.org/model/content/1.0})))"
|
||||
"\"zebra\"" -> "(PHRASE \"zebra\")"
|
||||
"'zebra'" -> "(PHRASE 'zebra')"
|
||||
@@ -204,8 +209,10 @@ ftsTermOrPhrase:
|
||||
|
||||
ftsExactTermOrPhrase:
|
||||
"=name:woof" -> "(EXACT_TERM woof (FIELD_REF name))"
|
||||
"=name:woof.txt" -> "(EXACT_TERM woof . txt (FIELD_REF name))"
|
||||
"=cm_name:woof" -> "(EXACT_TERM woof (FIELD_REF cm_name))"
|
||||
"=cm:name:woof" -> "(EXACT_TERM woof (FIELD_REF name (PREFIX cm)))"
|
||||
"=content.mimetype:woof.txt" -> "(EXACT_TERM woof . txt (FIELD_REF content.mimetype))"
|
||||
"={http://www.alfresco.org/model/content/1.0}name:woof" -> "(EXACT_TERM woof (FIELD_REF name (NAME_SPACE {http://www.alfresco.org/model/content/1.0})))"
|
||||
|
||||
|
||||
@@ -213,8 +220,10 @@ ftsExactTermOrPhrase:
|
||||
ftsTokenisedTermOrPhrase:
|
||||
"~woof" -> "(TERM woof)"
|
||||
"~name:woof" -> "(TERM woof (FIELD_REF name))"
|
||||
"~name:woof.txt" -> "(TERM woof . txt (FIELD_REF name))"
|
||||
"~cm_name:woof" -> "(TERM woof (FIELD_REF cm_name))"
|
||||
"~cm:name:woof" -> "(TERM woof (FIELD_REF name (PREFIX cm)))"
|
||||
"~content.mimetype:woof.txt" -> "(TERM woof . txt (FIELD_REF content.mimetype))"
|
||||
"~{http://www.alfresco.org/model/content/1.0}name:woof" -> "(TERM woof (FIELD_REF name (NAME_SPACE {http://www.alfresco.org/model/content/1.0})))"
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user