mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
IDEA-210737 XSD Generator crashes IDEA
GitOrigin-RevId: 539841cb392c108b0a57a062b0fc554da9fb83a3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
425cf14acc
commit
23f7b3d36b
@@ -224,6 +224,7 @@ webservice.status.tooltip=Status of current settings, input errors, etc
|
||||
xmlbeans.instance2schema.result.schema.name=Result schema file name
|
||||
browse.button.tooltip=Browse for local file
|
||||
instance.document.file.is.not.exist=Instance document file does not exist
|
||||
instance.document.file.should.have.xml.extension=Instance document file should have .xml extension (lowercased)
|
||||
xml2xsd.generator.error.message=Can't generate schema from instance document. Check your xml document
|
||||
file.doesnt.exist=File {0} doesn''t exist
|
||||
error=Error
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.security.Permission;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -121,7 +122,28 @@ final class GenerateSchemaFromInstanceDocumentAction extends AnAction {
|
||||
});
|
||||
}
|
||||
|
||||
Inst2Xsd.main(ArrayUtilRt.toStringArray(parameters));
|
||||
// Inst2Xsd.main contains exit() calls, so we need to prevent this
|
||||
SecurityManager old = System.getSecurityManager();
|
||||
try {
|
||||
System.setSecurityManager(new SecurityManager() {
|
||||
@Override
|
||||
public void checkExit(int status) {
|
||||
throw new SecurityException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkPermission(Permission perm) {
|
||||
}
|
||||
});
|
||||
Inst2Xsd.main(ArrayUtilRt.toStringArray(parameters));
|
||||
}
|
||||
catch (Exception e) {
|
||||
Messages.showErrorDialog(project, XmlBundle.message("xml2xsd.generator.error.message"), XmlBundle.message("xml2xsd.generator.error"));
|
||||
return;
|
||||
}
|
||||
finally {
|
||||
System.setSecurityManager(old);
|
||||
}
|
||||
if (expectedSchemaFile.exists()) {
|
||||
final boolean renamed = expectedSchemaFile.renameTo(xsd);
|
||||
if (! renamed) {
|
||||
|
||||
@@ -196,6 +196,10 @@ public class GenerateSchemaFromInstanceDocumentDialog extends DialogWrapper {
|
||||
return XmlBundle.message("instance.document.file.is.not.exist");
|
||||
}
|
||||
|
||||
if (!generateFromUrl.getText().endsWith(".xml")) {
|
||||
return XmlBundle.message("instance.document.file.should.have.xml.extension");
|
||||
}
|
||||
|
||||
try {
|
||||
int i = Integer.parseInt(getEnumerationsLimit());
|
||||
if (i < 0) return XmlBundle.message("negative.number.validation.problem");
|
||||
|
||||
Reference in New Issue
Block a user