3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
7
# The contents of this file are subject to the terms of either the GNU
8
# General Public License Version 2 only ("GPL") or the Common
9
# Development and Distribution License("CDDL") (collectively, the
10
# "License"). You may not use this file except in compliance with the
11
# License. You can obtain a copy of the License at
12
# http://www.netbeans.org/cddl-gplv2.html
13
# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14
# specific language governing permissions and limitations under the
15
# License. When distributing the software, include this License Header
16
# Notice in each file and include the License file at
17
# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
18
# particular file as subject to the "Classpath" exception as provided
19
# by Sun in the GPL Version 2 section of the License file that
20
# accompanied this code. If applicable, add the following below the
21
# License Header, with the fields enclosed by brackets [] replaced by
22
# your own identifying information:
23
# "Portions Copyrighted [year] [name of copyright owner]"
27
# The Original Software is NetBeans. The Initial Developer of the Original
28
# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
29
# Microsystems, Inc. All Rights Reserved.
31
# If you wish your version of this file to be governed by only the CDDL
32
# or only the GPL Version 2, indicate your decision by adding
33
# "[Contributor] elects to include this software in this distribution
34
# under the [CDDL or GPL Version 2] license." If you do not indicate a
35
# single choice of license, a recipient has the option to distribute
36
# your version of this file under either the CDDL, the GPL Version 2 or
37
# to extend the choice of license to its licensees as provided above.
38
# However, if you add GPL Version 2 code and therefore, elected the GPL
39
# Version 2 license, then the option applies only if the new code is
40
# made subject to such option by the copyright holder.
49
die "usage: $0 [-q] file | directory ...\n";
52
if ($ARGV[0] eq "-q") {
57
foreach my $name (@ARGV) {
62
if (-f && m,\.java$, || -f && m,\bBundle.properties$,) {
63
push @files, $File::Find::name;
71
# read Bundle.properties
77
next if $f !~ m,\bBundle.properties$,i;
79
print STDERR "*** $f\n" unless $quiet;
81
open FH, "< $f" or die;
88
@lines = split /\r\n|\n|\r/, $all;
89
for ($lineno = 0; $lineno <= $#lines; $lineno++) {
95
if (m,^([^=]+)=(.*)$,) {
98
push @props, { key => $k,
100
lineno => $lineno + 1,
106
while (m,\\$, && $lineno <= $#lines) {
108
$_ = $lines[$lineno];
118
foreach $f (@files) {
119
next if $f =~ m,\bBundle.properties$,i;
121
print STDERR "*** $f\n" unless $quiet;
123
open FH, "< $f" or die;
130
foreach $p (@props) {
131
next if $p->{used} > 0;
133
$pat = quotemeta $pat;
134
$p->{used}++ if $all =~ m,\"$pat\",;
138
foreach $p (@props) {
139
next if $p->{line} =~ m!/!; # probably a filename localization, not in Java code
140
next if $p->{line} =~ m!^OpenIDE-Module-!; # manifest localization, not in Java code
141
print "$p->{file}:$p->{lineno}: $p->{line}\n" if $p->{used} == 0;