Skip to content

Commit

Permalink
Merge pull request ControlSystemStudio#3004 from lcaouen/develop
Browse files Browse the repository at this point in the history
Macro values are not replaced correctly
  • Loading branch information
kasemir authored Jun 12, 2024
2 parents 3fafd88 + 70ab29e commit 4f977be
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.logging.Level;

import org.csstudio.display.builder.model.DisplayModel;
import org.csstudio.display.builder.model.macros.MacroHandler;
import org.phoebus.framework.macros.Macros;
import org.phoebus.framework.util.ResourceParser;

Expand Down Expand Up @@ -242,14 +243,25 @@ else if (path.contains(":"))
}
else
buf.append('&');

String macroValue = macros.getValue(name);
// macro can be defined after component creation
// replace again macros by the correct value
try {
macroValue = MacroHandler.replace(macros, macroValue);
} catch (Exception ex) {
logger.log(Level.SEVERE, "Internal error in MacroHandler.replace '" + macroValue + "'", ex);
}

buf.append(name)
.append('=')
.append(encode(macros.getValue(name)));
.append(encode(macroValue));
}
String strBuffer = buf.toString();

try
{
return new URI(buf.toString());
return new URI(strBuffer);
}
catch (URISyntaxException ex)
{
Expand Down

0 comments on commit 4f977be

Please sign in to comment.