use of org.jetbrains.annotations.Nullable in project scss-lint-plugin by idok.
the class ThreadLocalActualFile method createFile.
@Nullable
private File createFile() {
// File retFile = new File(file.getParent().getPath(), file.getNameWithoutExtension() + "_jscs_tmp." + file.getExtension());
File retFile = createFileAsSibling();
if (retFile != null) {
return retFile;
}
// try to create a temp file in temp folder
File dir = getOrCreateTempDir();
if (dir == null) {
return null;
}
File file = new File(dir, this.baseName + this.extension);
boolean created = false;
if (!file.exists()) {
try {
created = file.createNewFile();
} catch (IOException ignored) {
LOG.warn("Can not create " + file.getAbsolutePath());
}
}
if (!created) {
try {
file = FileUtil.createTempFile(dir, this.baseName, this.extension);
} catch (IOException e) {
LOG.warn("Can not create temp file", e);
return null;
}
}
file.deleteOnExit();
return file;
}
use of org.jetbrains.annotations.Nullable in project cassandra-mesos-deprecated by mesosphere.
the class SeedManagerTest method before.
@Before
public void before() {
InMemoryState state = new InMemoryState();
PersistedCassandraFrameworkConfiguration config = new PersistedCassandraFrameworkConfiguration(state, "name", 60, 30, "2.1", 0.5, 1024, 1024, 512, 1, 1, "role", "./backup", ".", false, true, "RACK1", "DC1", Arrays.asList(ExternalDc.newBuilder().setName("dc").setUrl("http://dc").build()), "name");
seedManager = new SeedManager(config, new ObjectMapper(), new SystemClock()) {
@Override
@Nullable
protected JsonNode fetchJson(@NotNull final String url) {
try {
return new ObjectMapper().readTree(jsonResponse);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
};
}
use of org.jetbrains.annotations.Nullable in project android-parcelable-intellij-plugin by mcharmas.
the class GenerateDialog method createSouthPanel.
@Nullable
@Override
protected JComponent createSouthPanel() {
JComponent southPanel = super.createSouthPanel();
if (showCheckbox && southPanel != null) {
final VerticalBox combinedView = new VerticalBox();
combinedView.add(includeSubclasses);
combinedView.add(southPanel);
return combinedView;
} else {
return southPanel;
}
}
use of org.jetbrains.annotations.Nullable in project languagetool by languagetool-org.
the class PatternRuleQueryBuilder method getPosQueryOrNull.
@Nullable
private BooleanClause getPosQueryOrNull(PatternToken patternToken, String pos) throws UnsupportedPatternRuleException {
if (pos == null || pos.isEmpty()) {
return null;
}
Query posQuery;
Term posQueryTerm;
if (patternToken.getPOSNegation() || patternToken.getMinOccurrence() == 0) {
// we need to ignore this - negation, if any, must happen at the same position
return null;
} else if (patternToken.isPOStagRegularExpression()) {
posQueryTerm = getQueryTerm(patternToken, POS_PREFIX + "(", pos, ")");
posQuery = getRegexQuery(posQueryTerm, pos, patternToken);
} else {
posQueryTerm = getQueryTerm(patternToken, POS_PREFIX, pos, "");
posQuery = new TermQuery(posQueryTerm);
}
return new BooleanClause(posQuery, BooleanClause.Occur.MUST);
}
use of org.jetbrains.annotations.Nullable in project languagetool by languagetool-org.
the class JLanguageTool method getBuildDate.
/**
* Returns the build date or {@code null} if not run from JAR.
*/
@Nullable
private static String getBuildDate() {
try {
URL res = JLanguageTool.class.getResource(JLanguageTool.class.getSimpleName() + ".class");
if (res == null) {
// this will happen on Android, see http://stackoverflow.com/questions/15371274/
return null;
}
Object connObj = res.openConnection();
if (connObj instanceof JarURLConnection) {
JarURLConnection conn = (JarURLConnection) connObj;
Manifest manifest = conn.getManifest();
return manifest.getMainAttributes().getValue("Implementation-Date");
} else {
return null;
}
} catch (IOException e) {
throw new RuntimeException("Could not get build date from JAR", e);
}
}
Aggregations