Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 07107aa

Browse files
committedMay 21, 2012
Code formatting: disallow multi-line C-style comments /* ... */.
git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@534 c6a108a4-781c-0410-a6c6-c2d559e19af0
1 parent 54664d0 commit 07107aa

13 files changed

+318
-409
lines changed
 

‎checkFile.awk

+3
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ FNR < headerCount {
197197
# beginning of multiline comment "/*"
198198
inComment = 1;
199199
gsub(/\/\*.*$/, "/* comment */", s);
200+
if (strict > 0 && FNR > 1 && $0 !~ /\/\*\*/) {
201+
error(fname, FNR, "Multi-line c-style comment not allowed");
202+
}
200203
} else {
201204
# mask out /* */ comments
202205
gsub(/\/\*.*\*\//, "/* comment */", s);

‎checkFile.sh

+22-8
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ doCheck() {
161161
else
162162
gawk -f "$CHECKFILE_AWK" \
163163
-v fname="$filePath" \
164-
-v lenient="$lenient" \
164+
-v strict="$strict" \
165165
-v maxLineLength="$maxLineLength" \
166166
"$file"
167167
fi
@@ -172,12 +172,23 @@ doCheckDeferred() {
172172
maxLineLength=80
173173
cat "${deferred_file}" |
174174
xargs gawk -f "$CHECKFILE_AWK" \
175-
-v lenient="$lenient" \
175+
-v strict="$strict" \
176176
-v maxLineLength="$maxLineLength"
177177
fi
178178
rm -f "${deferred_file}"
179179
}
180180

181+
function guessCoreCount() {
182+
if [ -f /proc/cpuinfo ]; then
183+
cat /proc/cpuinfo | awk '$1 == "processor"' | wc -l
184+
else
185+
# File doe not exist on Darwin or cygwin
186+
echo 2
187+
fi
188+
}
189+
190+
export CORE_COUNT=$(guessCoreCount)
191+
181192
export deferred=true
182193

183194
# 'test' is an undocumented flag, overriding the default behavior which is
@@ -188,9 +199,9 @@ if [ "$1" == --test ]; then
188199
shift
189200
fi
190201

191-
lenient=
202+
strict=1
192203
if [ "$1" == --lenient ]; then
193-
lenient=true
204+
strict=0
194205
shift
195206
fi
196207

@@ -199,9 +210,8 @@ if [ "$1" == --help ]; then
199210
exit 0
200211
fi
201212

202-
strict=
203213
if [ "$1" == --strict ]; then
204-
strict=true
214+
strict=2
205215
shift
206216
fi
207217

@@ -240,7 +250,12 @@ fi
240250

241251
if [ ! -f "$CHECKFILE_AWK" ]
242252
then
243-
export CHECKFILE_AWK="$(dirname $(readlink -f $0))/checkFile.awk"
253+
case $(uname) in
254+
(Darwin)
255+
export CHECKFILE_AWK="$(cd $(dirname $0); pwd -P)/checkFile.awk";;
256+
(*)
257+
export CHECKFILE_AWK="$(dirname $(readlink -f $0))/checkFile.awk";;
258+
esac
244259
fi
245260

246261
export deferred_file=/tmp/checkFile_deferred_$$.txt
@@ -282,7 +297,6 @@ status=0
282297
if [ -s /tmp/checkFile_output_$$.txt ]; then
283298
status=1
284299
fi
285-
286300
rm -f /tmp/checkFile_output_$$.txt
287301

288302
exit $status

‎src/org/olap4j/driver/xmla/XmlaOlap4jCatalog.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,9 @@ protected void populateList(
8383
throws OlapException
8484
{
8585
try {
86-
/*
87-
* Some OLAP servers don't support DBSCHEMA_SCHEMATA
88-
* so we fork the behavior here according to the
89-
* database product name.
90-
*/
86+
// Some OLAP servers don't support DBSCHEMA_SCHEMATA so
87+
// we fork the behavior here according to the database
88+
// product name.
9189
if (XmlaOlap4jCatalog.this.olap4jDatabaseMetaData
9290
.getDatabaseProductName().contains("Mondrian"))
9391
{

‎src/org/olap4j/driver/xmla/XmlaOlap4jCellSet.java

+39-43
Original file line numberDiff line numberDiff line change
@@ -128,20 +128,20 @@ void populate() throws OlapException {
128128
Element fault =
129129
findChild(body, SOAP_NS, "Fault");
130130
if (fault != null) {
131-
/*
132-
<SOAP-ENV:Fault>
133-
<faultcode>SOAP-ENV:Client.00HSBC01</faultcode>
134-
<faultstring>XMLA connection datasource not found</faultstring>
135-
<faultactor>Mondrian</faultactor>
136-
<detail>
137-
<XA:error xmlns:XA="http://mondrian.sourceforge.net">
138-
<code>00HSBC01</code>
139-
<desc>The Mondrian XML: Mondrian Error:Internal
140-
error: no catalog named 'LOCALDB'</desc>
141-
</XA:error>
142-
</detail>
143-
</SOAP-ENV:Fault>
144-
*/
131+
// <SOAP-ENV:Fault>
132+
// <faultcode>SOAP-ENV:Client.00HSBC01</faultcode>
133+
// <faultstring>XMLA connection datasource not
134+
// found</faultstring>
135+
// <faultactor>Mondrian</faultactor>
136+
// <detail>
137+
// <XA:error xmlns:XA="http://mondrian.sourceforge.net">
138+
// <code>00HSBC01</code>
139+
// <desc>The Mondrian XML: Mondrian Error:Internal
140+
// error: no catalog named 'LOCALDB'</desc>
141+
// </XA:error>
142+
// </detail>
143+
// </SOAP-ENV:Fault>
144+
//
145145
// TODO: log doc to logfile
146146
throw getHelper().createException(
147147
"XMLA provider gave exception: "
@@ -186,14 +186,12 @@ void populate() throws OlapException {
186186

187187
// todo: use CellInfo element to determine mapping of cell properties
188188
// to XML tags
189-
/*
190-
<CellInfo>
191-
<Value name="VALUE"/>
192-
<FmtValue name="FORMATTED_VALUE"/>
193-
<FormatString name="FORMAT_STRING"/>
194-
</CellInfo>
195-
*/
196-
189+
//
190+
// <CellInfo>
191+
// <Value name="VALUE"/>
192+
// <FmtValue name="FORMATTED_VALUE"/>
193+
// <FormatString name="FORMAT_STRING"/>
194+
// </CellInfo>
197195
final Element axesNode = findChild(root, MDDATASET_NS, "Axes");
198196

199197
// First pass, gather up a list of member unique names to fetch
@@ -427,27 +425,25 @@ private XmlaOlap4jCellSetMetaData createMetaData(Element root)
427425
findChildren(axisInfo, MDDATASET_NS, "HierarchyInfo");
428426
final List<Hierarchy> hierarchyList =
429427
new ArrayList<Hierarchy>();
430-
/*
431-
<OlapInfo>
432-
<AxesInfo>
433-
<AxisInfo name="Axis0">
434-
<HierarchyInfo name="Customers">
435-
<UName name="[Customers].[MEMBER_UNIQUE_NAME]"/>
436-
<Caption name="[Customers].[MEMBER_CAPTION]"/>
437-
<LName name="[Customers].[LEVEL_UNIQUE_NAME]"/>
438-
<LNum name="[Customers].[LEVEL_NUMBER]"/>
439-
<DisplayInfo name="[Customers].[DISPLAY_INFO]"/>
440-
</HierarchyInfo>
441-
</AxisInfo>
442-
...
443-
</AxesInfo>
444-
<CellInfo>
445-
<Value name="VALUE"/>
446-
<FmtValue name="FORMATTED_VALUE"/>
447-
<FormatString name="FORMAT_STRING"/>
448-
</CellInfo>
449-
</OlapInfo>
450-
*/
428+
// <OlapInfo>
429+
// <AxesInfo>
430+
// <AxisInfo name="Axis0">
431+
// <HierarchyInfo name="Customers">
432+
// <UName name="[Customers].[MEMBER_UNIQUE_NAME]"/>
433+
// <Caption name="[Customers].[MEMBER_CAPTION]"/>
434+
// <LName name="[Customers].[LEVEL_UNIQUE_NAME]"/>
435+
// <LNum name="[Customers].[LEVEL_NUMBER]"/>
436+
// <DisplayInfo name="[Customers].[DISPLAY_INFO]"/>
437+
// </HierarchyInfo>
438+
// </AxisInfo>
439+
// ...
440+
// </AxesInfo>
441+
// <CellInfo>
442+
// <Value name="VALUE"/>
443+
// <FmtValue name="FORMATTED_VALUE"/>
444+
// <FormatString name="FORMAT_STRING"/>
445+
// </CellInfo>
446+
// </OlapInfo>
451447
final List<XmlaOlap4jCellSetMemberProperty> propertyList =
452448
new ArrayList<XmlaOlap4jCellSetMemberProperty>();
453449
for (Element hierarchyInfo : hierarchyInfos) {
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.