From e379ac498ae3b2d2decd0f0942da41a17c6cdc86 Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Wed, 17 Aug 2011 11:49:32 +0000
Subject: [PATCH] fix: compiler warnings

SVN: 22542
---
 .../ui/AuthorizationGroupGrid.java            | 11 +++--
 ...achmentListDeletionConfirmationDialog.java | 12 ++---
 ...DataSetListDeletionConfirmationDialog.java | 23 +++++-----
 ...erimentListDeletionConfirmationDialog.java | 24 +++++-----
 .../application/ui/property/PropertyGrid.java |  2 +-
 .../bo/samplelister/SampleListingWorker.java  |  2 +-
 .../generic/shared/util/EntityHelper.java     |  3 +-
 .../client/application/DemoSampleViewer.java  | 15 ++++---
 .../dataset/GenericDataSetViewer.java         | 43 +++++++++---------
 .../sample/GenericSampleViewer.java           | 45 ++++++++++---------
 .../server/dataaccess/db/ScriptDAOTest.java   |  1 +
 .../dataaccess/db/SqlUnitMigrationTest.java   |  2 +
 .../plugin/demo/server/DemoServerTest.java    |  5 ---
 ...GeneralInformationChangingServiceTest.java |  1 +
 14 files changed, 104 insertions(+), 85 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java
index a4a674b2c02..67b13581327 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/AuthorizationGroupGrid.java
@@ -273,20 +273,23 @@ public class AuthorizationGroupGrid extends TypedTableGrid<AuthorizationGroup>
             AbstractDataListPermanentDeletionConfirmationDialog<AuthorizationGroup>
     {
 
-        private final IViewContext<ICommonClientServiceAsync> viewContext;
-
         public GroupListDeletionConfirmationDialog(
                 IViewContext<ICommonClientServiceAsync> viewContext, List<AuthorizationGroup> data,
                 AbstractAsyncCallback<Void> callback)
         {
             super(viewContext, data, callback);
-            this.viewContext = viewContext;
+        }
+
+        @SuppressWarnings("unchecked")
+        private IViewContext<ICommonClientServiceAsync> getViewContext()
+        {
+            return (IViewContext<ICommonClientServiceAsync>) viewContext;
         }
 
         @Override
         protected void executeDeletion(AsyncCallback<Void> deletionCallback)
         {
-            viewContext.getCommonService().deleteAuthorizationGroups(TechId.createList(data),
+            getViewContext().getCommonService().deleteAuthorizationGroups(TechId.createList(data),
                     reason.getValue(), deletionCallback);
         }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentListDeletionConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentListDeletionConfirmationDialog.java
index 720b2565365..f5a61324cf5 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentListDeletionConfirmationDialog.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/attachment/AttachmentListDeletionConfirmationDialog.java
@@ -35,9 +35,6 @@ public final class AttachmentListDeletionConfirmationDialog
         extends
         AbstractDataListPermanentDeletionConfirmationDialog<TableModelRowWithObject<AttachmentVersions>>
 {
-
-    private final IViewContext<ICommonClientServiceAsync> viewContext;
-
     private final IAttachmentHolder attachmentHolder;
 
     public AttachmentListDeletionConfirmationDialog(
@@ -46,14 +43,19 @@ public final class AttachmentListDeletionConfirmationDialog
             AbstractAsyncCallback<Void> callback, IAttachmentHolder attachmentHolder)
     {
         super(viewContext, attachments, callback);
-        this.viewContext = viewContext;
         this.attachmentHolder = attachmentHolder;
     }
 
+    @SuppressWarnings("unchecked")
+    private IViewContext<ICommonClientServiceAsync> getViewContext()
+    {
+        return (IViewContext<ICommonClientServiceAsync>) viewContext;
+    }
+
     @Override
     protected void executeDeletion(AsyncCallback<Void> deletionCallback)
     {
-        viewContext.getCommonService().deleteAttachments(TechId.create(attachmentHolder),
+        getViewContext().getCommonService().deleteAttachments(TechId.create(attachmentHolder),
                 attachmentHolder.getAttachmentHolderKind(), getAttachmentFileNames(data),
                 reason.getValue(), deletionCallback);
     }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java
index 514b51702fc..801293d1869 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/DataSetListDeletionConfirmationDialog.java
@@ -36,8 +36,6 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalData;
 public final class DataSetListDeletionConfirmationDialog extends
         AbstractDataListDeletionConfirmationDialog<ExternalData>
 {
-    private final IViewContext<ICommonClientServiceAsync> viewContext;
-
     private final SelectedAndDisplayedItems selectedAndDisplayedItemsOrNull;
 
     private final ExternalData singleData;
@@ -48,7 +46,6 @@ public final class DataSetListDeletionConfirmationDialog extends
     {
         super(viewContext, selectedAndDisplayedItems.getSelectedItems(), callback);
         this.withRadio();
-        this.viewContext = viewContext;
         this.singleData = null;
         this.selectedAndDisplayedItemsOrNull = selectedAndDisplayedItems;
     }
@@ -58,11 +55,16 @@ public final class DataSetListDeletionConfirmationDialog extends
             AsyncCallback<Void> deletionCallback, ExternalData data)
     {
         super(viewContext, Collections.singletonList(data), deletionCallback);
-        this.viewContext = viewContext;
         this.singleData = data;
         this.selectedAndDisplayedItemsOrNull = null;
     }
 
+    @SuppressWarnings("unchecked")
+    private IViewContext<ICommonClientServiceAsync> getViewContext()
+    {
+        return (IViewContext<ICommonClientServiceAsync>) viewContext;
+    }
+
     @Override
     protected void executeDeletion(AsyncCallback<Void> deletionCallback)
     {
@@ -71,12 +73,12 @@ public final class DataSetListDeletionConfirmationDialog extends
         {
             final DisplayedOrSelectedDatasetCriteria uploadCriteria =
                     selectedAndDisplayedItemsOrNull.createCriteria(isOnlySelected());
-            viewContext.getCommonService().deleteDataSets(uploadCriteria, reason.getValue(),
+            getViewContext().getCommonService().deleteDataSets(uploadCriteria, reason.getValue(),
                     deletionType, deletionCallback);
         } else
         {
-            viewContext.getCommonService().deleteDataSet(singleData.getCode(), reason.getValue(),
-                    deletionType, deletionCallback);
+            getViewContext().getCommonService().deleteDataSet(singleData.getCode(),
+                    reason.getValue(), deletionType, deletionCallback);
         }
     }
 
@@ -89,11 +91,12 @@ public final class DataSetListDeletionConfirmationDialog extends
     @Override
     protected final RadioGroup createRadio()
     {
+        final IViewContext<ICommonClientServiceAsync> context = getViewContext();
         return WidgetUtils.createAllOrSelectedRadioGroup(
                 onlySelectedRadioOrNull =
-                        WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO,
-                                data.size())), WidgetUtils.createRadio(viewContext.getMessage(
+                        WidgetUtils.createRadio(context.getMessage(Dict.ONLY_SELECTED_RADIO,
+                                data.size())), WidgetUtils.createRadio(context.getMessage(
                         Dict.ALL_RADIO, selectedAndDisplayedItemsOrNull.getDisplayedItemsCount())),
-                viewContext.getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL), data.size());
+                context.getMessage(Dict.DATA_SETS_RADIO_GROUP_LABEL), data.size());
     }
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java
index 968726b147d..1b8b279f2b5 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ExperimentListDeletionConfirmationDialog.java
@@ -38,9 +38,6 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject
 public final class ExperimentListDeletionConfirmationDialog extends
         AbstractDataListDeletionConfirmationDialog<Experiment>
 {
-
-    private final IViewContext<ICommonClientServiceAsync> viewContext;
-
     private final DisplayedAndSelectedExperiments selectedAndDisplayedItemsOrNull;
 
     private final Experiment singleDataOrNull;
@@ -51,7 +48,6 @@ public final class ExperimentListDeletionConfirmationDialog extends
     {
         super(viewContext, selectedAndDisplayedItems.getExperiments(), callback);
         this.withRadio();
-        this.viewContext = viewContext;
         this.singleDataOrNull = null;
         this.selectedAndDisplayedItemsOrNull = selectedAndDisplayedItems;
     }
@@ -61,11 +57,16 @@ public final class ExperimentListDeletionConfirmationDialog extends
             AsyncCallback<Void> deletionCallback, Experiment experiment)
     {
         super(viewContext, Collections.singletonList(experiment), deletionCallback);
-        this.viewContext = viewContext;
         this.singleDataOrNull = experiment;
         this.selectedAndDisplayedItemsOrNull = null;
     }
 
+    @SuppressWarnings("unchecked")
+    private IViewContext<ICommonClientServiceAsync> getViewContext()
+    {
+        return (IViewContext<ICommonClientServiceAsync>) viewContext;
+    }
+
     @Override
     protected void executeDeletion(AsyncCallback<Void> deletionCallback)
     {
@@ -74,11 +75,11 @@ public final class ExperimentListDeletionConfirmationDialog extends
         {
             final DisplayedOrSelectedIdHolderCriteria<TableModelRowWithObject<Experiment>> uploadCriteria =
                     selectedAndDisplayedItemsOrNull.createCriteria(isOnlySelected());
-            viewContext.getCommonService().deleteExperiments(uploadCriteria, reason.getValue(),
-                    deletionType, deletionCallback);
+            getViewContext().getCommonService().deleteExperiments(uploadCriteria,
+                    reason.getValue(), deletionType, deletionCallback);
         } else
         {
-            viewContext.getCommonService().deleteExperiment(TechId.create(singleDataOrNull),
+            getViewContext().getCommonService().deleteExperiment(TechId.create(singleDataOrNull),
                     reason.getValue(), deletionType, deletionCallback);
         }
     }
@@ -92,12 +93,13 @@ public final class ExperimentListDeletionConfirmationDialog extends
     @Override
     protected final RadioGroup createRadio()
     {
+        final IViewContext<ICommonClientServiceAsync> context = getViewContext();
         return WidgetUtils.createAllOrSelectedRadioGroup(
                 onlySelectedRadioOrNull =
-                        WidgetUtils.createRadio(viewContext.getMessage(Dict.ONLY_SELECTED_RADIO,
-                                data.size())), WidgetUtils.createRadio(viewContext.getMessage(
+                        WidgetUtils.createRadio(context.getMessage(Dict.ONLY_SELECTED_RADIO,
+                                data.size())), WidgetUtils.createRadio(context.getMessage(
                         Dict.ALL_RADIO, selectedAndDisplayedItemsOrNull.getDisplayedItemsCount())),
-                viewContext.getMessage(Dict.EXPERIMENTS_RADIO_GROUP_LABEL), data.size());
+                context.getMessage(Dict.EXPERIMENTS_RADIO_GROUP_LABEL), data.size());
     }
 
 }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java
index 281ccbd9fab..955a3c768d3 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property/PropertyGrid.java
@@ -113,7 +113,7 @@ public final class PropertyGrid extends Grid
      * <li>given <var>clazz</var> is <code>null</code></li>
      * </ul>
      */
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private final <T> IPropertyValueRenderer<? super T> getPropertyValueRenderer(final T value)
     {
         if (value == null)
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListingWorker.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListingWorker.java
index 4f4ca17f54b..0426f4d24fa 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListingWorker.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleListingWorker.java
@@ -293,6 +293,7 @@ final class SampleListingWorker extends AbstractLister
         }
     }
 
+    @SuppressWarnings("null")
     private void loadSampleTypes()
     {
         final SampleType sampleTypeOrNull = tryGetSingleModeSampleType();
@@ -312,7 +313,6 @@ final class SampleListingWorker extends AbstractLister
 
         if (singleSampleTypeMode)
         {
-            assert sampleTypeOrNull != null;
             this.maxSampleParentResolutionDepth = sampleTypeOrNull.getGeneratedFromHierarchyDepth();
         }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java
index 9e9f5600841..5ed0db8bc64 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java
@@ -69,8 +69,9 @@ public class EntityHelper
             case SAMPLE:
                 type = new SampleType();
                 break;
+            default:
+                throw new Error("Unknown kind '" + kind + "'");
         }
-        assert type != null;
         type.setCode(code);
         return type;
     }
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/DemoSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/DemoSampleViewer.java
index f4a767b59d6..5c8f9546bfa 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/DemoSampleViewer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/DemoSampleViewer.java
@@ -39,8 +39,6 @@ public final class DemoSampleViewer extends AbstractViewer<Sample>
 
     public static final String ID_PREFIX = GenericConstants.ID_PREFIX + PREFIX;
 
-    private final IViewContext<IDemoClientServiceAsync> viewContext;
-
     private final TechId sampleId;
 
     public DemoSampleViewer(final IViewContext<IDemoClientServiceAsync> viewContext,
@@ -48,10 +46,15 @@ public final class DemoSampleViewer extends AbstractViewer<Sample>
     {
         super(viewContext, createId(sampleId));
         this.sampleId = sampleId;
-        this.viewContext = viewContext;
         reloadAllData();
     }
 
+    @SuppressWarnings("unchecked")
+    private IViewContext<IDemoClientServiceAsync> getViewContext()
+    {
+        return (IViewContext<IDemoClientServiceAsync>) viewContext;
+    }
+
     public static final String createId(final TechId sampleId)
     {
         return ID_PREFIX + sampleId;
@@ -59,7 +62,7 @@ public final class DemoSampleViewer extends AbstractViewer<Sample>
 
     private final Widget createUI(final SampleParentWithDerived sampleGeneration)
     {
-        return GenericSampleViewer.createPropertyGrid(sampleId, sampleGeneration, viewContext);
+        return GenericSampleViewer.createPropertyGrid(sampleId, sampleGeneration, getViewContext());
     }
 
     /**
@@ -68,8 +71,8 @@ public final class DemoSampleViewer extends AbstractViewer<Sample>
     @Override
     protected void reloadAllData()
     {
-        SampleInfoCallback callback = new SampleInfoCallback(viewContext, this);
-        viewContext.getService().getSampleGenerationInfo(sampleId, getBaseIndexURL(), callback);
+        SampleInfoCallback callback = new SampleInfoCallback(getViewContext(), this);
+        getViewContext().getService().getSampleGenerationInfo(sampleId, getBaseIndexURL(), callback);
     }
 
     //
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java
index 081c0fbd020..45db810e767 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java
@@ -74,19 +74,17 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
 
     protected final TechId datasetId;
 
-    private final IViewContext<?> viewContext;
-
     public static DatabaseModificationAwareComponent create(
-            final IViewContext<IGenericClientServiceAsync> viewContext,
+            final IViewContext<IGenericClientServiceAsync> localViewContext,
             final IIdAndCodeHolder identifiable)
     {
-        GenericDataSetViewer viewer = new GenericDataSetViewer(viewContext, identifiable)
+        GenericDataSetViewer viewer = new GenericDataSetViewer(localViewContext, identifiable)
             {
                 @Override
                 protected void loadDatasetInfo(TechId datasetTechId,
                         AsyncCallback<ExternalData> asyncCallback)
                 {
-                    viewContext.getService().getDataSetInfo(datasetTechId, asyncCallback);
+                    localViewContext.getService().getDataSetInfo(datasetTechId, asyncCallback);
                 }
             };
         viewer.reloadAllData();
@@ -98,12 +96,16 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
     {
         super(viewContext, createId(identifiable));
         setLayout(new BorderLayout());
-        this.viewContext = viewContext;
         this.datasetId = TechId.create(identifiable);
         this.processButtonHolder = new ProcessButtonHolder();
         extendToolBar();
     }
 
+    private IViewContext<?> getViewContext()
+    {
+        return viewContext;
+    }
+
     abstract protected void loadDatasetInfo(TechId datasetTechId,
             AsyncCallback<ExternalData> asyncCallback);
 
@@ -138,7 +140,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
 
     private void extendToolBar()
     {
-        if (viewContext.isSimpleOrEmbeddedMode())
+        if (getViewContext().isSimpleOrEmbeddedMode())
         {
             return;
         }
@@ -149,7 +151,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
                     final AsyncCallback<Void> callback =
                             isTrashEnabled() ? createDeletionCallback()
                                     : createPermanentDeletionCallback();
-                    new DataSetListDeletionConfirmationDialog(viewContext.getCommonViewContext(),
+                    new DataSetListDeletionConfirmationDialog(getViewContext().getCommonViewContext(),
                             callback, getOriginalData()).show();
                 }
 
@@ -158,7 +160,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
             {
                 public void execute()
                 {
-                    new RevertDeletionConfirmationDialog(viewContext.getCommonViewContext(),
+                    new RevertDeletionConfirmationDialog(getViewContext().getCommonViewContext(),
                             getOriginalData(), createRevertDeletionCallback()).show();
                 }
             }));
@@ -182,7 +184,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
     @Override
     protected void reloadAllData()
     {
-        loadDatasetInfo(datasetId, new DataSetInfoCallback(viewContext, this));
+        loadDatasetInfo(datasetId, new DataSetInfoCallback(getViewContext(), this));
     }
 
     private final Component createLeftPanel(final ExternalData dataset)
@@ -195,13 +197,14 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
 
     private ContentPanel createDataSetPropertiesPanel(final ExternalData dataset)
     {
-        return new DataSetPropertiesPanel(dataset, viewContext);
+        return new DataSetPropertiesPanel(dataset, getViewContext());
     }
 
     private final Component createRightPanel(final ExternalData dataset)
     {
+        final IViewContext<?> context = getViewContext();
         final SectionsPanel container =
-                new SectionsPanel(viewContext.getCommonViewContext(), ID_PREFIX + dataset.getId());
+                new SectionsPanel(context.getCommonViewContext(), ID_PREFIX + dataset.getId());
         container.setDisplayID(DisplayTypeIDGenerator.GENERIC_DATASET_VIEWER, displayIdSuffix);
 
         List<TabContent> additionalPanels = createAdditionalSectionPanels(dataset);
@@ -210,21 +213,21 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
             container.addSection(panel);
         }
         // data
-        final TabContent dataSection = new DataViewSection(viewContext, dataset);
+        final TabContent dataSection = new DataViewSection(context, dataset);
         container.addSection(dataSection);
 
         if (dataset.isContainer())
         {
-            final TabContent containedSection = new DataSetContainedSection(viewContext, dataset);
+            final TabContent containedSection = new DataSetContainedSection(context, dataset);
             container.addSection(containedSection);
         }
 
         // parents
-        final TabContent parentsSection = new DataSetParentsSection(viewContext, dataset);
+        final TabContent parentsSection = new DataSetParentsSection(context, dataset);
         container.addSection(parentsSection);
 
         // children
-        final TabContent childrenSection = new DataSetChildrenSection(viewContext, dataset);
+        final TabContent childrenSection = new DataSetChildrenSection(context, dataset);
         container.addSection(childrenSection);
 
         // managed properties
@@ -291,7 +294,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
         setToolBarButtonsEnabled(false);
         updateTitle(getOriginalDataDescription() + " (not available)");
         String msg =
-                viewContext.getMessage(Dict.DATASET_NOT_AVAILABLE_MSG, result.getCode(), result
+                getViewContext().getMessage(Dict.DATASET_NOT_AVAILABLE_MSG, result.getCode(), result
                         .getStatus().getDescription().toLowerCase());
         MessageBox.info("Data not available", msg, null);
     }
@@ -340,7 +343,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
 
         private Button createProcessButton()
         {
-            final Button result = new Button(viewContext.getMessage(Dict.BUTTON_PROCESS));
+            final Button result = new Button(getViewContext().getMessage(Dict.BUTTON_PROCESS));
             // need to set menu here, otherwise menu button will not be displayed
             result.setMenu(new Menu());
             result.hide();
@@ -355,8 +358,8 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl
         /** @param data external data that will be processed */
         public void setupData(final ExternalData data)
         {
-            viewContext.getCommonService().listDataStoreServices(DataStoreServiceKind.PROCESSING,
-                    new ProcessingServicesCallback(viewContext, getOriginalData(), button));
+            getViewContext().getCommonService().listDataStoreServices(DataStoreServiceKind.PROCESSING,
+                    new ProcessingServicesCallback(getViewContext(), getOriginalData(), button));
         }
     }
 
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java
index ebd80bdb8ff..8e3bfbb987e 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java
@@ -84,8 +84,6 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
     public static final String PROPERTIES_ID_PREFIX = GenericConstants.ID_PREFIX
             + "generic-sample-properties-viewer_";
 
-    private final IViewContext<?> viewContext;
-
     protected final TechId sampleId;
 
     private DisposableTabContent attachmentsSection;
@@ -101,17 +99,17 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
     private PropertyGrid propertyGrid;
 
     public static DatabaseModificationAwareComponent create(
-            final IViewContext<IGenericClientServiceAsync> viewContext,
+            final IViewContext<IGenericClientServiceAsync> creationViewContext,
             final IIdAndCodeHolder identifiable)
     {
-        GenericSampleViewer viewer = new GenericSampleViewer(viewContext, identifiable)
+        GenericSampleViewer viewer = new GenericSampleViewer(creationViewContext, identifiable)
             {
                 @Override
                 protected void loadSampleGenerationInfo(TechId sampleTechId,
                         AsyncCallback<SampleParentWithDerived> callback)
                 {
                     TechId techId = TechId.create(identifiable);
-                    viewContext.getService().getSampleGenerationInfo(techId, callback);
+                    creationViewContext.getService().getSampleGenerationInfo(techId, callback);
                 }
 
             };
@@ -128,10 +126,14 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
         super(viewContext, createId(identifiable));
         setLayout(new BorderLayout());
         this.sampleId = TechId.create(identifiable);
-        this.viewContext = viewContext;
         extendToolBar();
     }
 
+    private IViewContext<?> getViewContext()
+    {
+        return viewContext;
+    }
+
     @Override
     protected void fillBreadcrumbWidgets(List<Widget> widgets)
     {
@@ -153,19 +155,19 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
 
     private void extendToolBar()
     {
-        if (viewContext.isSimpleOrEmbeddedMode())
+        if (getViewContext().isSimpleOrEmbeddedMode())
         {
             return;
         }
         addToolBarButton(createDeleteButton(new IDelegatedAction()
             {
-                @SuppressWarnings("unchecked")
+                @SuppressWarnings({ "unchecked", "rawtypes" })
                 public void execute()
                 {
                     final AsyncCallback<Void> callback =
                             isTrashEnabled() ? createDeletionCallback()
                                     : createPermanentDeletionCallback();
-                    new SampleListDeletionConfirmationDialog(viewContext.getCommonViewContext(),
+                    new SampleListDeletionConfirmationDialog(getViewContext().getCommonViewContext(),
                             getOriginalDataAsSingleton(), callback, getOriginalData()).show();
                 }
             }));
@@ -173,7 +175,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
             {
                 public void execute()
                 {
-                    new RevertDeletionConfirmationDialog(viewContext.getCommonViewContext(),
+                    new RevertDeletionConfirmationDialog(getViewContext().getCommonViewContext(),
                             getOriginalData(), createRevertDeletionCallback()).show();
                 }
             }));
@@ -182,7 +184,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
     @Override
     protected void reloadAllData()
     {
-        reloadSampleGenerationData(new SampleGenerationInfoCallback(viewContext, this));
+        reloadSampleGenerationData(new SampleGenerationInfoCallback(getViewContext(), this));
     }
 
     public static final String createId(final IIdAndCodeHolder identifiable)
@@ -199,8 +201,9 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
     {
         final Sample generator = sampleGeneration.getParent();
 
+        final IViewContext<?> context = getViewContext();
         final SectionsPanel container =
-                new SectionsPanel(viewContext.getCommonViewContext(), getId());
+                new SectionsPanel(context.getCommonViewContext(), getId());
         container.setDisplayID(DisplayTypeIDGenerator.GENERIC_SAMPLE_VIEWER, displayIdSuffix);
         List<TabContent> additionalPanels = createAdditionalSectionPanels();
         for (TabContent panel : additionalPanels)
@@ -208,17 +211,17 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
             container.addSection(panel);
         }
         // Contained samples
-        containerSamplesSection = new ContainerSamplesSection(viewContext, generator);
+        containerSamplesSection = new ContainerSamplesSection(context, generator);
         container.addSection(containerSamplesSection);
         // Derived samples
-        derivedSamplesSection = new DerivedSamplesSection(viewContext, generator);
+        derivedSamplesSection = new DerivedSamplesSection(context, generator);
         container.addSection(derivedSamplesSection);
         // Parent samples
-        parentSamplesSection = new ParentSamplesSection(viewContext, generator);
+        parentSamplesSection = new ParentSamplesSection(context, generator);
         container.addSection(parentSamplesSection);
         // Data Sets
         dataSetSection =
-                new SampleDataSetsSection(viewContext, sampleId, generator.getSampleType());
+                new SampleDataSetsSection(context, sampleId, generator.getSampleType());
         container.addSection(dataSetSection);
 
         // Attachments
@@ -245,7 +248,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
 
     private AttachmentVersionsSection createAttachmentsSection(final Sample sample)
     {
-        return new AttachmentVersionsSection(viewContext.getCommonViewContext(), sample);
+        return new AttachmentVersionsSection(getViewContext().getCommonViewContext(), sample);
     }
 
     private final static Map<String, Object> createProperties(final IViewContext<?> viewContext,
@@ -308,8 +311,8 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
     {
         final ContentPanel panel = new ContentPanel();
         panel.setScrollMode(Scroll.AUTOY);
-        panel.setHeading(viewContext.getMessage(Dict.SAMPLE_PROPERTIES_HEADING));
-        propertyGrid = createPropertyGrid(sampleId, sampleGeneration, viewContext);
+        panel.setHeading(getViewContext().getMessage(Dict.SAMPLE_PROPERTIES_HEADING));
+        propertyGrid = createPropertyGrid(sampleId, sampleGeneration, getViewContext());
         panel.add(propertyGrid);
 
         return panel;
@@ -330,7 +333,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
 
     public final void updateProperties(final SampleParentWithDerived sampleGeneration)
     {
-        final Map<String, Object> properties = createProperties(viewContext, sampleGeneration);
+        final Map<String, Object> properties = createProperties(getViewContext(), sampleGeneration);
         propertyGrid.resizeRows(properties.size());
         propertyGrid.setProperties(properties);
     }
@@ -484,7 +487,7 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli
 
         public void update(Set<DatabaseModificationKind> observedModifications)
         {
-            reloadSampleGenerationData(new ReloadPropertyGridCallback(viewContext,
+            reloadSampleGenerationData(new ReloadPropertyGridCallback(getViewContext(),
                     GenericSampleViewer.this));
         }
 
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ScriptDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ScriptDAOTest.java
index 23b7533f4c5..be6502b0454 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ScriptDAOTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ScriptDAOTest.java
@@ -115,6 +115,7 @@ public final class ScriptDAOTest extends AbstractDAOTest
         assertEquals(script.getEntityKind(), retrievedScript.getEntityKind());
     }
 
+    @SuppressWarnings("null")
     @Test(dataProvider = "scriptTypes")
     public void testListScripts(ScriptType scriptType)
     {
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java
index ee00920ecc3..a836709c26a 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlUnitMigrationTest.java
@@ -158,11 +158,13 @@ public final class SqlUnitMigrationTest
         }
 
         // NOTE: the following methods are needed because we compile with JDK 6 on Hudson
+        @SuppressWarnings("unused")
         public boolean isWrapperFor(Class<?> arg0) throws SQLException
         {
             return false;
         }
 
+        @SuppressWarnings("unused")
         public <T> T unwrap(Class<T> arg0) throws SQLException
         {
             return null;
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoServerTest.java
index b3fe8406dc6..12c66282c96 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoServerTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoServerTest.java
@@ -19,7 +19,6 @@ package ch.systemsx.cisd.openbis.plugin.demo.server;
 import org.testng.annotations.BeforeMethod;
 
 import ch.rinn.restrictions.Friend;
-import ch.systemsx.cisd.openbis.generic.server.business.IPropertiesBatchManager;
 import ch.systemsx.cisd.openbis.generic.server.plugin.IDataSetTypeSlaveServerPlugin;
 import ch.systemsx.cisd.openbis.generic.server.plugin.ISampleTypeSlaveServerPlugin;
 import ch.systemsx.cisd.openbis.generic.shared.AbstractServerTestCase;
@@ -39,8 +38,6 @@ public final class DemoServerTest extends AbstractServerTestCase
 
     private IDataSetTypeSlaveServerPlugin dataSetTypeSlaveServerPlugin;
 
-    private IPropertiesBatchManager propertiesBatchManager;
-
     @SuppressWarnings("unused")
     private final IDemoServer createServer()
     {
@@ -61,7 +58,5 @@ public final class DemoServerTest extends AbstractServerTestCase
         sampleTypeSlaveServerPlugin = context.mock(ISampleTypeSlaveServerPlugin.class);
         demoBusinessObjectFactory = context.mock(IDemoBusinessObjectFactory.class);
         dataSetTypeSlaveServerPlugin = context.mock(IDataSetTypeSlaveServerPlugin.class);
-        propertiesBatchManager = context.mock(IPropertiesBatchManager.class);
-
     }
 }
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java
index 507ec7655d2..f381f3dc0b4 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationChangingServiceTest.java
@@ -39,6 +39,7 @@ import ch.systemsx.cisd.openbis.systemtest.SystemTestCase;
 @Test(groups = "system test")
 public class GeneralInformationChangingServiceTest extends SystemTestCase
 {
+    @SuppressWarnings("hiding")
     @Autowired
     private ICommonServer commonServer;
     
-- 
GitLab