hi Julian,<br>I've fixed all the code formatting exceptions flagged by checkFile.sh.<br><br>I had to slightly fix checkFile.sh as it was not working in cygwin due to wrong end of line characters.<br>I did that using a tool called textpad - "save as", "file format", "UNIX".<br>
<br>Also the comments on checkFile.sh say that it's the same script used by Perforce on check-ins.<br>That's probably no longer true as Perforce allowed my changes in while checkFile flagged many exceptions.<br>Perhaps the trigger on the Perforce server needs updating?<br>
<br>It's been fairly time consuming to comply the code formatting rules using Eclipse.<br>With these restrictions changing a large amount of code would be a very daunting perspective.<br><br>I think it's pretty safe to say that Eclipse is the most widespread Java IDE and that it's probably worth trying to create an eclipse formatting file to help with this task.<br>
<br>Where can I see your formatting rules in a human readable format?<br><br><br><br>thanks,<br>Michele<br><br><br><div class="gmail_quote">On 25 August 2011 22:15, Michele Rossi <span dir="ltr"><<a href="mailto:michele.rossi@gmail.com">michele.rossi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<div>I fixed all the exceptions raised by Perforce when attempting to check in and I assumed they were the same checks made by the checkFile script.</div>
<div>Wrong assumption sorry.</div><div><br></div><div>Ok I will run checkFile tomorrow as soon as I get back to work (it's 22:15 here now).</div>
<div><br></div><div>thanks,</div><div>Michele<div><div></div><div class="h5"><br><div><br><div class="gmail_quote">On 25 August 2011 21:29, Julian Hyde <span dir="ltr"><<a href="mailto:jhyde@pentaho.com" target="_blank">jhyde@pentaho.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Michele,<br>
<br>
Congratulations on your first check in.<br>
<br>
However, it had 17 checkFile exceptions. Can you fix today please.<br>
<font color="#888888"><br>
Julian<br>
</font><div><div></div><div><br>
On Aug 25, 2011, at 12:44 AM, Michele Rossi wrote:<br>
<br>
> <a href="http://p4web.eigenbase.org/@md=d&c=6PU@/14566?ac=10" target="_blank">http://p4web.eigenbase.org/@md=d&c=6PU@/14566?ac=10</a><br>
><br>
> Change 14566 by mrossi@michele_mondrian on 2011/08/25 00:43:32<br>
><br>
> MONDRIAN: fixes to xmla servlet<br>
><br>
> Affected files ...<br>
><br>
> ... //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 edit<br>
> ... //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 edit<br>
> ... //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 edit<br>
><br>
> Differences ...<br>
><br>
> ==== //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 (ktext) ====<br>
><br>
> 2c2<br>
> < // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $<br>
> ---<br>
>> // $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $<br>
> 27a28,29<br>
>> import java.lang.reflect.InvocationTargetException;<br>
>> import java.lang.reflect.UndeclaredThrowableException;<br>
> 41c43<br>
> < * @version $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#79 $<br>
> ---<br>
>> * @version $Id: //open/mondrian/src/main/mondrian/xmla/XmlaHandler.java#80 $<br>
> 75a78,102<br>
>> } catch (UndeclaredThrowableException ute) {<br>
>> //<br>
>> // Note: this is necessary because we use a dynamic proxy for the<br>
>> // connection.<br>
>> // I could not catch and un-wrap the Undeclared Throwable within<br>
>> // the proxy.<br>
>> // The exception comes out here and I couldn't find any better<br>
>> // ways to deal with it.<br>
>> //<br>
>> // The undeclared throwable contains an Invocation Target Exception<br>
>> // which in turns contains the real exception thrown by the "unwrap"<br>
>> // method, for example OlapException.<br>
>> //<br>
>><br>
>> Throwable cause = ute.getCause();<br>
>> if (cause instanceof InvocationTargetException) {<br>
>> cause = cause.getCause();<br>
>> }<br>
>><br>
>> // this maintains the original behaviour: don't catch exceptions<br>
>> // that are not subclasses of SQLException<br>
>><br>
>> if (! (cause instanceof SQLException)) {<br>
>> throw ute;<br>
>> }<br>
><br>
> ==== //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 (ktext) ====<br>
><br>
> 2c2<br>
> < // $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $<br>
> ---<br>
>> // $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $<br>
> 12c12,18<br>
> < import java.io.*;<br>
> ---<br>
>> import java.io.ByteArrayInputStream;<br>
>> import java.io.ByteArrayOutputStream;<br>
>> import java.io.IOException;<br>
>> import java.io.InputStream;<br>
>> import java.io.OutputStream;<br>
>> import java.io.StringWriter;<br>
>> import java.io.UnsupportedEncodingException;<br>
> 14,15c20,24<br>
> < import java.nio.channels.*;<br>
> < import java.util.*;<br>
> ---<br>
>> import java.nio.channels.Channels;<br>
>> import java.nio.channels.ReadableByteChannel;<br>
>> import java.nio.channels.WritableByteChannel;<br>
>> import java.util.HashMap;<br>
>> import java.util.Map;<br>
> 17,19c26,32<br>
> < import javax.servlet.*;<br>
> < import javax.servlet.http.*;<br>
> < import javax.xml.parsers.*;<br>
> ---<br>
>> import javax.servlet.ServletConfig;<br>
>> import javax.servlet.ServletException;<br>
>> import javax.servlet.http.HttpServletRequest;<br>
>> import javax.servlet.http.HttpServletResponse;<br>
>> import javax.xml.parsers.DocumentBuilder;<br>
>> import javax.xml.parsers.DocumentBuilderFactory;<br>
>> import javax.xml.parsers.ParserConfigurationException;<br>
> 21d33<br>
> < import mondrian.xmla.*;<br>
> 22a35,42<br>
>> import mondrian.xmla.SaxWriter;<br>
>> import mondrian.xmla.XmlaConstants;<br>
>> import mondrian.xmla.XmlaException;<br>
>> import mondrian.xmla.XmlaRequest;<br>
>> import mondrian.xmla.XmlaRequestCallback;<br>
>> import mondrian.xmla.XmlaResponse;<br>
>> import mondrian.xmla.XmlaServlet;<br>
>> import mondrian.xmla.XmlaUtil;<br>
> 25,26c45,51<br>
> < import org.w3c.dom.*;<br>
> < import org.xml.sax.*;<br>
> ---<br>
>> import org.w3c.dom.Attr;<br>
>> import org.w3c.dom.Document;<br>
>> import org.w3c.dom.Element;<br>
>> import org.w3c.dom.Node;<br>
>> import org.w3c.dom.NodeList;<br>
>> import org.xml.sax.InputSource;<br>
>> import org.xml.sax.SAXException;<br>
> 32c57<br>
> < * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#32 $<br>
> ---<br>
>> * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/DefaultXmlaServlet.java#33 $<br>
> 45,52d69<br>
> < /**<br>
> < * Simba O2X for some reason attempts to create many new xmla sessions<br>
> < * during the same user interactions. We can mitigate that by creating a<br>
> < * session id which is a direct hash function of the credentials supplied<br>
> < * and the remote host IP.<br>
> < */<br>
> < private static final String REUSE_SESSION_IDS = "reuseSessionIds";<br>
> <<br>
> 56d72<br>
> < private boolean reuseSessionIds = false;<br>
> 61,63d76<br>
> < *<br>
> < * <p>NOTE: There is no mechanism to remove entries from this map,<br>
> < * so it will get larger if the server is up for a long time.</p><br>
> 74,76d86<br>
> < this.reuseSessionIds =<br>
> < Boolean.parseBoolean(<br>
> < servletConfig.getInitParameter(REUSE_SESSION_IDS));<br>
> 79c89<br>
> < protected DocumentBuilderFactory getDocumentBuilderFactory() {<br>
> ---<br>
>> protected static DocumentBuilderFactory getDocumentBuilderFactory() {<br>
> 239a250<br>
>><br>
> 277a289<br>
>><br>
> 281d292<br>
> < context.put(CONTEXT_XMLA_PASSWORD, passwordStr);<br>
> 283,285c294,296<br>
> < // [MROSSI] TODO we'd need to inject the HttpServletRequest<br>
> < // into this method context.put("remote_host",<br>
> < // request.getRemoteHost());<br>
> ---<br>
>><br>
>> context.put(CONTEXT_XMLA_PASSWORD, passwordStr);<br>
>><br>
> 287c298<br>
> < LOGGER.error(<br>
> ---<br>
>> LOGGER.warn(<br>
> 319d329<br>
> < // generate SessionId<br>
> 328,330c338,347<br>
> < // extract the SessionId attrs value and put into<br>
> < // context<br>
> < sessionIdStr = getSessionId(e, context);<br>
> ---<br>
>> sessionIdStr = getSessionIdFromRequest(e, context);<br>
>><br>
>> SessionInfo sessionInfo = getSessionInfo(sessionIdStr);<br>
>><br>
>> if (sessionInfo != null) {<br>
>> context.put(CONTEXT_XMLA_USERNAME, sessionInfo.user);<br>
>> context.put(<br>
>> CONTEXT_XMLA_PASSWORD,<br>
>> sessionInfo.password);<br>
>> }<br>
> 338,349c355<br>
> < // extract the SessionId attrs value and put into<br>
> < // context<br>
> < sessionIdStr = getSessionId(e, context);<br>
> <<br>
> < SessionInfo sessionInfo =<br>
> < getSessionInfo(sessionIdStr);<br>
> < if (sessionInfo != null) {<br>
> < context.put(CONTEXT_XMLA_USERNAME, sessionInfo.user);<br>
> < context.put(<br>
> < CONTEXT_XMLA_PASSWORD, sessionInfo.password);<br>
> < }<br>
> < context.put(CONTEXT_XMLA_SESSION_ID, sessionIdStr);<br>
> ---<br>
>> sessionIdStr = getSessionIdFromRequest(e, context);<br>
> 354,355d359<br>
> < // remove session info<br>
> < removeSessionInfo(sessionIdStr);<br>
> 392a397<br>
>><br>
> 419,423d423<br>
> < private void removeSessionInfo(String sessionIdStr) {<br>
> < synchronized (sessionInfos) {<br>
> < sessionInfos.remove(sessionIdStr);<br>
> < }<br>
> < }<br>
> 425a426<br>
>><br>
> 432,469c433,438<br>
> < /*<br>
> < * Fallback to the default session ID generation algorithm.<br>
> < */<br>
> < if (reuseSessionIds) {<br>
> < // This is how we use the same session id (key to retrieve a<br>
> < // connection) for requests with the same username coming from<br>
> < // the same remote host. The password can't be part of the<br>
> < // string because if you use Simba and you don't tick "save<br>
> < // password" in the login dialog then Simba only sends the<br>
> < // password with the first session that it opens - after which<br>
> < // it sends something like the following:<br>
> < //<br>
> < // <Header><br>
> < // <Security xmlns="<a href="http://schemas.xmlsoap.org/ws/2002/04/secext" target="_blank">http://schemas.xmlsoap.org/ws/2002/04/secext</a>"><br>
> < // <UsernameToken><br>
> < // <Username>michele</Username><br>
> < // <Password Type="PasswordText"/><br>
> < // </UsernameToken><br>
> < // </Security><br>
> < // <BeginSession<br>
> < // xmlns="urn:schemas-microsoft-com:xml-analysis"<br>
> < // mustUnderstand="1"/><br>
> < // </Header><br>
> < //<br>
> < // Note the Password element with no value in it.<br>
> < String sessionString =<br>
> < "session_"<br>
> < + context.get(CONTEXT_XMLA_USERNAME)<br>
> < + "_"<br>
> < + "_"<br>
> < + context.get("remote_host");<br>
> < return Long.toString(sessionString.hashCode(), 35);<br>
> < } else {<br>
> < // Generate a semi-random new session ID.<br>
> < return Long.toString(<br>
> < -17L * System.nanoTime() + 11L * System.currentTimeMillis(),<br>
> < 35);<br>
> < }<br>
> ---<br>
>><br>
>><br>
>> // Generate a pseudo-random new session ID.<br>
>> return Long.toString(17L * System.nanoTime()<br>
>> +<br>
>> 3L * System.currentTimeMillis(), 35);<br>
> 472c441,443<br>
> < protected String getSessionId(Element e, Map<String, Object> context)<br>
> ---<br>
>><br>
>> private static String getSessionIdFromRequest(Element e,<br>
>> Map<String, Object> context)<br>
> 485,486c456,458<br>
> < String value = attr.getValue();<br>
> < if (value == null) {<br>
> ---<br>
>><br>
>> String sessionId = attr.getValue();<br>
>> if (sessionId == null) {<br>
> 494c466<br>
> < return value;<br>
> ---<br>
>> return sessionId;<br>
> 845c817,822<br>
> < SessionInfo sessionInfo;<br>
> ---<br>
>> if (sessionId == null) {<br>
>> return null;<br>
>> }<br>
>><br>
>> SessionInfo sessionInfo = null;<br>
>><br>
> 848a826<br>
>><br>
> 851,852c829,831<br>
> < "No login credentials for found for session [" + sessionId<br>
> < + "]");<br>
> ---<br>
>> "No login credentials for found for session ["<br>
>> +<br>
>> sessionId + "]");<br>
> 855,856c834,837<br>
> < "Found existing credentials for session id ["<br>
> < + sessionId + "], username=[" + sessionInfo.user + "]");<br>
> ---<br>
>> "Found credentials for session id ["<br>
>> + sessionId<br>
>> + "], username=[" + sessionInfo.user<br>
>> + "] in servlet cache");<br>
> 876c857<br>
> < new SessionInfo(sessionId, username, password);<br>
> ---<br>
>> new SessionInfo(username, password);<br>
> 882c863<br>
> < sessionInfo = new SessionInfo(sessionId, username, password);<br>
> ---<br>
>> sessionInfo = new SessionInfo(username, password);<br>
> 888c869,871<br>
> <<br>
> ---<br>
>> /**<br>
>> * Holds authentication credentials of a XMLA session.<br>
>> */<br>
> 890d872<br>
> < final String id;<br>
> 894,895c876,877<br>
> < public SessionInfo(String id, String user, String password) {<br>
> < <a href="http://this.id" target="_blank">this.id</a> = id;<br>
> ---<br>
>> public SessionInfo(String user, String password)<br>
>> {<br>
> 901d882<br>
> <<br>
><br>
> ==== //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 (ktext) ====<br>
><br>
> 2c2<br>
> < // $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $<br>
> ---<br>
>> // $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $<br>
> 28a29<br>
>> import java.lang.reflect.UndeclaredThrowableException;<br>
> 36c37<br>
> < * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#3 $<br>
> ---<br>
>> * @version $Id: //open/mondrian/src/main/mondrian/xmla/impl/Olap4jXmlaServlet.java#4 $<br>
> 415a417<br>
>><br>
> 422,423c424,427<br>
> < if (OlapConnection.class.isAssignableFrom(<br>
> < method.getClass()))<br>
> ---<br>
>> if ("unwrap".equals(method.getName())<br>
>> ||<br>
>> OlapConnection.class.isAssignableFrom(<br>
>> method.getDeclaringClass()))<br>
><br>
<br>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br>