Skip to content
Permalink
Browse files

[ci skip] Initial fix for issue 1341

Removes static variable for attribute in UmpleModel
  • Loading branch information...
ZainabAlShowely committed Jul 19, 2018
1 parent 0d1e871 commit 1ad2722e46202e2c9773356c219c31f11a654dc2
@@ -402,7 +402,7 @@ for (StateMachine smq : uClass.getStateMachines())
<<=uClass.getExtraCode()>>


<<# } #>><<@ UmpleToJava.trace >><<#if(uClass!=mainMainClass){#>>
<<# } #>><<@ UmpleToJava.trace >><<#if(model.getMainClassName() != uClass.getName()){#>>
}<<#}
return realSb.toString();
}
@@ -81,17 +81,16 @@ class UmpleToJava {
&&paramType.equals("String")&&isList.equals(" [] "))
{
String exceptionHandlerPackage = "";
if(mainMainClass!=null)
if(model.getMainClassName() != null)
{
exceptionHandlerPackage = mainMainClass.getPackageName()+"."+mainMainClass.getName()+".";
exceptionHandlerPackage = model.getMainClassName()+".";
}
else
{
mainMainClass = uClass;
model.setMainClassName(uClass.getName());
}
properMethodBody = " Thread.currentThread().setUncaughtExceptionHandler(new "+exceptionHandlerPackage+"UmpleExceptionHandler());\n"+
" Thread.setDefaultUncaughtExceptionHandler(new "+exceptionHandlerPackage+"UmpleExceptionHandler());\n"+properMethodBody;
uClass.setHasMainMethod(true);
}

if (aMethod.numberOfComments() > 0) { append(realSb, "\n\n {0}", Comment.format("Method Javadoc",aMethod.getComments())); }
@@ -1,7 +1,6 @@
class UmpleToJava {
uncaught_exception <<!<</*uncaught_exception*/>><<#
java.util.regex.Pattern lineNumberPattern = java.util.regex.Pattern.compile("// line ([0|1|2|3|4|5|6|7|8|9]*) \"(.*)\"");
public static UmpleClass mainMainClass = null;
private void addUncaughtExceptionVariables(int javaline, String code, String methodname)
{
String[] lines = code.split("\\n");
@@ -60,7 +60,6 @@ public void run(IAction action)
boolean successfulCompilation;
UmpleModel model;
String pjName ;
JavaClassGenerator.mainMainClass = null;
try
{
MessageConsole umpleConsole = findConsole("Umple Compile");
@@ -50,6 +50,7 @@ class UmpleModel
Glossary glossary = new Glossary();
String defaultNamespace = null;
String code = null;
String mainClassName = null;
Boolean debugMode = false;
ParseResult lastResult = null;
public static final String[] validLanguages = findValidLanguages();
@@ -173,11 +173,7 @@ public void assertUmpleProxyFor(String umpleFile, String codeFile, String classN

@After
public void tearDown() {
/* Nullify mainMainClass. It's a static variable, if we don't do this the state will
* affect the next set of JUnit tests that use mainMainClass.
*/
super.tearDown();
JavaClassGenerator.mainMainClass = null;
}

@Test
@@ -52,8 +52,6 @@ private void initUmpleModel(){
if (!(new File(checkFile).exists())) {
Assert.fail("Unable to locate umple file: " + checkFile);
}
// Nullify mainMainClass
JavaClassGenerator.mainMainClass = null;
UmpleFile umpFile = new UmpleFile(getPath());
umpleModel = new UmpleModel(umpFile);
}
@@ -89,8 +89,6 @@ private void initTestResources(){
}
}

// Nullify mainMainClass
JavaClassGenerator.mainMainClass = null;
UmpleFile umpFile = new UmpleFile(getPath(), getModelFilename());
umpleModel = new UmpleModel(umpFile);
umpleModel.setShouldGenerate(false);
@@ -236,8 +234,6 @@ public void destroy() {
SampleFileWriter.destroy(filePath);
}
}
// Nullify mainMainClass
JavaClassGenerator.mainMainClass = null;
}

public void setPath(String aPath) {

0 comments on commit 1ad2722

Please sign in to comment.
You can’t perform that action at this time.