Lines 60-67
Link Here
|
60 |
import java.util.Iterator; |
60 |
import java.util.Iterator; |
61 |
import java.util.List; |
61 |
import java.util.List; |
62 |
import java.util.Map; |
62 |
import java.util.Map; |
|
|
63 |
import java.util.Properties; |
63 |
import java.util.Set; |
64 |
import java.util.Set; |
64 |
import java.util.StringTokenizer; |
65 |
import java.util.StringTokenizer; |
|
|
66 |
import java.util.jar.Attributes; |
67 |
import java.util.jar.Manifest; |
68 |
import java.util.logging.Level; |
69 |
import java.util.logging.Logger; |
70 |
|
65 |
import javax.xml.parsers.ParserConfigurationException; |
71 |
import javax.xml.parsers.ParserConfigurationException; |
66 |
import org.netbeans.api.java.classpath.ClassPath; |
72 |
import org.netbeans.api.java.classpath.ClassPath; |
67 |
import org.netbeans.api.java.project.JavaProjectConstants; |
73 |
import org.netbeans.api.java.project.JavaProjectConstants; |
Lines 77-83
Link Here
|
77 |
import org.netbeans.modules.websvc.jaxwsmodel.project.WsdlNamespaceHandler; |
83 |
import org.netbeans.modules.websvc.jaxwsmodel.project.WsdlNamespaceHandler; |
78 |
import org.netbeans.modules.xml.retriever.RetrieveEntry; |
84 |
import org.netbeans.modules.xml.retriever.RetrieveEntry; |
79 |
import org.netbeans.modules.xml.retriever.Retriever; |
85 |
import org.netbeans.modules.xml.retriever.Retriever; |
|
|
86 |
import org.netbeans.spi.java.classpath.support.ClassPathSupport; |
87 |
import org.netbeans.spi.project.support.ant.AntProjectHelper; |
80 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
88 |
import org.netbeans.spi.project.support.ant.EditableProperties; |
|
|
89 |
import org.netbeans.spi.project.support.ant.PropertyEvaluator; |
81 |
import org.openide.DialogDisplayer; |
90 |
import org.openide.DialogDisplayer; |
82 |
import org.openide.ErrorManager; |
91 |
import org.openide.ErrorManager; |
83 |
import org.openide.NotifyDescriptor; |
92 |
import org.openide.NotifyDescriptor; |
Lines 94-99
Link Here
|
94 |
import org.openide.util.NbBundle; |
103 |
import org.openide.util.NbBundle; |
95 |
import org.xml.sax.SAXException; |
104 |
import org.xml.sax.SAXException; |
96 |
|
105 |
|
|
|
106 |
|
97 |
/** |
107 |
/** |
98 |
* |
108 |
* |
99 |
* @author mkuchtiak |
109 |
* @author mkuchtiak |
Lines 631-635
Link Here
|
631 |
} |
641 |
} |
632 |
return found; |
642 |
return found; |
633 |
} |
643 |
} |
|
|
644 |
|
645 |
public static Properties identifyWsimport( AntProjectHelper helper ){ |
646 |
if ( helper == null ){ |
647 |
return null; |
648 |
} |
649 |
EditableProperties props = helper.getProperties( |
650 |
AntProjectHelper.PROJECT_PROPERTIES_PATH); |
651 |
String wsImportCp = props.getProperty("j2ee.platform.wsimport.classpath"); // NOI18N |
652 |
if ( wsImportCp ==null && wsImportCp.length() == 0 ){ |
653 |
return null; |
654 |
} |
655 |
PropertyEvaluator evaluator = helper.getStandardPropertyEvaluator(); |
656 |
String[] roots = wsImportCp.split(":"); |
657 |
List<FileObject> cpItems = new ArrayList<FileObject>(roots.length); |
658 |
for (String root : roots) { |
659 |
String wsImportCpItem = evaluator.evaluate(root); |
660 |
FileObject fileObject = FileUtil.toFileObject( |
661 |
FileUtil.normalizeFile( new File(wsImportCpItem))); |
662 |
if ( fileObject == null ){ |
663 |
continue; |
664 |
} |
665 |
if ( fileObject.isFolder() ){ |
666 |
cpItems.add( fileObject); |
667 |
} |
668 |
else if ( FileUtil.isArchiveFile(fileObject)){ |
669 |
cpItems.add( FileUtil.getArchiveRoot(fileObject)); |
670 |
} |
671 |
} |
672 |
|
673 |
ClassPath classPath = ClassPathSupport.createClassPath(cpItems.toArray( |
674 |
new FileObject[cpItems.size()])); |
675 |
FileObject wsImport = classPath.findResource( |
676 |
"com/sun/tools/ws/ant/WsImport.class"); // NOI18N |
677 |
if ( wsImport == null ){ |
678 |
return null; |
679 |
} |
680 |
FileObject wsImportRoot = classPath.findOwnerRoot(wsImport); |
681 |
FileObject manifest = wsImportRoot.getFileObject("META-INF/MANIFEST.MF"); // NOI18N |
682 |
try { |
683 |
Manifest mnfst = new Manifest( manifest.getInputStream()); |
684 |
String version = mnfst.getMainAttributes().getValue( |
685 |
"Implementation-Version"); // NOI18N |
686 |
if ( version.startsWith("2.2.")){ // NOI18N |
687 |
/* |
688 |
* version is 2.2 but it has minor release numbers so it is |
689 |
* newer 2.2 version with fixed wsimport issue |
690 |
*/ |
691 |
return null; |
692 |
} |
693 |
else if ( version.startsWith("2.2")){ // NOI18N |
694 |
// buggy 2.2 version |
695 |
FileObject badRoot = FileUtil.getArchiveFile(wsImport); |
696 |
if ( badRoot== null){ |
697 |
badRoot = classPath.findOwnerRoot(wsImport); |
698 |
} |
699 |
NotifyDescriptor notifyDescriptor = |
700 |
new NotifyDescriptor.Message(NbBundle.getMessage(WSUtils.class, |
701 |
"ERR_WsimportBadVersion", version, badRoot.getPath()), // NOI18N |
702 |
NotifyDescriptor.ERROR_MESSAGE); |
703 |
DialogDisplayer.getDefault().notify(notifyDescriptor); |
704 |
Properties properties = new Properties(); |
705 |
properties.put("wsimport.bad.version", Boolean.TRUE.toString()); // NOI18N |
706 |
return properties; |
707 |
} |
708 |
else { |
709 |
// version is not 2.2 ( older or newer ) |
710 |
return null; |
711 |
} |
712 |
} |
713 |
catch( IOException e ){ |
714 |
Logger.getLogger(WSUtils.class.getName()).log(Level.INFO, null , e); |
715 |
return null; |
716 |
} |
717 |
} |
634 |
|
718 |
|
635 |
} |
719 |
} |