Commits

Richard Atkins committed 1403bb9

SOY-29 Dev mode broke too

Comments (0)

Files changed (2)

soy-template-plugin/src/main/java/com/atlassian/soy/impl/DefaultSoyManager.java

 
     private boolean isModified(String completeModuleKey)
     {
-        final Long previousModifiedDate = lastModifiedCache.getUnchecked(completeModuleKey);
-        final long currentModifiedDate = getLastModifiedForModule(completeModuleKey);
-        return previousModifiedDate < currentModifiedDate || currentModifiedDate == -1;
+        try
+        {
+            final Long previousModifiedDate = lastModifiedCache.getUnchecked(completeModuleKey);
+            final long currentModifiedDate = getLastModifiedForModule(completeModuleKey);
+            return previousModifiedDate < currentModifiedDate || currentModifiedDate == -1;
+        }
+        catch (UncheckedExecutionException e)
+        {
+            log.debug("Unable to check resolve the module key '{}'. Treating as modified", completeModuleKey, e);
+            return true;
+        }
     }
 
     private static long getLastModified(URL url)

soy-template-plugin/src/test/java/com/atlassian/soy/impl/DefaultSoyManagerTest.java

 import com.atlassian.soy.impl.data.SoyDataConverter;
 import com.atlassian.soy.impl.modules.GuiceModuleSupplier;
 import com.atlassian.soy.renderer.SoyException;
+import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
         expectedException.expect(SoyException.class);
         manager.render(writer, "enabledPlugin:disabledModule", "myTemplate", Collections.<String, Object>emptyMap(), Collections.<String, Object>emptyMap());
     }
+
+    // SOY-29
+    @Test
+    public void disabledModuleKeyInDevModeAlsoTriggersSoyException() throws SoyException
+    {
+        when(pluginAccessor.getEnabledPluginModule("enabledPlugin:disabledModule")).thenReturn(null);
+        SoyManager manager = new DefaultSoyManager(pluginAccessor, pluginEventManager, servletContextFactory, moduleSupplier, soyDataConverter);
+        StringWriter writer = new StringWriter();
+        System.setProperty("atlassian.dev.mode", "true");
+
+        expectedException.expect(SoyException.class);
+        manager.render(writer, "enabledPlugin:disabledModule", "myTemplate", Collections.<String, Object>emptyMap(),
+            Collections.<String, Object>emptyMap());
+    }
+
+    @After
+    public void clearDevMode()
+    {
+        System.clearProperty("atlassian.dev.mode");
+    }
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.