Skip to content
Browse files

[MIN] XQuery, doc(): error message for empty databases revised

  • Loading branch information...
1 parent d4abedd commit 19ec02f7f7f885c751787b173e64cac456174f1b @ChristianGruen ChristianGruen committed Nov 14, 2012
View
2 src/main/java/org/basex/query/QueryResources.java
@@ -289,8 +289,6 @@ private DBNode doc(final Data dt, final QueryInput qi, final InputInfo info)
// get all document nodes of the specified database
final IntList docs = dt.resources.docs(qi.path);
- // specified document was not found...
- if(docs.isEmpty()) WHICHRES.thrw(info, qi.original);
// ensure that a single document was filtered
if(docs.size() != 1) BXDB_SINGLE.thrw(info, qi.original);
return new DBNode(dt, docs.get(0), Data.DOC);
View
2 src/main/java/org/basex/query/func/FNDb.java
@@ -627,7 +627,7 @@ private Item rename(final QueryContext ctx) throws QueryException {
final int pre = il.get(i);
final String trg = Rename.target(data, pre, source, target);
if(trg.isEmpty() || trg.endsWith("/") || trg.endsWith("."))
- BXDB_EMPTY.thrw(info, this);
+ BXDB_RENAME.thrw(info, this);
ctx.updates.add(new ReplaceValue(pre, data, info, token(trg)), ctx);
}
// rename files
View
104 src/main/java/org/basex/query/regex/parse/RegExParser.java
@@ -1,3 +1,4 @@
+/* Generated By:JavaCC: Do not edit this line. RegExParser.java */
package org.basex.query.regex.parse;
import static org.basex.query.util.Err.*;
@@ -12,12 +13,11 @@
import static org.basex.util.Token.*;
import static java.util.regex.Pattern.*;
-/**
- * A parser for XSD regular expressions.
- * Manually modified to speed up parsing.
- *
- * @author BaseX Team 2005-12, BSD License
- * @author Leo Woerteler
+/**
+ * A parser for XSD regular expressions.
+ *
+ * @author BaseX Team 2005-12, BSD License
+ * @author Leo Woerteler
*/
@SuppressWarnings("all")
public class RegExParser implements RegExParserConstants {
@@ -34,17 +34,17 @@
/** Case-insensitive match. */
private boolean noCase;
- /**
- * Compiles this regular expression to a {@link Pattern}.
- * @param mod modifiers
- * @param ext XQuery 3.0 syntax
- * @param ii input info
- * @return the pattern
- * @throws QueryException query exception
+ /**
+ * Compiles this regular expression to a {@link Pattern}.
+ * @param mod modifiers
+ * @param ext XQuery 3.0 syntax
+ * @param ii input info
+ * @return the pattern
+ * @throws QueryException query exception
*/
public static Pattern parse(final byte[] regex, final byte[] mod, final boolean ext,
final InputInfo ii) throws QueryException {
- // process modifiers
+ // process modifiers
int m = Pattern.UNIX_LINES;
boolean strip = false;
final boolean dotAll = false, multi = false;
@@ -59,7 +59,7 @@ public static Pattern parse(final byte[] regex, final byte[] mod, final boolean
}
}
- // no need to change anything
+ // no need to change anything
if((m & LITERAL) != 0) return Pattern.compile(string(regex), m);
try {
@@ -73,12 +73,12 @@ public static Pattern parse(final byte[] regex, final byte[] mod, final boolean
}
}
- /**
- * Constructor.
- * @param regex regular expression to parse
- * @param strip strip whitespace while lexing
- * @param all dot matches all
- * @param ci case insensitivity
+ /**
+ * Constructor.
+ * @param regex regular expression to parse
+ * @param strip strip whitespace while lexing
+ * @param all dot matches all
+ * @param ci case insensitivity
*/
public RegExParser(final byte[] regex, final boolean strip, final boolean all,
final boolean multi, final boolean ci) {
@@ -97,8 +97,8 @@ final public RegExp parse() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "regExp" rule.
+ /**
+ * Parses the "regExp" rule.
*/
final public RegExp regExp() throws ParseException {
RegExp nd;
@@ -126,9 +126,9 @@ final public RegExp regExp() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "branch" rule.
- * Parses the "piece" rule.
+ /**
+ * Parses the "branch" rule.
+ * Parses the "piece" rule.
*/
final public RegExp branch() throws ParseException {
RegExp atom;
@@ -177,8 +177,8 @@ final public RegExp branch() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "quantifier" rule.
+ /**
+ * Parses the "quantifier" rule.
*/
final public Quantifier quantifier() throws ParseException {
int min = 0, max = 0;
@@ -221,11 +221,11 @@ final public Quantifier quantifier() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "quantity" rule.
- * Parses the "quantRange" rule.
- * Parses the "quantMin" rule.
- * Parses the "quantExact" rule.
+ /**
+ * Parses the "quantity" rule.
+ * Parses the "quantRange" rule.
+ * Parses the "quantMin" rule.
+ * Parses the "quantExact" rule.
*/
final public int[] quantity() throws ParseException {
final int[] qty = new int[2];
@@ -255,8 +255,8 @@ final public Quantifier quantifier() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "atom" rule.
+ /**
+ * Parses the "atom" rule.
*/
final public RegExp atom() throws ParseException {
RegExp nd = null;
@@ -300,8 +300,8 @@ final public RegExp atom() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "Char" rule.
+ /**
+ * Parses the "Char" rule.
*/
final public Literal Char() throws ParseException {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
@@ -320,8 +320,8 @@ final public Literal Char() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "backReference" rule.
+ /**
+ * Parses the "backReference" rule.
*/
final public BackRef backReference() throws ParseException {
Token tok;
@@ -343,8 +343,8 @@ final public BackRef backReference() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "charClass" rule.
+ /**
+ * Parses the "charClass" rule.
*/
final public RegExp charClass() throws ParseException {
RegExp nd = null;
@@ -378,8 +378,8 @@ final public RegExp charClass() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "charClassEsc" rule.
+ /**
+ * Parses the "charClassEsc" rule.
*/
final public RegExp charClassEsc() throws ParseException {
switch (jj_ntk==-1?jj_ntk():jj_ntk) {
@@ -403,9 +403,9 @@ final public RegExp charClassEsc() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "charClassExpr" rule.
- * Parses the "charClassSub" rule.
+ /**
+ * Parses the "charClassExpr" rule.
+ * Parses the "charClassSub" rule.
*/
final public CharClass charClassExpr() throws ParseException {
CharGroup group = null;
@@ -440,8 +440,8 @@ final public CharClass charClassExpr() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "posCharGroup" rule.
+ /**
+ * Parses the "posCharGroup" rule.
*/
final public CharGroup posCharGroup() throws ParseException {
final ArrayList<RegExp> cg = new ArrayList<RegExp>();
@@ -489,8 +489,8 @@ final public CharGroup posCharGroup() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "charRange" rule.
+ /**
+ * Parses the "charRange" rule.
*/
final public RegExp charRange() throws ParseException {
int a = -1, b = -1;
@@ -516,8 +516,8 @@ final public RegExp charRange() throws ParseException {
throw new Error("Missing return statement in function");
}
- /**
- * Parses the "charOrEsc" rule.
+ /**
+ * Parses the "charOrEsc" rule.
*/
final public int charOrEsc() throws ParseException {
int cp = -1;
View
4 src/main/java/org/basex/query/util/Err.java
@@ -70,12 +70,10 @@
BXDB_DBRETURN(BXDB, 5, "Query must yield database nodes."),
/** BXDB0006. */
BXDB_SINGLE(BXDB, 6, "Database path '%' must point to a single document."),
- /** BXDB0006. */
- BXDB_DOCS(BXDB, 6, "Database path '%' must point to documents."),
/** BXDB0007. */
BXDB_OPENED(BXDB, 7, "Database '%' is opened by another process."),
/** BXDB0008. */
- BXDB_EMPTY(BXDB, 8, "%: Invalid target path."),
+ BXDB_RENAME(BXDB, 8, "%: Invalid target path."),
/** BXDB0009. */
BXDB_RANGE(BXDB, 9, "%: value '%' is out of range."),
/** BXDB0010. */

0 comments on commit 19ec02f

Please sign in to comment.
Something went wrong with that request. Please try again.