Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

squid:CommentedOutCodeLine - Sections of code should not be "commented out". #558

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![License](http://img.shields.io/:license-apache-blue.svg)
[![Gitter](https://badges.gitter.im/davidsowerby/krail.svg)](https://gitter.im/davidsowerby/krail?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Build Status](https://travis-ci.org/davidsowerby/krailkrail.svg?branch=master)](https://travis-ci.org/davidsowerby/krail)
[![Build Status](https://travis-ci.org/davidsowerby/krail.svg?branch=master)](https://travis-ci.org/davidsowerby/krail)
[![Coverage Status](https://coveralls.io/repos/github/davidsowerby/krail/badge.svg?branch=master)](https://coveralls.io/github/davidsowerby/krail?branch=master)

Krail provides a framework for rapid Java web development by combining Vaadin, Guice, Apache Shiro, Apache Commons Configuration and others. For more information, see the comprehensive [Tutorial](http://krail.readthedocs.org/en/master/), which also makes a reasonable demo. (You can clone directly from the [Tutorial repo](https://github.com/davidsowerby/krail-tutorial))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ public void setLocale(Locale locale, boolean fireListeners) {

if (locale != this.locale) {
this.locale = locale;
// Locale.setDefault(locale);
log.debug("CurrentLocale set to {}", locale);
if (fireListeners) {
log.debug("publish locale change");
Expand Down
1 change: 0 additions & 1 deletion src/main/java/uk/q3c/krail/core/i18n/DefaultTranslate.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public String from(boolean checkLocaleIsSupported, @Nullable I18NKey key, @Nonnu
if (key == null) {
return "key is null";
}
// E k = typeBridge(key);
String pattern = patternSource.retrievePattern((Enum) key, locale);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public PageRecord deconstruct(String line, int lineNumber) {
syntaxErrors.add(missingLabelKeyMsg + " at line " + lineNumber);
return null;
}
// if (!line.contains(":")) {
// syntaxErrors.add(missingViewMsg + " at line " + lineNumber);
// return null;
// }
if (!line.contains("=")) {
syntaxErrors.add(missingUriMsg + " at line " + lineNumber);
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public synchronized MasterSitemapNode append(NodeRecord nodeRecord) {
// find the node (parent) to attach to, by looping and removing the trailing segment each
// time until we find a matching node or run out of segments
List<String> segments = new ArrayList(navState.getPathSegments());
// segments.remove(segments.size() - 1);

MasterSitemapNode node = null;
while ((segments.size() > 0) && (node == null)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ private void redirectCheck(MasterSitemap sitemap) {
} catch (CycleDetectedException cde) {
String msg = MessageFormat.format("Redirecting {0} to {1} would cause a loop", entry.getKey(), entry.getValue());
redirectLoops.add(msg);
// throw new CycleDetectedException(msg);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ public synchronized void buildUriMap() {
public boolean hasNoVisibleChildren(@Nonnull UserSitemapNode sourceNode) {
checkNotNull(sourceNode);
List<UserSitemapNode> children = this.getChildren(sourceNode);
// if (children == null) { //FindBugs reports this unnecessary
// return true;
// }
for (UserSitemapNode child : children) {
if (child.getPositionIndex() >= 0) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

public class StandardPagesModule extends DirectSitemapModule {

// private MapBinder<String, StandardPageSitemapEntry> mapBinder;
// private MapBinder<String, RedirectEntry> redirectBinder;

/**
* Override this method to define different {@link MasterSitemap} entries for Standard Pages. All of the views
* specified
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
*
* * Copyright (c) 2016. David Sowerby
* *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class KrailErrorHandler extends DefaultErrorHandler {
private final NotAGuestExceptionHandler notAGuestExceptionHandler;
private final NotAUserExceptionHandler notAUserExceptionHandler;
private final UnauthorizedExceptionHandler authorisationHandler;
// private final InvalidURIHandler invalidUriHandler;
private final Navigator navigator;
private UserNotifier userNotifier;

Expand Down
56 changes: 0 additions & 56 deletions src/main/java/uk/q3c/krail/core/sysadmin/I18NView.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,6 @@ protected void doBuild(ViewChangeBusMessage busMessage) {
protected void export() {

userNotifier.notifyInformation(LabelKey.This_feature_has_not_been_implemented);
// exportStatus.setValue("");
// Optional<DatabaseBundleWriter> writerOpt = findWriter();
// Set<Locale> locales = retrieveLocales();
// if (locales.isEmpty()) {
// userNotifier.notifyInformation(MessageKey.There_are_no_Locales_to_process);
// return;
// }
// if (writerOpt.isPresent()) {
// try {
// patternUtility.writeExclusive(locales, writerOpt.get());
// exportStatus.setValue(translate.from(MessageKey.Keys_exported, writerOpt.get()
// .count(), locales.size()));
// userNotifier.notifyInformation(LabelKey.Export_complete);
// } catch (Exception e) {
// log.info("Export I18NKeys failed due to exception", e);
// userNotifier.notifyError(MessageKey.I18NKey_export_failed, e.getMessage());
// }
// }
}

@Handler
Expand All @@ -123,43 +105,5 @@ public void localeChanged(LocaleChangeBusMessage busMessage) {
instructions2.setValue('\n' + translate.from(MessageKey.All_Keys_exported));
}

// private Optional<DatabaseBundleWriter> findWriter() {
// exportStatus.setValue(translate.from(LabelKey.Looking_for_Database_Writer));
// Reflections reflections = new Reflections();
// final Set<Class<? extends DatabaseBundleWriter>> writers = reflections.getSubTypesOf(DatabaseBundleWriter.class);
// writers.remove(DatabaseBundleWriterBase.class);
// if (writers.size() == 1) {
// return Optional.of(injector.getInstance(writers.iterator()
// .next()));
// }
// if (writers.size() == 0) {
// userNotifier.notifyWarning(MessageKey.Needs_at_least_one_database_writer);
// return Optional.empty();
// }
// userNotifier.notifyWarning(MessageKey.Currently_limited_to_supporting_one_database_writer);
// return Optional.empty();
// }

// @Nonnull
// protected Set<Locale> retrieveLocales() {
// exportStatus.setValue(translate.from(LabelKey.Retrieving_Locales));
// String userInput = localeList.getValue();
// List<String> localeTags = Splitter.on("\n")
// .trimResults()
// .omitEmptyStrings()
// .splitToList(userInput);
// Set<Locale> locales = new HashSet<>();
// localeTags.forEach(tag -> {
// try {
// Locale locale = new Locale.Builder().setLanguageTag(tag)
// .build();
// locales.add(locale);
// } catch (IllformedLocaleException e) {
// userNotifier.notifyWarning(MessageKey.Invalid_Locale_Langugage_Tag, tag);
// }
// });
// return locales;
// }


}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ protected SitemapReportView(MasterSitemap masterSitemap, Translate translate) {
protected void doBuild(ViewChangeBusMessage busMessage) {
super.doBuild(busMessage);
reportArea = new TextArea();
// reportArea.setEnabled(false);
reportArea.setSizeFull();
reportArea.setValue(masterSitemap.getReport());
setCentreCell(reportArea);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,11 @@ protected SourcePanel(Translate translate, OptionSource optionSource, Option opt
}

private void styles() {
// String defaultCaptionStyleName = option.get(defaultCaptionStyleOptionKey);
applyStyle(nameCaption, nameCaptionStyleOptionKey);
applyStyle(descriptionCaption, descriptionCaptionStyleOptionKey);
applyStyle(connectionUrlCaption, connectionUrlCaptionStyleOptionKey);
applyStyle(volatileCaption, is_volatileCaptionStyleOptionKey);

// String defaultValueStyleName = option.get(defaultValueStyleOptionKey);
applyStyle(nameLabel, nameValueStyleOptionKey);
applyStyle(descriptionLabel, descriptionValueStyleOptionKey);
applyStyle(connectionUrlLabel, connectionUrlValueStyleOptionKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ protected DefaultUserStatusPanel(Navigator navigator, SubjectProvider subjectPro
this.subjectIdentifier = subjectIdentifier;
this.eventBus = eventBusProvider.get();
this.currentLocale = currentLocale;
// eventBus.subscribe(this);
setSizeFull();
addStyleName(ChameleonTheme.PANEL_BORDERLESS);
usernameLabel = new Label();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void setLocale(Locale locale, boolean fireListeners) {

if (locale != this.locale) {
this.locale = locale;
// Locale.setDefault(locale);
log.debug("CurrentLocale set to {}", locale);
if (fireListeners) {
log.debug("publish locale change");
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/uk/q3c/util/SourceTreeWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
*/
public interface SourceTreeWrapper<N> {

// public abstract boolean hasChildren(N parentNode);

// public abstract int getChildCount(N parentNode);

public abstract List<N> getRoots();

/**
Expand All @@ -44,15 +40,10 @@ public interface SourceTreeWrapper<N> {
*/
public abstract List<N> getChildren(N parentNode);

// public abstract void addNode(N parentNode, N childNode);

/**
* Called by {@link TreeCopy} to offer the chance to mark this node as not having any children. Not used by all
* implementations
*
* @param isLeaf
*/
// public abstract void setLeaf(N parentNode, boolean isLeaf);

// public boolean hasParent(N childNode);
}
10 changes: 0 additions & 10 deletions src/main/java/uk/q3c/util/SourceTreeWrapper_BasicForest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,11 @@ public class SourceTreeWrapper_BasicForest<S> implements SourceTreeWrapper<S> {

private final BasicForest<S> forest;

// private NodeModifier<S, T> nodeModifier = new DefaultNodeModifier<S, T>();

public SourceTreeWrapper_BasicForest(BasicForest<S> forest) {
super();
this.forest = forest;
}

// public NodeModifier<S, T> getNodeModifier() {
// return nodeModifier;
// }

// public void setNodeModifier(NodeModifier<S, T> nodeModifier) {
// this.nodeModifier = nodeModifier;
// }

@Override
public List<S> getRoots() {
return forest.getRoots();
Expand Down
5 changes: 0 additions & 5 deletions src/test/java/fixture/ReferenceUserSitemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,6 @@ private void createStandardPages() {
addChild(publicNode, loginNode);
addChild(publicNode, logoutNode);
addChild(privateNode, privateHomeNode);

// addStandardPage(StandardPageKey.Log_In, loginNode);
// addStandardPage(StandardPageKey.Log_Out, logoutNode);
// addStandardPage(StandardPageKey.Public_Home, publicHomeNode);
// addStandardPage(StandardPageKey.Private_Home, privateHomeNode);
}

public UserSitemapNode createNode(String fullURI, String uriSegment, Class<? extends KrailView> viewClass, I18NKey labelKey, PageAccessControl
Expand Down
1 change: 0 additions & 1 deletion src/test/java/fixture/testviews2/My_AccountView.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public void buildView(ViewChangeBusMessage busMessage) {

@Override
public Component getRootComponent() {
// return null;
throw new RuntimeException("not yet implemented");
}

Expand Down
1 change: 0 additions & 1 deletion src/test/java/fixture/testviews2/PrivateView.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public void buildView(ViewChangeBusMessage busMessage) {

@Override
public Component getRootComponent() {
// return null;
throw new RuntimeException("not yet implemented");
}

Expand Down
1 change: 0 additions & 1 deletion src/test/java/fixture/testviews2/ViewA1.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void buildView(ViewChangeBusMessage busMessage) {

@Override
public Component getRootComponent() {
// return null;
throw new RuntimeException("not yet implemented");
}

Expand Down
1 change: 0 additions & 1 deletion src/test/java/fixture/testviews2/ViewA11.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void buildView(ViewChangeBusMessage busMessage) {

@Override
public Component getRootComponent() {
// return null;
throw new RuntimeException("not yet implemented");
}

Expand Down
1 change: 0 additions & 1 deletion src/test/java/fixture/testviews2/ViewA111.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void buildView(ViewChangeBusMessage busMessage) {

@Override
public Component getRootComponent() {
// return null;
throw new RuntimeException("not yet implemented");
}

Expand Down
1 change: 0 additions & 1 deletion src/test/java/fixture/testviews2/WigglyHomeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public void buildView(ViewChangeBusMessage busMessage) {

@Override
public Component getRootComponent() {
// return null;
throw new RuntimeException("not yet implemented");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public void setup() {
@Test
public void startAndStop() throws Exception {

//then
// assertThat(DefaultBindingManager.injector()).isNull();
// given
TestBindingManager bindingManager = new TestBindingManager();
when(servletContextEvent.getServletContext()).thenReturn(servletContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public void uiScope2() {

// given
KrailSecurityManager securityManager = new KrailSecurityManager(cacheManagerOpt);
// securityManager.setVaadinSessionProvider(vaadinSessionProvider);

SecurityUtils.setSecurityManager(securityManager);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ public void setLocaleNoFire() {
currentLocale.setLocale(Locale.FRANCE, false);
// then
assertThat(listenerFired).isFalse();
// assertThat(Locale.getDefault()).isEqualTo(Locale.FRANCE);
}

@Test
Expand All @@ -260,7 +259,6 @@ public void setLocaleFire() {
currentLocale.setLocale(Locale.FRANCE, true);
// then
assertThat(listenerFired).isTrue();
// assertThat(Locale.getDefault()).isEqualTo(Locale.FRANCE);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public void interpret() {
.getCaption()).isEqualTo("Ok");
assertThat(testObject.getLabel()
.getDescription()).isEqualTo("Confirm this Value is Ok");
// assertThat(testObject.getLabel().getValue()).isEqualTo("Ok");
assertThat(testObject.getLabel()
.getLocale()).isEqualTo(Locale.UK);

Expand All @@ -116,20 +115,17 @@ public void interpret() {
assertThat(ccs.getCaption()).isEqualTo("Field");
assertThat(ccs.getLabelInsideTcc()).isNotNull();
Label label = ccs.getLabelInsideTcc();
// assertThat(label.getValue()).isEqualTo("Ok");
assertThat(label.getDescription()).isEqualTo("Confirm this Value is Ok"); //drill down needed

// class annotation
TestCompositeComponent ccc = testObject.getCcc();
assertThat(ccc.getCaption()).isEqualTo("Class");
assertThat(ccc.getLabelInsideTcc()).isNotNull();
label = ccc.getLabelInsideTcc();
// assertThat(label.getValue()).isEqualTo("Ok");
assertThat(label.getDescription()).isEqualTo("Confirm this Value is Ok");

// composite but not a component
TestCompositeNonComponent cnc = testObject.getCnc();
// assertThat(cnc.getLabel().getValue()).isEqualTo("Cancel");

// nested component
TestCompositeComponentNested ccn = testObject.getCcn();
Expand Down Expand Up @@ -175,7 +171,6 @@ public void interpret_de() {
.getCaption()).isEqualTo("OK");
assertThat(testObject.getLabel()
.getDescription()).isEqualTo(confirmValueOk);
// assertThat(testObject.getLabel().getValue()).isEqualTo("Ok");
assertThat(testObject.getButtonWithAnnotation()
.getLocale()).isEqualTo(Locale.GERMANY);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ public void logout_rule_invoked() {
public void login_rule_invoked() {

// given

// assertThat(loginNavigationRule.changedNavigationState(navigator,loginSource)).isNotNull();
navigator = createNavigator();
when(loginNavigationRule.changedNavigationState(navigator, loginSource)).thenReturn(Optional.empty());
// when
Expand Down
12 changes: 0 additions & 12 deletions src/test/java/uk/q3c/krail/core/navigate/LabelKeyForNameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@

public class LabelKeyForNameTest {

// @Test
// public void test() {
// List<String> names = new ArrayList<>();
// Class<? extends Enum<?>> enumClass = LabelKeys.class;
// Enum<?>[] enums = enumClass.getEnumConstants();
// for (Enum<?> e : enums) {
// System.out.println(e.name());
// names.add(e.name());
// }
//
// }

@Test
public void keyForName_good() {

Expand Down
Loading