Skip to content

Commit

Permalink
Cleanup warning/whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasblaesing committed Feb 21, 2024
1 parent 77257c4 commit ad8920c
Show file tree
Hide file tree
Showing 4 changed files with 220 additions and 205 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,25 @@
* @author Tomasz.Slota@Sun.COM
*/
public abstract class JSPProcessor {
protected static final Logger logger = Logger.getLogger(JSPProcessor.class.getName());
//static cache of FileObject---ParserData
private static final WeakHashMap<FileObject, ParserData> PARSER_DATA_CACHE = new WeakHashMap<>();

protected Document doc;
protected FileObject fobj;
protected static final Logger logger = Logger.getLogger(JSPProcessor.class.getName());
protected boolean processCalled = false;
protected boolean processingSuccessful = true;

//static cache of FileObject---ParserData
private static final WeakHashMap<FileObject, ParserData> PARSER_DATA_CACHE = new WeakHashMap<FileObject, ParserData>();

private ParserData parserData;
private boolean processCalled = false;
private boolean jakartaVariant = false;
private ParserData parserData;

private static class ParserData {
private JspParserAPI.ParseResult parserResult;
private JspColoringData coloringData;
private final JspParserAPI.ParseResult parserResult;
private final JspColoringData coloringData;

public ParserData(JspParserAPI.ParseResult parserResult, JspColoringData coloringData) {
assert parserResult != null;

this.parserResult = parserResult;
this.coloringData = coloringData;
}
Expand All @@ -88,7 +87,7 @@ public ParseResult getParserResult() {

private ParserData getParserData() {
assert parserData != null; //never allow to return null

return parserData;
}

Expand All @@ -111,7 +110,10 @@ protected String createBeanVarDeclarations(List<String> localBeans) {
if (beanData != null) {
for (PageInfo.BeanData bean : beanData) {
if (!localBeans.contains(bean.getId())) {
beanDeclarationsBuff.append(bean.getClassName() + " " + bean.getId() + ";\n"); //NOI18N
beanDeclarationsBuff.append(bean.getClassName());
beanDeclarationsBuff.append(" "); //NOI18N
beanDeclarationsBuff.append(bean.getId());
beanDeclarationsBuff.append(";\n"); //NOI18N
}
}
}
Expand All @@ -120,7 +122,10 @@ protected String createBeanVarDeclarations(List<String> localBeans) {
for (TagAttributeInfo info : pageInfo.getTagInfo().getAttributes()) {
if (info.getTypeName() != null) { // will be null e.g. for fragment attrs
if (!localBeans.contains(info.getName())) {
beanDeclarationsBuff.append(info.getTypeName() + " " + info.getName() + ";\n"); //NOI18N
beanDeclarationsBuff.append(info.getTypeName());
beanDeclarationsBuff.append(" "); //NOI18N
beanDeclarationsBuff.append(info.getName());
beanDeclarationsBuff.append(";\n"); //NOI18N
}
}
}
Expand Down Expand Up @@ -195,7 +200,7 @@ protected void processIncludes(boolean onlyPrelude, final String path) {
return;
}

final Collection<String> processedFiles = new TreeSet<String>(processedIncludes());
final Collection<String> processedFiles = new TreeSet<>(processedIncludes());
processedFiles.add(fobj.getPath());

if (pageInfo.getIncludePrelude() != null) {
Expand Down Expand Up @@ -249,16 +254,14 @@ private void processIncludedFile(String filePath, Collection<String> processedFi
processIncludedFile(includedJSPFileProcessor);
}
}
} catch (IOException e) {
logger.log(Level.WARNING, e.getMessage(), e);
} catch (BadLocationException e) {
} catch (IOException | BadLocationException e) {
logger.log(Level.WARNING, e.getMessage(), e);
}
}
}

public static boolean ignoreLockFromUnitTest = false;

public synchronized void process() throws BadLocationException {
processCalled = true;

Expand Down Expand Up @@ -322,15 +325,12 @@ public synchronized void process() throws BadLocationException {

}

final AtomicReference<BadLocationException> ble = new AtomicReference<BadLocationException>();
doc.render(new Runnable() {

public void run() {
try {
renderProcess();
} catch (BadLocationException ex) {
ble.set(ex);
}
final AtomicReference<BadLocationException> ble = new AtomicReference<>();
doc.render(() -> {
try {
renderProcess();
} catch (BadLocationException ex) {
ble.set(ex);
}
});
if (ble.get() != null) {
Expand All @@ -339,7 +339,7 @@ public void run() {
}

protected abstract void processIncludedFile(IncludedJSPFileProcessor includedJSPFileProcessor);

protected abstract void renderProcess() throws BadLocationException;

/**
Expand All @@ -359,7 +359,9 @@ protected String createImplicitImportStatements(List<String> localImports) {
// (JSP doesn't belong to a project)
for (String pckg : imports) {
if (!localImports.contains(pckg)) {
importsBuff.append("import " + pckg + ";\n"); //NOI18N
importsBuff.append("import "); //NOI18N
importsBuff.append(pckg);
importsBuff.append(";\n"); //NOI18N
}
}
}
Expand Down
Loading

0 comments on commit ad8920c

Please sign in to comment.