This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 61907 - Obvious errors in JavaI18nString
Summary: Obvious errors in JavaI18nString
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: I18N (show other bugs)
Version: 5.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@java
URL:
Keywords: I18N
Depends on:
Blocks:
 
Reported: 2005-08-08 04:35 UTC by _ tboudreau
Modified: 2009-05-18 11:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch (1004 bytes, application/octet-stream)
2007-09-05 10:45 UTC, Tomas Stupka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2005-08-08 04:35:55 UTC
A couple things that can't possibly work - the copy constructor checks if the
arguments field is null, and if so, does not copy the arguments from the string
that is being copied.  It will always be null - it should be checking the value
from the passed JavaI18nString.

    protected String[] arguments;
    protected JavaI18nString(JavaI18nString copy) {
        super(copy);
        if (arguments == null) return;
        this.arguments = (String[]) copy.arguments.clone();
    }


Also, become does not actually override I18nString.become, because the argument
type is different:
    
    public void become(JavaI18nString i18nString) {
        super.become(i18nString);
        
        JavaI18nString peer = (JavaI18nString) i18nString;
        this.setArguments(peer.arguments);
    }
Comment 1 Marian Petras 2005-09-09 14:21:05 UTC
Accepted.
Comment 2 _ tboudreau 2005-09-10 19:29:34 UTC
I should probably get you my draft version of a major rewrite of this module, btw.
Comment 3 Tomas Stupka 2007-09-05 10:42:28 UTC
fixed the constructor bug

/cvs/i18n/src/org/netbeans/modules/i18n/java/JavaI18nString.java,v  <--  JavaI18nString.java
new revision: 1.9; previous revision: 1.8

the error in become(...) will be fixed after 6.0 as it would be an api change
attaching patch
Comment 4 Tomas Stupka 2007-09-05 10:45:42 UTC
Created attachment 48137 [details]
patch
Comment 5 _ tboudreau 2007-09-05 19:43:53 UTC
Why would a subclass overriding a public method in its parent class be an API change?
Comment 6 Alexey Butenko 2009-05-18 11:37:21 UTC
http://hg.netbeans.org/main/rev/40d6acf45fb5