Repository: flex-falcon Updated Branches: refs/heads/develop fd20f696b -> f496ac38f
- Worked on some blocker SonarQube issues Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/f496ac38 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/f496ac38 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/f496ac38 Branch: refs/heads/develop Commit: f496ac38f0a36a65e995bd78feb219cf82aacb61 Parents: fd20f69 Author: Christofer Dutz <[email protected]> Authored: Fri Jun 17 17:38:26 2016 +0200 Committer: Christofer Dutz <[email protected]> Committed: Fri Jun 17 17:38:26 2016 +0200 ---------------------------------------------------------------------- .../externals/reference/FunctionReference.java | 2 +- .../externals/reference/MethodReference.java | 2 +- .../codegen/js/jx/FunctionCallEmitter.java | 4 +- compiler/pom.xml | 12 +++ .../apache/flex/abc/semantics/PooledValue.java | 46 +++++------ .../flex/compiler/internal/css/CSSFontFace.java | 8 +- .../java/org/apache/flex/swc/SWCLibrary.java | 17 ++-- .../compiler/internal/as/codegen/CmcEmitter.jbg | 10 +-- .../java/flex/tools/debugger/cli/DebugCLI.java | 28 +++---- .../flex/tools/debugger/cli/Extensions.java | 2 +- .../main/java/flex2/compiler/CompilerAPI.java | 2 +- .../main/java/flex2/compiler/SourceList.java | 83 +++++++++----------- .../compiler/common/CompilerConfiguration.java | 17 ++-- .../flex2/compiler/common/Configuration.java | 19 ++--- .../common/ConfigurationPathResolver.java | 15 ++-- .../common/NamespacesConfiguration.java | 5 +- .../config/CommandLineConfigurator.java | 2 +- .../compiler/config/ConfigurationBuffer.java | 38 ++++----- .../config/ServicesDependenciesWrapper.java | 26 +++--- .../extensions/ExtensionsConfiguration.java | 9 +-- 20 files changed, 168 insertions(+), 179 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java index 38d9d30..5ce9f98 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/FunctionReference.java @@ -88,7 +88,7 @@ public class FunctionReference extends BaseReference { for (Node param : paramNode.children()) { ParameterReference parameterReference; - if (isDocumented && parameterNames.contains(param.getString())) { + if ((parameterNames != null) && parameterNames.contains(param.getString())) { final String qualifiedName = FunctionUtils.toParameterType(this, param.getString()); parameterReference = new ParameterReference(getModel(), param, qualifiedName); } else { http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java index 61d8c1b..260345c 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/externals/reference/MethodReference.java @@ -110,7 +110,7 @@ public class MethodReference extends MemberReference { ParameterReference parameterReference; - if (isDocumented && parameterNames.contains(param.getString())) + if ((parameterNames != null) && parameterNames.contains(param.getString())) { final String qualifiedName = FunctionUtils.toParameterType(this, param.getString()); parameterReference = new ParameterReference(getModel(), param, qualifiedName); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java index 57d8c3f..19d35d8 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/js/jx/FunctionCallEmitter.java @@ -149,7 +149,7 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu write(JSFlexJSEmitterTokens.UNDERSCORE); endMapping(node.getNameNode()); } - else if (def != null && def.getBaseName().equals("sortOn")) + else if (def.getBaseName().equals("sortOn")) { if (def.getParent() != null && def.getParent().getQualifiedName().equals("Array")) @@ -165,7 +165,7 @@ public class FunctionCallEmitter extends JSSubEmitter implements ISubEmitter<IFu return; } } - else if (def != null && def.getBaseName().equals("sort")) + else if (def.getBaseName().equals("sort")) { if (def.getParent() != null && def.getParent().getQualifiedName().equals("Array")) http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler/pom.xml ---------------------------------------------------------------------- diff --git a/compiler/pom.xml b/compiler/pom.xml index c9745bd..5a22937 100644 --- a/compiler/pom.xml +++ b/compiler/pom.xml @@ -34,6 +34,18 @@ <name>Apache Flex - FlexJS: Compiler</name> <description>The Apache Flex Falcon Compiler</description> + <properties> + <!-- + These classes are generated and have a huge amount of errors and warning, + but it's not much we can do about them here as we would have to change JBurg + itself. + --> + <sonar.exclusions> + org/apache/flex/compiler/internal/as/codegen/CmcEmitter.java, + flash/tools/debugger/expression/AS3DebuggerBURM.java + </sonar.exclusions> + </properties> + <build> <plugins> <!-- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler/src/main/java/org/apache/flex/abc/semantics/PooledValue.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/abc/semantics/PooledValue.java b/compiler/src/main/java/org/apache/flex/abc/semantics/PooledValue.java index 58a99c5..f9dcb23 100644 --- a/compiler/src/main/java/org/apache/flex/abc/semantics/PooledValue.java +++ b/compiler/src/main/java/org/apache/flex/abc/semantics/PooledValue.java @@ -36,35 +36,37 @@ public class PooledValue public PooledValue(Object value) { // Deduce the kind from the value. - if (value instanceof Integer) + if (value instanceof Integer) { this.kind = ABCConstants.CONSTANT_Int; - - else if (value instanceof Long) + } + else if (value instanceof Long) { this.kind = ABCConstants.CONSTANT_UInt; - - else if (value instanceof Double) + } + else if (value instanceof Double) { this.kind = ABCConstants.CONSTANT_Double; - - else if (value instanceof String) + } + else if (value instanceof String) { this.kind = ABCConstants.CONSTANT_Utf8; - - else if (Boolean.TRUE.equals(value)) - this.kind = ABCConstants.CONSTANT_True; - - else if (Boolean.FALSE.equals(value)) - this.kind = ABCConstants.CONSTANT_False; - - else if (ABCConstants.UNDEFINED_VALUE == value) + } + else if (value instanceof Boolean) { + if (Boolean.TRUE.equals(value)) { + this.kind = ABCConstants.CONSTANT_True; + } else { + this.kind = ABCConstants.CONSTANT_False; + } + } + else if (ABCConstants.UNDEFINED_VALUE == value) { this.kind = ABCConstants.CONSTANT_Undefined; - - else if (value == ABCConstants.NULL_VALUE) + } + else if (value == ABCConstants.NULL_VALUE) { this.kind = ABCConstants.CONSTANT_Null; - - else if (value instanceof Namespace) - this.kind = ((Namespace)value).getKind(); - - else + } + else if (value instanceof Namespace) { + this.kind = ((Namespace) value).getKind(); + } + else { throw new IllegalArgumentException("Unknown value class " + value == null ? "null" : value.getClass().toString()); + } this.value = value; } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java index 2bcf249..1fdfeb8 100644 --- a/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java +++ b/compiler/src/main/java/org/apache/flex/compiler/internal/css/CSSFontFace.java @@ -98,7 +98,7 @@ public class CSSFontFace extends CSSNodeBase implements ICSSFontFace checkNotNull(srcValue, "'src' is required in @font-face"); if (srcValue instanceof CSSArrayPropertyValue) - source = (CSSFunctionCallPropertyValue)((CSSArrayPropertyValue)srcValue).getNthChild(0); + source = (CSSFunctionCallPropertyValue)(srcValue).getNthChild(0); else source = (CSSFunctionCallPropertyValue)srcValue; @@ -107,10 +107,8 @@ public class CSSFontFace extends CSSNodeBase implements ICSSFontFace fontStyle = fontStyleValue == null ? "normal" : fontStyleValue.toString(); fontWeight = fontWeightValue == null ? "normal" : fontWeightValue.toString(); - isEmbedAsCFF = embedAsCFFValue == null ? - true : embedAsCFFValue.toString().equalsIgnoreCase("true"); - isAdvancedAntiAliasing = advancedAAValue == null ? - true : advancedAAValue.toString().equalsIgnoreCase("true"); + isEmbedAsCFF = embedAsCFFValue == null || embedAsCFFValue.toString().equalsIgnoreCase("true"); + isAdvancedAntiAliasing = advancedAAValue == null || advancedAAValue.toString().equalsIgnoreCase("true"); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler/src/main/java/org/apache/flex/swc/SWCLibrary.java ---------------------------------------------------------------------- diff --git a/compiler/src/main/java/org/apache/flex/swc/SWCLibrary.java b/compiler/src/main/java/org/apache/flex/swc/SWCLibrary.java index f7707cc..5944760 100644 --- a/compiler/src/main/java/org/apache/flex/swc/SWCLibrary.java +++ b/compiler/src/main/java/org/apache/flex/swc/SWCLibrary.java @@ -111,9 +111,12 @@ public class SWCLibrary implements ISWCLibrary try { swcFile = new ZipFile(swc.getSWCFile()); - final InputStream inputStream = new BufferedInputStream(SWCReader.getInputStream(swcFile, path)); - swfReader.readFrom(inputStream, SWCReader.getReportingPath( - swc.getSWCFile().getAbsolutePath(), path)); + InputStream swcFileInputStream = SWCReader.getInputStream(swcFile, path); + if(swcFileInputStream != null) { + final InputStream inputStream = new BufferedInputStream(swcFileInputStream); + swfReader.readFrom(inputStream, SWCReader.getReportingPath( + swc.getSWCFile().getAbsolutePath(), path)); + } } catch (IOException e) { @@ -129,7 +132,7 @@ public class SWCLibrary implements ISWCLibrary } catch (IOException e) { - throw new RuntimeException(e); + // Ignore this. } } } @@ -161,9 +164,6 @@ public class SWCLibrary implements ISWCLibrary @Override public void addDigest(ISWCDigest digest) { - if (digests == null) - throw new NullPointerException("digest may not be null"); - digests.add(digest); } @@ -174,9 +174,6 @@ public class SWCLibrary implements ISWCLibrary */ public void removeDigest(ISWCDigest digest) { - if (digests == null) - throw new NullPointerException("digest may not be null"); - digests.remove(digest); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg ---------------------------------------------------------------------- diff --git a/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg index df5a793..c49a6d9 100644 --- a/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg +++ b/compiler/src/main/jburg/org/apache/flex/compiler/internal/as/codegen/CmcEmitter.jbg @@ -27,13 +27,13 @@ header import static org.apache.flex.abc.ABCConstants.*; - import org.apache.flex.abc.semantics.Label; +// import org.apache.flex.abc.semantics.Label; import org.apache.flex.abc.semantics.Name; import org.apache.flex.abc.semantics.Namespace; import org.apache.flex.abc.semantics.ECMASupport; import org.apache.flex.abc.instructionlist.InstructionList; - import org.apache.flex.compiler.constants.IASLanguageConstants; +// import org.apache.flex.compiler.constants.IASLanguageConstants; import org.apache.flex.compiler.tree.ASTNodeID; import static org.apache.flex.compiler.tree.ASTNodeID.*; @@ -41,7 +41,7 @@ header import org.apache.flex.compiler.internal.semantics.SemanticUtils; import org.apache.flex.compiler.tree.as.IASNode; - import org.apache.flex.compiler.tree.as.ITryNode; +// import org.apache.flex.compiler.tree.as.ITryNode; } @@ -131,8 +131,8 @@ ReturnType e4x_literal = String; JBurg.Constant ERROR_TRAP = 268435456; { - final static boolean NEED_VALUE = true; - final static boolean DISCARD_VALUE = false; + static final boolean NEED_VALUE = true; + static final boolean DISCARD_VALUE = false; /** http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java ---------------------------------------------------------------------- diff --git a/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java b/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java index a65f650..3a74cfc 100644 --- a/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java +++ b/debugger/src/main/java/flex/tools/debugger/cli/DebugCLI.java @@ -967,10 +967,8 @@ public class DebugCLI implements Runnable, SourceLocator { } sb.append(file.getName()); - if (file != null) { - sb.append("#"); //$NON-NLS-1$ - sb.append(file.getId()); - } + sb.append("#"); //$NON-NLS-1$ + sb.append(file.getId()); sb.append(':'); sb.append(l.getLine()); @@ -1663,7 +1661,7 @@ public class DebugCLI implements Runnable, SourceLocator { if (ar == null) err(getLocalizationManager().getLocalizedTextString("noSourceFilesFound")); //$NON-NLS-1$ else { - for (int i = 0; ar != null && i < ar.length; i++) { + for (int i = 0; i < ar.length; i++) { SourceFile m = ar[i]; listFunctionsFor(sb, m); } @@ -2247,7 +2245,7 @@ public class DebugCLI implements Runnable, SourceLocator { Location newLoc = findAndEnableBreak(swf, f, line); if (newLoc != null) bp.addLocation(newLoc); - else newLoc.getFile(); + else throw new RuntimeException("newLock == null"); dumpAddedBreakpoint(bp); @@ -2852,7 +2850,6 @@ public class DebugCLI implements Runnable, SourceLocator { FileLocation[] fileLocations = new FileLocation[0]; boolean wasAlreadySuspended = false; - boolean switching = false; String arg = null; boolean propagate = true; @@ -2872,6 +2869,7 @@ public class DebugCLI implements Runnable, SourceLocator { fileLocations[0] = fileLocation; } + boolean switching = false; for (FileLocation fileLocation : fileLocations) { isolateId = fileLocation.getIsolateId(); module = fileLocation.getModule(); @@ -2929,10 +2927,6 @@ public class DebugCLI implements Runnable, SourceLocator { continueAndSwapActiveWorkerBack(savedIsolateId, wasAlreadySuspended); } catch (InProgressException e) { e.printStackTrace(); - } finally { - if (switching) { - continueAndSwapActiveWorkerBack(savedIsolateId, wasAlreadySuspended); - } } } @@ -3117,7 +3111,7 @@ public class DebugCLI implements Runnable, SourceLocator { final boolean bpDoesNotExistAtAll = at == -1 && bp == -1; final boolean bpExistsButNotForThisIsolate = at == -1 && bp > -1; - BreakAction b = null; + BreakAction b; if (bpDoesNotExistAtAll) { LocationCollection col = enableBreak(f, line, isolateId); @@ -3136,7 +3130,7 @@ public class DebugCLI implements Runnable, SourceLocator { Location newLoc = findAndEnableBreak(swf, f, line); if (newLoc != null) b.addLocation(newLoc); - else newLoc.getFile(); // force NullPointerException if newLoc == null + else throw new RuntimeException("newLock == null"); } } else return breakpointAt(at); // already set before } @@ -3212,7 +3206,7 @@ public class DebugCLI implements Runnable, SourceLocator { waitTilHalted(m_activeIsolate); int module = propertyGet(LIST_MODULE); int line = propertyGet(LIST_LINE); - int isolateId = propertyGet(LIST_WORKER); + int isolateId; String arg = b.getBreakpointExpression(); @@ -3240,12 +3234,12 @@ public class DebugCLI implements Runnable, SourceLocator { Map<String, Object> args = new HashMap<String, Object>(); String formatString; args.put("breakpointNumber", Integer.toString(b.getId())); //$NON-NLS-1$ - String filename = file.getName(); if (b.isSingleSwf() && file != null) { + String filename = file.getName(); filename = filename + "#" + file.getId(); //$NON-NLS-1$ + args.put("file", filename); //$NON-NLS-1$ } - args.put("file", filename); //$NON-NLS-1$ - args.put("line", new Integer(l.getLine())); //$NON-NLS-1$ + args.put("line", l.getLine()); //$NON-NLS-1$ if (funcName != null) { args.put("functionName", funcName); //$NON-NLS-1$ http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/debugger/src/main/java/flex/tools/debugger/cli/Extensions.java ---------------------------------------------------------------------- diff --git a/debugger/src/main/java/flex/tools/debugger/cli/Extensions.java b/debugger/src/main/java/flex/tools/debugger/cli/Extensions.java index 0222290..d8bb25c 100644 --- a/debugger/src/main/java/flex/tools/debugger/cli/Extensions.java +++ b/debugger/src/main/java/flex/tools/debugger/cli/Extensions.java @@ -128,7 +128,7 @@ public class Extensions cli.err(getLocalizationManager().getLocalizedTextString("key18")); //$NON-NLS-1$ else { - for (int i = 0; ar != null && i < ar.length; i++) + for (int i = 0; i < ar.length; i++) { DModule m = (DModule)ar[i]; m.lineMapping(sb); http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/CompilerAPI.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/CompilerAPI.java b/flex-compiler-oem/src/main/java/flex2/compiler/CompilerAPI.java index a4f7201..c1da312 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/CompilerAPI.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/CompilerAPI.java @@ -108,7 +108,7 @@ public final class CompilerAPI VirtualFile result = null; File file = new File(path); - if (file != null && file.exists()) + if (file.exists()) { try { http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/SourceList.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/SourceList.java b/flex-compiler-oem/src/main/java/flex2/compiler/SourceList.java index ef5258c..06978c5 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/SourceList.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/SourceList.java @@ -105,12 +105,12 @@ public final class SourceList static VirtualFile calculatePathRoot(VirtualFile f, List<File> directories) { String name = f.getName(); - for (int i = 0, size = directories == null ? 0 : directories.size(); i < size; i++) - { - String dir = directories.get(i).getAbsolutePath(); - if (name.startsWith(dir)) - { - return new LocalFile(FileUtil.openFile(dir)); + if(directories != null) { + for (File directory : directories) { + String dir = directory.getAbsolutePath(); + if (name.startsWith(dir)) { + return new LocalFile(FileUtil.openFile(dir)); + } } } // return new LocalFile(FileUtil.openFile(f.getParent())); @@ -119,25 +119,22 @@ public final class SourceList private String calculateRelativePath(String name) { - // C: name is canonical. - for (int i = 0, size = directories == null ? 0 : directories.size(); i < size; i++) - { - // Tack on the separatorChar to handle directories, which - // are the same as other, just longer. Like "a" and "a1". - // See SDK-24084. - String dir = directories.get(i).getAbsolutePath() + File.separatorChar; - - if (name.startsWith(dir)) - { - name = name.substring(dir.length()); - int index = name.lastIndexOf(File.separatorChar); - if (index != -1) - { - return name.substring(0, index).replace(File.separatorChar, '/'); - } - else - { - return ""; + if(directories != null) { + // C: name is canonical. + for (File directory : directories) { + // Tack on the separatorChar to handle directories, which + // are the same as other, just longer. Like "a" and "a1". + // See SDK-24084. + String dir = directory.getAbsolutePath() + File.separatorChar; + + if (name.startsWith(dir)) { + name = name.substring(dir.length()); + int index = name.lastIndexOf(File.separatorChar); + if (index != -1) { + return name.substring(0, index).replace(File.separatorChar, '/'); + } else { + return ""; + } } } } @@ -160,29 +157,25 @@ public final class SourceList { List<Source> sources = new ArrayList<Source>(this.sources.size()); - for (Iterator<String> i = this.sources.keySet().iterator(); i.hasNext();) - { - String name = i.next(); + for (String name : this.sources.keySet()) { Source s = this.sources.get(name); // CompilationUnit u = (s != null) ? s.getCompilationUnit() : null; - if (s != null && !s.exists()) - { + if (s != null && !s.exists()) { // C: This is a SourceList. If the source doesn't exist, the compiler should get a warning... s = null; } - // else if ((u != null && !u.isDone()) || (s != null && s.isUpdated())) - // { - // s.removeCompilationUnit(); - // } - // else if (u != null) - // { - // s = s.copy(); - // assert s != null; - // } - - if (s != null) - { + // else if ((u != null && !u.isDone()) || (s != null && s.isUpdated())) + // { + // s.removeCompilationUnit(); + // } + // else if (u != null) + // { + // s = s.copy(); + // assert s != null; + // } + + if (s != null) { sources.add(s); } } @@ -279,10 +272,8 @@ public final class SourceList */ private boolean isSupported(VirtualFile file) { - for (int i = 0, length = mimeTypes.length; i < length; i++) - { - if (mimeTypes[i].equals(file.getMimeType())) - { + for (String mimeType : mimeTypes) { + if (mimeType.equals(file.getMimeType())) { return true; } } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java b/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java index 24c8998..4da4828 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/common/CompilerConfiguration.java @@ -340,12 +340,15 @@ public class CompilerConfiguration implements As3Configuration, private File[] toFileArray(String[] files) { - File[] fileArray = new File[files != null ? files.length : 0]; - for (int i = 0, length = files.length; i < length; i++) - { - fileArray[i] = new File(files[i]); - } - return fileArray; + if(files != null) { + File[] fileArray = new File[files.length]; + int length = files.length; + for (int i = 0; i < length; i++) { + fileArray[i] = new File(files[i]); + } + return fileArray; + } + return new File[0]; } private Set<String> externs = new HashSet<String>(); @@ -1570,7 +1573,7 @@ public class CompilerConfiguration implements As3Configuration, servicesConfigFile = ConfigurationPathResolver.getVirtualFile(servicesPath, configResolver, cv); } - catch(Throwable t) + catch(Exception e) { throw new ConfigurationException.CannotOpen( servicesPath, cv.getVar(), cv.getSource(), cv.getLine() ); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/common/Configuration.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/common/Configuration.java b/flex-compiler-oem/src/main/java/flex2/compiler/common/Configuration.java index 7f26804..bfb396a 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/common/Configuration.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/common/Configuration.java @@ -753,16 +753,17 @@ public class Configuration implements LinkerConfiguration, Cloneable protected List<String> toQNameString(List<String> vals) { - for (int i = 0, size = vals == null ? 0 : vals.size(); i < size; i++) - { - String name = vals.get(i); - if ((name.indexOf( ':' ) == -1) && (name.indexOf( '.' ) != -1)) - { - int dot = name.lastIndexOf( '.' ); - name = name.substring( 0, dot ) + ':' + name.substring( dot + 1 ); + if(vals != null) { + int size = vals.size(); + for (int i = 0; i < size; i++) { + String name = vals.get(i); + if ((name.indexOf(':') == -1) && (name.indexOf('.') != -1)) { + int dot = name.lastIndexOf('.'); + name = name.substring(0, dot) + ':' + name.substring(dot + 1); + } + vals.set(i, name); } - vals.set(i, name); - } + } return vals; } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/common/ConfigurationPathResolver.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/common/ConfigurationPathResolver.java b/flex-compiler-oem/src/main/java/flex2/compiler/common/ConfigurationPathResolver.java index cbc57e4..5d1c775 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/common/ConfigurationPathResolver.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/common/ConfigurationPathResolver.java @@ -79,13 +79,14 @@ public class ConfigurationPathResolver implements SinglePathResolver } else { - // C: must convert 'absoluteOrRelativeFile' into absolute before calling exists(). - absoluteOrRelativeFile = absoluteOrRelativeFile.getAbsoluteFile(); - if ((absoluteOrRelativeFile != null) && - absoluteOrRelativeFile.exists()) - // && !FileUtils.isAbsolute(absoluteOrRelativeFile) - { - resolved = new LocalFile(absoluteOrRelativeFile); + if(absoluteOrRelativeFile != null) { + // C: must convert 'absoluteOrRelativeFile' into absolute before calling exists(). + absoluteOrRelativeFile = absoluteOrRelativeFile.getAbsoluteFile(); + if (absoluteOrRelativeFile.exists()) + // && !FileUtils.isAbsolute(absoluteOrRelativeFile) + { + resolved = new LocalFile(absoluteOrRelativeFile); + } } } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/common/NamespacesConfiguration.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/common/NamespacesConfiguration.java b/flex-compiler-oem/src/main/java/flex2/compiler/common/NamespacesConfiguration.java index df9ebf3..6f82a8f 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/common/NamespacesConfiguration.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/common/NamespacesConfiguration.java @@ -117,9 +117,8 @@ public class NamespacesConfiguration throw new ConfigurationException.NamespaceMissingManifest("namespace", cfgval.getSource(), cfgval.getLine()); } - PathResolver resolver = new PathResolver(); - assert resolver != null && configResolver != null: "Path resolvers must be set before calling this method."; - if (resolver == null || configResolver == null) + assert configResolver != null: "Path resolvers must be set before calling this method."; + if (configResolver == null) { throw new ConfigurationException.CannotOpen(null, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() ); } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/config/CommandLineConfigurator.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/config/CommandLineConfigurator.java b/flex-compiler-oem/src/main/java/flex2/compiler/config/CommandLineConfigurator.java index 3c07a6f..79920cf 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/config/CommandLineConfigurator.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/config/CommandLineConfigurator.java @@ -301,7 +301,7 @@ public class CommandLineConfigurator if (vars.contains( var )) { - if ((defaultvar != null) && var.equals( defaultvar )) + if ((defaultvar != null) && (var != null) && var.equals( defaultvar )) { // we could perhaps accumulate the defaults spread out through // the rest of the flags, but for now we'll call this illegal. http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/config/ConfigurationBuffer.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/config/ConfigurationBuffer.java b/flex-compiler-oem/src/main/java/flex2/compiler/config/ConfigurationBuffer.java index 9116885..7069e11 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/config/ConfigurationBuffer.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/config/ConfigurationBuffer.java @@ -19,8 +19,6 @@ package flex2.compiler.config; -//import flash.util.Trace; - import java.util.Map; import java.util.HashMap; import java.util.List; @@ -248,12 +246,8 @@ public final class ConfigurationBuffer } } */ - if (value == null) - - { - throw new ConfigurationException.Token( ConfigurationException.Token.UNKNOWN_TOKEN, - token, var, source, line ); - } + throw new ConfigurationException.Token( ConfigurationException.Token.UNKNOWN_TOKEN, + token, var, source, line ); } arg = arg.substring( 0, o ) + value + arg.substring( c + 1 ); @@ -444,23 +438,24 @@ public final class ConfigurationBuffer String getterMethodName = GET_PREFIX + setterMethod.getName().substring( SET_PREFIX.length() ); Class cfgClass = setterMethod.getDeclaringClass(); - Method infoMethod = null, getterMethod = null; + Method infoMethod, getterMethod = null; try { infoMethod = cfgClass.getMethod( infoMethodName, (Class[])null); - if (!Modifier.isStatic( infoMethod.getModifiers() ) ) - { + if (Modifier.isStatic( infoMethod.getModifiers() ) ) { + info = (ConfigurationInfo) infoMethod.invoke(null, (Object[]) null); + + getterMethod = cfgClass.getMethod(getterMethodName, (Class[]) null); + } + else { assert false : ( "coding error: " + cfgClass.getName() + "." + infoMethodName + " needs to be static!" ); - infoMethod = null; } - - info = (ConfigurationInfo) infoMethod.invoke( null, (Object[])null ); - - getterMethod = cfgClass.getMethod( getterMethodName, (Class[])null); } catch (Exception e) - {} + { + // Ignore + } if (info == null) { @@ -612,12 +607,11 @@ public final class ConfigurationBuffer String var = unalias( avar ); ConfigurationInfo info = getInfo( var ); - if (info == null) - { - assert false : ( "must call isValid to check vars!" ); + assert info == null : ( "must call isValid to check vars!" ); + if (info != null) { + return info.getArgName( argnum ); } - - return info.getArgName( argnum ); + return null; } public boolean isValidVar( String avar ) http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/config/ServicesDependenciesWrapper.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/config/ServicesDependenciesWrapper.java b/flex-compiler-oem/src/main/java/flex2/compiler/config/ServicesDependenciesWrapper.java index ba8c522..cb9f97a 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/config/ServicesDependenciesWrapper.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/config/ServicesDependenciesWrapper.java @@ -89,7 +89,7 @@ public class ServicesDependenciesWrapper arglist[0] = destination; return (Set)method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -111,7 +111,7 @@ public class ServicesDependenciesWrapper arglist[1] = associationProp; method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -129,7 +129,7 @@ public class ServicesDependenciesWrapper Object arglist[] = new Object[0]; return (String)method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -149,7 +149,7 @@ public class ServicesDependenciesWrapper Object arglist[] = new Object[0]; return (String)method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -169,7 +169,7 @@ public class ServicesDependenciesWrapper Object arglist[] = new Object[0]; return (String)method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -189,7 +189,7 @@ public class ServicesDependenciesWrapper Object arglist[] = new Object[0]; return (List)method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -209,7 +209,7 @@ public class ServicesDependenciesWrapper Object arglist[] = new Object[0]; method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -229,7 +229,7 @@ public class ServicesDependenciesWrapper arglist[1] = modified; method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -247,7 +247,7 @@ public class ServicesDependenciesWrapper Object arglist[] = new Object[0]; return (Map)method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } @@ -292,7 +292,7 @@ public class ServicesDependenciesWrapper parserClass = Class.forName(className); parser = (ConfigurationParser)parserClass.newInstance(); } - catch (Throwable t) + catch (Exception t) { if (traceConfig) { @@ -311,7 +311,7 @@ public class ServicesDependenciesWrapper parserClass = Class.forName(className); parser = (ConfigurationParser)parserClass.newInstance(); } - catch (Throwable t) + catch (Exception t) { if (traceConfig) { @@ -332,7 +332,7 @@ public class ServicesDependenciesWrapper parser = (ConfigurationParser)parserClass.newInstance(); } - catch (Throwable t) + catch (Exception t) { if (traceConfig) { @@ -385,7 +385,7 @@ public class ServicesDependenciesWrapper arglist[3] = relation; method.invoke(servicesDependenciesInstance, arglist); } - catch (Throwable e) + catch (Exception e) { } http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/f496ac38/flex-compiler-oem/src/main/java/flex2/compiler/extensions/ExtensionsConfiguration.java ---------------------------------------------------------------------- diff --git a/flex-compiler-oem/src/main/java/flex2/compiler/extensions/ExtensionsConfiguration.java b/flex-compiler-oem/src/main/java/flex2/compiler/extensions/ExtensionsConfiguration.java index 13f5296..bf2b1de 100644 --- a/flex-compiler-oem/src/main/java/flex2/compiler/extensions/ExtensionsConfiguration.java +++ b/flex-compiler-oem/src/main/java/flex2/compiler/extensions/ExtensionsConfiguration.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Map; import flex2.compiler.common.ConfigurationPathResolver; -import flex2.compiler.common.PathResolver; import flex2.compiler.config.ConfigurationException; import flex2.compiler.config.ConfigurationInfo; import flex2.compiler.config.ConfigurationValue; @@ -67,11 +66,11 @@ public class ExtensionsConfiguration // 'compiler.extensions.extension' option // - public File[] getExtension() + public String[] getExtension() { if ( extensionMappings != null ) { - return extensionMappings.keySet().toArray( new File[0] ); + return extensionMappings.keySet().toArray( new String[0] ); } else { @@ -96,9 +95,7 @@ public class ExtensionsConfiguration throw new ConfigurationException.CannotOpen( null, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() ); } - PathResolver resolver = new PathResolver(); - - if ( resolver == null || configResolver == null ) + if ( configResolver == null ) { throw new ConfigurationException.CannotOpen( null, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() ); }
