harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Serguei Zapreyev (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1651) [drlvm][kernel] Some issues in j.l.Package implementation
Date Wed, 04 Oct 2006 09:42:22 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-1651?page=comments#action_12439780 ] 
            
Serguei Zapreyev commented on HARMONY-1651:
-------------------------------------------

Alexey, some mishmash has been raised due to you (?) committed a fix of
isCompatibleWith between I had prepared H1651.jlP_impl.patch
patch and its publication in jira. Nevertheless, I cann't explain the reason 
why H1651.jlP_impl.patch looks like it was before you fix because I saw 
your fix just before filing the jira issue and took it into consideration. 
Sorry for inconvenience. Be that as it may, the isCompatibleWith looks for 
me as follows:
--------------------------------------------------------------------------
    public boolean isCompatibleWith(String desiredVersion)
            throws NumberFormatException {
        if (jar != null) {
            init();
        }

        StringTokenizer specVersionTokens = null;
        StringTokenizer desiredVersionTokens = null;
        try {
            specVersionTokens = new StringTokenizer(specVersion,
                    ".");
            desiredVersionTokens = new StringTokenizer(
                    desiredVersion, ".");
            if (!specVersionTokens.hasMoreElements() || !desiredVersionTokens.hasMoreElements())
{
                throw new NumberFormatException("Empty version string");
            }
            while (specVersionTokens.hasMoreElements()) {
                int desiredVer = Integer.parseInt(desiredVersionTokens
                        .nextToken());
                int specVer = Integer.parseInt(specVersionTokens.nextToken());
                if (specVer != desiredVer) {
                    return specVer > desiredVer;
                }
            }
        } catch (NoSuchElementException e) {
        	
        	/* 
        	 * ignore - this seems to be the case when we run out of tokens
        	 * for desiredVersion
        	 */
        } catch (NullPointerException e) {
            if(specVersion == null) {
                throw new NumberFormatException("Empty version string");
            }
            throw e;
        }
        
        /*
         *   now, if desired is longer than spec, and they have been 
         *   equal so far (ex.  1.4  <->  1.4.0.0) then the remainder
         *   better be zeros
         */

    	while (desiredVersionTokens.hasMoreTokens()) {
    		if (0 != Integer.parseInt(desiredVersionTokens.nextToken())) {
        		return false;
        	}
    	}
        
        return true;
    }
--------------------------------------------------------------------------
So, if you don't see any faults in it I'll refresh the patch. If you see something bad 
just email directly me please to discuss an issue. Thanks in advance.


> [drlvm][kernel] Some issues in j.l.Package implementation
> ---------------------------------------------------------
>
>                 Key: HARMONY-1651
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1651
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Serguei Zapreyev
>         Attachments: H1651.jlP_impl.patch, Test1.java, Test2.java, Test3.java
>
>
> Some defects in Package impl: 
> - Package.isCompatibleWith("") throws NPE instead of NumberFormatException (Teast1).

>   Throwing the NumberFormatException as demanded resolves the issue. 
> - java.lang.Package.isSealed((java.net.URL)null) should throw NPE (Teast2). 
>   Throwing the NulPointerException as demanded resolves the issue. 
> - pakage info inaccessibility (DRLVM does not provide access to information describing
a package.)   
>   (Teast3). 
>   Changing the dot-separated Manifest entry name form to slash-separated one resolves
the issue.
> I'm going to attach the corresponding patch to fix the issues and the corresponding tests.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message