@Override public void error(String msg) { log.error(msg); } };
/** * Setup generated sources folder if missing. */ private void prepareGeneratedSourcesFolder() { if (!generatedSourcesDirectory.exists() && !generatedSourcesDirectory.mkdirs()) { log.error("Could not create " + generatedSourcesDirectory); } }
private static void deleteCssFileFromDirectory(@NotNull final File directory, @NotNull final Logger logger) { final File gnagCssOutputFile = new File(directory, CSS_FILE_NAME); if (gnagCssOutputFile.exists()) { try { FileUtils.forceDelete(gnagCssOutputFile); } catch (final IOException e) { logger.error("Error deleting CSS file for local Gnag report."); } } }
private static void copyCssFileToDirectory(@NotNull final File directory, @NotNull final Logger logger) { try { //TODO fix this final InputStream resourceAsStream = ReportWriter.class.getClassLoader() .getResourceAsStream(CSS_FILE_NAME); final File gnagCssOutputFile = new File(directory, CSS_FILE_NAME); FileUtils.copyInputStreamToFile(resourceAsStream, gnagCssOutputFile); } catch (final Exception e) { logger.error("Error copying CSS file for local Gnag report.", e); } }
private String getOriginGitRepo() { try { return gitOriginRepoProvider.getOriginGitRepo(); } catch(Exception e){ LOG.error("Failed to get url of git remote origin. Using fallback '" + FALLBACK_GITHUB_REPO + "' instead.\n" + "You can change GitHub repository manually in " + configFile, e); return FALLBACK_GITHUB_REPO; } }
public void writeImplementation(String name, String data) { logger.debug("writing Implementatio data : {}", data); try { Files.write(this.internalPath.resolve(name), data.getBytes()); } catch (IOException e) { logger.error("error writing Implementatio ", e); } }
private void reportErrorIfNecessary(List<TestClassResult> results, File reportDir) { int totalFailureCount = results.stream().mapToInt(TestClassResult::getFailuresCount).sum(); String message = "There are " + totalFailureCount + " failed tests. Please see " + toUnixString(new File(reportDir, "index.html")) + " for more details."; if (continueOnFailure) { LOGGER.error(message); } else if (totalFailureCount > 0) { throw new IllegalStateException(message); } }
public void writeInterface(String name, String data) { logger.debug("writing Interface data : {}", data); try { Files.write(this.capi.resolve(name), data.getBytes()); } catch (IOException e) { logger.error("error writing Interface ", e); } }
public void writeFactory(String name, String data) { logger.debug("writing Factory data : {}", data); try { Files.write(this.internalPath.resolve(name), data.getBytes()); } catch (IOException e) { logger.error("error writing Factory ", e); } }
public JodaBeansGenerator() { final ClassLoader classLoader = obtainClassLoader(); try { toolClass = classLoader.loadClass(JODA_BEANS_CODE_GEN_CLASS); version = Version.from(Arrays.asList( toolClass.getPackage().getImplementationVersion().replaceAll("-SNAPSHOT", "").split("\\."))); } catch (final Exception ex) { getLogger().error("Skipping as Joda-Beans is not in the project compile classpath"); } }
private void error(String error) { if (dieWithError) { throw new RuntimeException(error); } else { this.setDidWork(false); getLogger().error(error); } }
private void waitForCompletionOf(List<Thread> taskThreads) throws InterruptedException { for(Thread taskThread : taskThreads) { try { taskThread.join(); } catch(InterruptedException ie) { getProject().getLogger().error("Error waiting for completion of task thread."); throw ie; } } } }
@ErrorFunction @SuppressWarnings("unused") public void error(String message) { getLogger().error(message); }
@Override public void execute(Project project) { Set<Task> preBuildTasks = project.getTasksByName("preBuild", false); if (preBuildTasks.isEmpty()) { project.getLogger().error("The Android plugin 'preBuild' task could not be found. Skipping SVG generation..."); } else { preBuildTasks.iterator().next().dependsOn(project.getTasks().withType(SvgDrawableTask.class)); } } });
@ErrorFunction @SuppressWarnings("unused") public void error(String message) { getLogger().error(message); }
@TaskAction public void scan() { try (Scanner scanner = new Scanner(classpath)) { for (File source : sources) { scanner.scan(source); } } catch (IOException e) { getLogger().error("Failed to write API file", e); } }
private void checkPrerequisites(Project project) { try { project.getPlugins().getPlugin("java"); } catch (UnknownPluginException e) { String message = "Unable to apply plugin " + JAVA_TOOLS_PLUGIN_NAME + "; please apply java or java-library plugin first"; project.getLogger().error(message); throw new GradleException(message, e); } }
public static void setThreadPoolSize(Project project) { if (!project.hasProperty(THREAD_POOL_SIZE_PROPERTY)) { return; } String threadPoolSizeProperty = project.property(THREAD_POOL_SIZE_PROPERTY).toString(); try { ExecutorSingleton.setThreadPoolSize(Integer.parseInt(threadPoolSizeProperty)); } catch (NumberFormatException e) { project.getLogger().error("com.android.threadPoolSize should be an integer."); } } }
private void sleepBeforeStop() { PostgresqlEmbeddedExtension extension = getProject().getExtensions().getByType(PostgresqlEmbeddedExtension.class); if (extension.getTimeoutMillisBeforeStop() > 0) { getLogger().info("Sleeping {} millis before stopping postgres", extension.getTimeoutMillisBeforeStop()); try { Thread.sleep(extension.getTimeoutMillisBeforeStop()); } catch (InterruptedException e) { getLogger().error("", e); } } } }