Compilation issue with JDBC under Apache Ant - oracle

I am using the following specification for JDBC compilations using Ant.
<sql driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:#10.184.133.133:1521:SUPP"
userid="${UsernameB}"
password="${PasswordB}"
onerror="continue"
delimitertype="row"
delimiter="/"
keepformat="yes">
The delimiter here is slash (/). If there are spaces after the slash the compilation is not happening properly. Is there any way I can avoid this situation?

I assume you mean that if you have a space after the slashes separating the SQL statements it won't compile?
I suggest you add
strictDelimiterMatching="false"
which force recognition of the delimiter to be case-insensitive (which is irrelevant here) and to ignore surrounding whitespace.

Related

Is ./*/ portable?

I often use ./*/ in a for loop like
for d in ./*/; do
: # do something with dirs
done
to match all non-hidden directories in current working directory, but I'm not really sure if this is a portable way to do that. I have bash, dash and ksh installed on my system and it works with all, but since POSIX spec doesn't say anything about it (or it says implicitly, and I missed it) I think I can't rely on it. I also checked POSIX bug reports, but to no avail, there's no mention of it there as well.
Is its behaviour implementation or filesystem dependent? Am I missing something here? How do I know if it's portable or not?
Short answer: YES
Long Answer:
The POSIX standard (from opengroup) states that / will only match slashes in the expanded file name. Since Unix/Linux does not allow / in the file name, I believe that this is a safe assumption on Unix/Linux systems.
From the bolded text below, it seems that even for systems that will allow / in the file name, the POSIX standard require that / will not be matched to such file.
On Windows, looks like / is not allowed in the file name, but I'm not an expert on Windows.
From Shell Programming Language § Patterns Used for Filename Expansion:
The slash character in a pathname shall be explicitly matched by using one or more slashes in the pattern; it shall neither be matched by the asterisk or question-mark special characters nor by a bracket expression. Slashes in the pattern shall be identified before bracket expressions; thus, a slash cannot be included in a pattern bracket expression used for filename expansion.
...
Additional Note - clarifying pathname:
The pathname is defined in 4.13, with explicit reference to pathname with trailing slash in General Concepts § Pathname Resolution.
A pathname that contains at least one non-<slash> character and that ends with one or more trailing <slash> characters shall not be resolved successfully unless the last pathname component before the trailing <slash> characters names an existing directory or a directory entry that is to be created for a directory immediately after the pathname is resolved. Interfaces using pathname resolution may specify additional constraints when a pathname that does not name an existing directory contains at least one non-<slash> character and contains one or more trailing <slash> characters.

How to use inline code with a trailing whitespace?

When I use
``# ``
in my Sphinx documentation I get the following warning:
WARNING: Inline literal start-string without end-string.
Trying
:samp:`# `
leads to
WARNING: Inline interpreted text or phrase reference start-string without end-string.
The problem seems to be the trailing whitespace however I couldn't figure out a way of getting around this problem. Escaping the whitespace with a backslash (\) doesn't help either (for the first example the warning persists and for the second example the whitespace is omitted in the generated docs).
This answer doesn't work because the inline code section interprets the |space| as a literal string.
Experienced with Sphinx 1.6.2.
A workaround is to use a no-break space character (U+00A0) instead of a regular space (U+0020) for the trailing whitespace.
There are several ways to insert a literal no-break space character. See https://en.wikipedia.org/wiki/Non-breaking_space#Keyboard_entry_methods.
Use a "literal" role__ with an escaped space after the intended trailing space::
:literal:`# \ `
__https://docutils.sourceforge.io/docs/ref/rst/roles.html#literal

How to Make Maven Surefire Plugin Include Regex not Match a Specific Prefix?

I'm trying to let maven-surefire-plugin only run all the tests fulfilling following conditions:
Match the pattern *Test.java, but NOT *SomeTest.java;
OR match the pattern *AnotherSomeTest.java.
Is there any way to achieve this?
I've already tried the include string:
**/*Test.java, !%regex[.*(?!Another)SomeTest.*]
however this does not work.
There are several solutions possible using a regular expression. The simplest one is having the configuration
<includes>
<include>*AnotherSomeTest.java</include>
<include>%regex[.*(?<!Some)Test\.class]</include>
</includes>
This will match tests where the class name ends either with AnotherSomeTest, or with Test but not preceded by Some (the negative lookbehind < just needs to be properly escaped with <). Note that the regular expression match is done over the .class file, while the traditional one is done over the .java file.
You could put this into a single regular expression, with
<include>%regex[.*(?<!(?<!Another)Some)Test\.class]</include>
which selects all tests ending with Test, not preceded by Some themselves not preceded by Another, although it's probably not clearer.
Another alternative is to use multiple formats into one, that works since version 2.19 of the plugin and JUnit 4 or TestNG. This is useful for the command line notably:
<include>%regex[.*(?<!Some)Test\.class], *AnotherSomeTest.java</include>

Jdbc compilation using Ant

I am using the following ant script for jdbc compilations.
<sql driver="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:#10.184.133.133:1521:SUPP"
userid="${UsernameB}"
password="${PasswordB}"
onerror="continue"
delimitertype="row"
delimiter="/"
keepformat="yes">
I have a file with the following content:
create OR REPLACE synonym CIVWS for CIVW;
/
compilation of the above is failing with the following error.
java.sql.SQLSyntaxErrorException: ORA-00911: invalid character
I understand that the delimiter is / and hence the semi colon after the sql statement has caused the issue. There are hundreds of files like this, all will compile properly in sqlplus. However fail with jdbc. I cant change the code now. Is there any work around for this. I cant change the delimiter to ; also. Please suggest.
first you could try to use ... delimiter=";" delimitertype="row" ... and make sure that the pl/sql blocks containing ";"s are separated by some ";" on a single line (with only a newline following it immediately - thus triggering the execution of it as a single statement).
if you can't add the ";" by hand, try to copy the source files to some tmp dir and try to change them there by hand or by some automated regexp replacement (e.g. using ant copy task with a regexp replace filter).
(e.g. replacing lines matching ^(.*end\s*;?)(.*)$ by \1\n;\n\2 could be enough if you are lucky)
another solution for inserting the ";"-single line delimiters could be to put these blocks in separate files (maybe automated) and execute them via the <sql><transaction src="<yoursqlfile>.sql" /> <!--...--> </sql> <!--...-->" ANT task.

make exits with error due to a special character in the filename

We're generating make files for our source files and one of these files happens to have a '#' in its name.
The dependency statement in the make file looks like this:
./obj/abc/def#ghi.o: ./src/abc/def#ghi.pli
...
Which results in error:
Zeile 15: make: 1254-055 Abhängigkeitszeilen erfordern einen Doppelpunkt oder doppelten Doppelpunkt als Operator.
I tried to escape the '#' but neither single quotes, double quotes, one backslash or 2 backslashes work. Is there a way to fix this without renaming the file?
I'm afraid you're out of luck, especially with the AIX version of make.
The AIX Make documentation is here, and doesn't mention any way of escaping the # character.
The GNU Make documentation here mentions that it's possible:
If you want a literal #, escape it with a backslash (e.g., \#).
Comments may appear on any line in the makefile, although they
are treated specially in certain situations.
Is there any reason that you can't build GNU Make for AIX and use it instead of the AIX make?

Resources