Hi again Julian,
Unfortunately this is still happening (it happened after my 10th attempt).
For more info, the exception is thrown during the call to 'read'. Here is
the backtrace:
----------------------------------------------------------------------------
-----
java.io.EOFException: Unexpected end of ZLIB input stream
at
java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:223)
at
java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
at
edu.northwestern.at.gint.servlets.ProcessSAMLResponseServlet.inflate(Process
SAMLResponseServlet.java:248)
at
edu.northwestern.at.gint.servlets.ProcessSAMLResponseServlet.decodeAuthnRequ
estXML(ProcessSAMLResponseServlet.java:210)
at
edu.northwestern.at.gint.servlets.ProcessSAMLResponseServlet.processRequest(
ProcessSAMLResponseServlet.java:109)
at
edu.northwestern.at.gint.servlets.ProcessSAMLResponseServlet.doGet(ProcessSA
MLResponseServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
...
----------------------------------------------------------------------------
--------
Thanks again for any help on this,
-Patricia
Patricia Goldweic
[EMAIL PROTECTED]
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Julian (Google)
> Sent: Monday, September 08, 2008 10:38 AM
> To: Google Apps APIs
> Subject: [google-apps-apis] Re: Java SSO intermittent problem
>
>
> Hi Patricia,
>
> I think you may need to Flush the stream to finish any buffered
> output:
>
> while ((count = decompressorStream.read(buf)) != -1) {
> out.write(buf, 0, count);
> }
> out.flush();
> return out.toByteArray();
>
> Please let me know if this solves the issue.
>
> Thanks,
> Julian.
>
> On Sep 5, 6:52 pm, "Patricia Goldweic" <[EMAIL PROTECTED]>
> wrote:
> > Hi,
> > I just realized that I forgot to include part of the
> relevant code of
> > my implementation (the definition of 'inflate'). Once again, I'll
> > very much appreciate any help with this.
> > -Patricia
> >
> > Here it goes:
> >
> > ===================================================================
> > private static byte[] inflate(byte[] bytes, boolean nowrap)
> >
> > throws IOException {
> >
> > Inflater decompressor = null;
> >
> > InflaterInputStream decompressorStream = null;
> >
> > ByteArrayOutputStream out = new ByteArrayOutputStream();
> >
> > try {
> >
> > decompressor = new Inflater(nowrap);
> >
> > decompressorStream = new InflaterInputStream(new
> > ByteArrayInputStream(bytes), decompressor);
> >
> > byte[] buf = new byte[1024];
> >
> > int count;
> >
> > while ((count = decompressorStream.read(buf)) != -1) {
> >
> > out.write(buf, 0, count);
> >
> > }
> >
> > return out.toByteArray();
> >
> > } finally {
> >
> > if (decompressor != null) decompressor.end();
> >
> > try {
> >
> > if (decompressorStream != null)
> > decompressorStream.close();
> >
> > } catch (IOException ioe) {
> >
> > /*ignore*/
> >
> > }
> >
> > try {
> >
> > if (out != null) out.close();
> >
> > } catch (IOException ioe) {
> >
> > /*ignore*/
> >
> > }
> >
> > }
> >
> > }
> >
> >
> ======================================================================
> > ======
> > =====================
> >
> > Patricia Goldweic
> > [EMAIL PROTECTED]
> >
> > _____
> >
> > From: [email protected]
> > [mailto:[EMAIL PROTECTED] On Behalf Of Patricia
> > Goldweic
> > Sent: Thursday, September 04, 2008 4:40 PM
> > To: [email protected]
> > Subject: [google-apps-apis] Java SSO intermittent problem
> >
> > Hi,
> > My SSO java code started failing intermittently with an
> exception of
> > the type 'Unexpected end of ZLIB input stream' when
> decoding the SAML request.
> > Has anybody gone through this before?
> > Here is my code for decoding, based on the original reference
> > implementation, and somewhat modified based on suggestions in this
> > list from some time ago (by Nate) as to how to avoid intermittent
> > exceptions related to buffer size:
> >
> >
> ======================================================================
> > =
> >
> > private String decodeAuthnRequestXML(String
> encodedRequestXmlString)
> > throws SamlException {
> >
> > String uncompressed = null;
> >
> > try {
> >
> > // URL decode
> >
> > // No need to URL decode: auto decoded by
> request.getParameter()
> > method
> >
> > // Base64 decode
> >
> > Base64 base64Decoder = new Base64();
> >
> > byte[] xmlBytes = encodedRequestXmlString.getBytes("UTF-8");
> >
> > byte[] base64DecodedByteArray = base64Decoder.decode(xmlBytes);
> >
> > // Uncompress the AuthnRequest data using a stream
> decompressor,
> > as suggested by Nate ( Google Apps Api's group)
> >
> > try {
> >
> > uncompressed = new
> String(inflate(base64DecodedByteArray, true));
> >
> > } catch (ZipException e) {
> >
> > uncompressed = new
> String(inflate(base64DecodedByteArray, false));
> >
> > }
> >
> > } catch (UnsupportedEncodingException e) {
> >
> > e.printStackTrace();
> >
> > throw new SamlException("Error decoding AuthnRequest: " +
> >
> > "Check decoding scheme - " + e.getMessage());
> >
> > } catch (Exception e) {
> >
> > e.printStackTrace();
> >
> > throw new SamlException("Error decoding AuthnRequest: " +
> >
> > "Check decoding scheme - " + e.getMessage());
> >
> > }
> >
> > return uncompressed;
> >
> > }
> >
> >
> ======================================================================
> > ======
> > ======================
> >
> > I'll appreciate any ideas/suggestions you may have. Thanks,
> >
> > -Patricia
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Apps APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-apps-apis?hl=en
-~----------~----~----~----~------~----~------~--~---