    private void initComponents() {
        UIManager.put("Tree.leafIcon", Res.getIcon(getClass(), "gfx16/bookmark.png"));
        UIManager.put("Tree.openIcon", Res.getIcon(getClass(), "gfx16/bookmark.png"));
        UIManager.put("Tree.closedIcon", Res.getIcon(getClass(), "gfx16/bookmarks.png"));

        createActions();

        JMenuBar menuBar = createMenus();
        setJMenuBar(menuBar);

        createTreeMenu();

        JPanel toolbarsPanel = createToolbarsPanel();
        add(toolbarsPanel, BorderLayout.NORTH);

        centralSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false);
        leftPanel = new LeftPanel(centralSplit);
        leftPanel.addBookmarksPanel(createBookmarksPanel());
        leftPanel.addThumbnailsPanel(createThumbnailsPanel());
        leftPanel.getComboBoxSelector().addItemListener((ItemEvent e) -> {
            String item = (String) e.getItem();
            if (item.equals(Res.getString("BOOKMARKS_TAB_TITLE"))) {
                bookmarksButton.setSelected(true);
            } else {
                thumbnailsButton.setSelected(true);
            }
        });
        leftPanel.getComboBoxSelector().setSelectedItem(userPrefs.getPanelToShow());
//        leftPanel.addInnerPanel(createBookmarksPanel(), Res.getString("BOOKMARKS_TAB_TITLE"));
//        leftPanel.addInnerPanel(createThumbnailsPanel(), Res.getString("THUMBNAILS_TAB_TITLE"));

        JPanel centralPanel = new JPanel(new BorderLayout());
        centralPanel.add((Component) viewPanel, BorderLayout.CENTER);

        Color headersColor = new Color(230, 163, 4);
        JPanel verticalScrollbarHeader = new JPanel(
                new BorderLayout());
        verticalScrollbarHeader.setBackground(headersColor);
        String inheriTop = Res.getString("INHERIT_TOP");
//		JLabel lblInheritTop = new JLabel(inheriTop);
        checkInheritTop = new JCheckBox();
        checkInheritTop.setBorder(BorderFactory.createEmptyBorder(0, 2, 1, 2));
        checkInheritTop.setBackground(headersColor);
        checkInheritTop.setText(inheriTop);
        checkInheritTop.setMnemonic(Res.mnemonicFromRes("INHERIT_TOP_MNEMONIC"));
        checkInheritTop.setHorizontalTextPosition(SwingConstants.LEFT);
        checkInheritTop.setEnabled(false);
        verticalScrollbarHeader.add(checkInheritTop, BorderLayout.EAST);

        centralPanel.add(verticalScrollbarHeader, BorderLayout.NORTH);
//		lblInheritTop.setDisplayedMnemonic(Res.mnemonicFromRes("INHERIT_TOP_MNEMONIC"));
//		lblInheritTop.setLabelFor(checkInheritTop);

        //JPanel horizontalScrollbarHeader = new JPanel(new BoxLayout(this, WIDTH));
        Box horizontalScrollbarHeader = Box.createVerticalBox();
        horizontalScrollbarHeader.setOpaque(true);
        horizontalScrollbarHeader.setBackground(headersColor);
        horizontalScrollbarHeader.add(Box.createVerticalGlue());
        String inheriLeft = Res.getString("INHERIT_LEFT");
        lblInheritLeft = new VerticalLabel(inheriLeft, false);
        lblInheritLeft.setBackground(headersColor);
        horizontalScrollbarHeader.add(lblInheritLeft);
        horizontalScrollbarHeader.add(Box.createVerticalStrut(4));
        checkInheritLeft = new JCheckBox();
        checkInheritLeft.setBorder(BorderFactory.createEmptyBorder(0, 1, 3, 2));
        checkInheritLeft.setBackground(headersColor);
        checkInheritLeft.setEnabled(false);
        horizontalScrollbarHeader.add(checkInheritLeft);
        lblInheritLeft.setDisplayedMnemonic(Res.mnemonicFromRes("INHERIT_LEFT_MNEMONIC"));
        lblInheritLeft.setLabelFor(checkInheritLeft);
        lblInheritLeft.setEnabled(false);
        centralPanel.add(horizontalScrollbarHeader, BorderLayout.WEST);

//		JLabel lblInheritZoom = new JLabel(Res.getString("INHERIT_ZOOM"));
//		lblInheritZoom.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
//		verticalScrollbarHeader.add(lblInheritZoom, BorderLayout.WEST);
        checkInheritZoom = new JCheckBox();
        checkInheritZoom.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 2));
        checkInheritZoom.setBackground(headersColor);
        checkInheritZoom.setText(Res.getString("INHERIT_ZOOM"));
        checkInheritZoom.setHorizontalTextPosition(SwingConstants.RIGHT);
        checkInheritZoom.setMnemonic(
                Res.mnemonicFromRes("INHERIT_ZOOM_MNEMONIC"));
        checkInheritZoom.setEnabled(false);
        verticalScrollbarHeader.add(checkInheritZoom, BorderLayout.WEST);

//		lblInheritZoom.setDisplayedMnemonic(
//				Res.mnemonicFromRes("INHERIT_ZOOM_MNEMONIC"));
//		lblInheritZoom.setLabelFor(checkInheritZoom);
//        centralSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
//                false, leftTabbedPane, centralPanel);
//        centralSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
//                false, leftPanel, centralPanel);
        centralSplit.setLeftComponent(leftPanel);
        centralSplit.setRightComponent(centralPanel);
        centralSplit.setOneTouchExpandable(true);

        leftPanel.setDividerLocation(userPrefs.getSplitterLocation());
        leftPanel.setPanelState(userPrefs.getCollapsingPanelState());

        dropTarget = new DropTarget(centralSplit, new SplitDropListener());
        centralSplit.setDropTarget(dropTarget);
        //centralSplit.setTransferHandler(new FilesTransferHandler());
        //centralSplit.setDividerLocation(userPrefs.getSplitterLocation());
        add(centralSplit, BorderLayout.CENTER);

        add(createStatusBar(), BorderLayout.SOUTH);

        updateToolbars();
    }

    private void initComponents() {
        UIManager.put("Tree.leafIcon", Res.getIcon(getClass(), "gfx16/bookmark.png"));
        UIManager.put("Tree.openIcon", Res.getIcon(getClass(), "gfx16/bookmark.png"));
        UIManager.put("Tree.closedIcon", Res.getIcon(getClass(), "gfx16/bookmarks.png"));

        createActions();

        JMenuBar menuBar = createMenus();
        setJMenuBar(menuBar);

        createTreeMenu();

        JPanel toolbarsPanel = createToolbarsPanel();
        add(toolbarsPanel, BorderLayout.NORTH);

        centralSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false);
        leftPanel = new LeftPanel(centralSplit);
        leftPanel.addBookmarksPanel(createBookmarksPanel());
        leftPanel.addThumbnailsPanel(createThumbnailsPanel());
        leftPanel.getComboBoxSelector().addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                String item = (String) e.getItem();
                if (item.equals(Res.getString("BOOKMARKS_TAB_TITLE"))) {
                    bookmarksButton.setSelected(true);
                } else {
                    thumbnailsButton.setSelected(true);
                }
            }
        });
        leftPanel.getComboBoxSelector().setSelectedItem(userPrefs.getPanelToShow());
//        leftPanel.addInnerPanel(createBookmarksPanel(), Res.getString("BOOKMARKS_TAB_TITLE"));
//        leftPanel.addInnerPanel(createThumbnailsPanel(), Res.getString("THUMBNAILS_TAB_TITLE"));

        JPanel centralPanel = new JPanel(new BorderLayout());
        centralPanel.add((Component) viewPanel, BorderLayout.CENTER);

        Color headersColor = new Color(230, 163, 4);
        JPanel verticalScrollbarHeader = new JPanel(
                new BorderLayout());
        verticalScrollbarHeader.setBackground(headersColor);
        String inheriTop = Res.getString("INHERIT_TOP");
//		JLabel lblInheritTop = new JLabel(inheriTop);
        checkInheritTop = new JCheckBox();
        checkInheritTop.setBorder(BorderFactory.createEmptyBorder(0, 2, 1, 2));
        checkInheritTop.setBackground(headersColor);
        checkInheritTop.setText(inheriTop);
        checkInheritTop.setMnemonic(Res.mnemonicFromRes("INHERIT_TOP_MNEMONIC"));
        checkInheritTop.setHorizontalTextPosition(SwingConstants.LEFT);
        checkInheritTop.setEnabled(false);
        verticalScrollbarHeader.add(checkInheritTop, BorderLayout.EAST);

        centralPanel.add(verticalScrollbarHeader, BorderLayout.NORTH);
//		lblInheritTop.setDisplayedMnemonic(Res.mnemonicFromRes("INHERIT_TOP_MNEMONIC"));
//		lblInheritTop.setLabelFor(checkInheritTop);

        //JPanel horizontalScrollbarHeader = new JPanel(new BoxLayout(this, WIDTH));
        Box horizontalScrollbarHeader = Box.createVerticalBox();
        horizontalScrollbarHeader.setOpaque(true);
        horizontalScrollbarHeader.setBackground(headersColor);
        horizontalScrollbarHeader.add(Box.createVerticalGlue());
        String inheriLeft = Res.getString("INHERIT_LEFT");
        lblInheritLeft = new VerticalLabel(inheriLeft, false);
        lblInheritLeft.setBackground(headersColor);
        horizontalScrollbarHeader.add(lblInheritLeft);
        horizontalScrollbarHeader.add(Box.createVerticalStrut(4));
        checkInheritLeft = new JCheckBox();
        checkInheritLeft.setBorder(BorderFactory.createEmptyBorder(0, 1, 3, 2));
        checkInheritLeft.setBackground(headersColor);
        checkInheritLeft.setEnabled(false);
        horizontalScrollbarHeader.add(checkInheritLeft);
        lblInheritLeft.setDisplayedMnemonic(Res.mnemonicFromRes("INHERIT_LEFT_MNEMONIC"));
        lblInheritLeft.setLabelFor(checkInheritLeft);
        lblInheritLeft.setEnabled(false);
        centralPanel.add(horizontalScrollbarHeader, BorderLayout.WEST);

//		JLabel lblInheritZoom = new JLabel(Res.getString("INHERIT_ZOOM"));
//		lblInheritZoom.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
//		verticalScrollbarHeader.add(lblInheritZoom, BorderLayout.WEST);
        checkInheritZoom = new JCheckBox();
        checkInheritZoom.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 2));
        checkInheritZoom.setBackground(headersColor);
        checkInheritZoom.setText(Res.getString("INHERIT_ZOOM"));
        checkInheritZoom.setHorizontalTextPosition(SwingConstants.RIGHT);
        checkInheritZoom.setMnemonic(
                Res.mnemonicFromRes("INHERIT_ZOOM_MNEMONIC"));
        checkInheritZoom.setEnabled(false);
        verticalScrollbarHeader.add(checkInheritZoom, BorderLayout.WEST);

//		lblInheritZoom.setDisplayedMnemonic(
//				Res.mnemonicFromRes("INHERIT_ZOOM_MNEMONIC"));
//		lblInheritZoom.setLabelFor(checkInheritZoom);

//        centralSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
//                false, leftTabbedPane, centralPanel);
//        centralSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
//                false, leftPanel, centralPanel);
        centralSplit.setLeftComponent(leftPanel);
        centralSplit.setRightComponent(centralPanel);
        centralSplit.setOneTouchExpandable(true);

        leftPanel.setDividerLocation(userPrefs.getSplitterLocation());
        leftPanel.setPanelState(userPrefs.getCollapsingPanelState());

        dropTarget = new DropTarget(centralSplit, new SplitDropListener());
        centralSplit.setDropTarget(dropTarget);
        //centralSplit.setTransferHandler(new FilesTransferHandler());
        //centralSplit.setDividerLocation(userPrefs.getSplitterLocation());
        add(centralSplit, BorderLayout.CENTER);

        add(createStatusBar(), BorderLayout.SOUTH);

        updateToolbars();
    }

Replace Anonymous With Lambda it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui.initComponents.addItemListener.new ItemListener with (e) -> {String item=(String)e.getItem(); in method private initComponents() : void from class it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui


        private java.util.List textURIListToFileList(String data) {
            java.util.List list = new java.util.ArrayList(1);
            for (java.util.StringTokenizer st = new java.util.StringTokenizer(data, "\r\n");
                    st.hasMoreTokens();) {
                String s = st.nextToken();
                if (s.startsWith("#")) {
                    continue;
                }
                try {
                    java.net.URI uri = new java.net.URI(s);
                    java.io.File file = new java.io.File(uri);
                    list.add(file);
                } catch (java.net.URISyntaxException | IllegalArgumentException e) {
                }
            }
            return list;
        }

        private java.util.List textURIListToFileList(String data) {
            java.util.List list = new java.util.ArrayList(1);
            for (java.util.StringTokenizer st = new java.util.StringTokenizer(data, "\r\n");
                    st.hasMoreTokens();) {
                String s = st.nextToken();
                if (s.startsWith("#")) {
                    continue;
                }
                try {
                    java.net.URI uri = new java.net.URI(s);
                    java.io.File file = new java.io.File(uri);
                    list.add(file);
                } catch (java.net.URISyntaxException e) {
                } catch (IllegalArgumentException e) {
                }
            }
            return list;
        }

Merge Catch [catch(URISyntaxException e), catch(IllegalArgumentException e)] to catch(URISyntaxException|IllegalArgumentException e) in method private textURIListToFileList(data String) : List from class it.flavianopetrocchi.jpdfbookmarks.JPdfBookmarksGui.SplitDropListener


    public void setFit(FitType fitType) {
        this.fitType = fitType;
        SwingUtilities.invokeLater(() -> {
            if (JPDFBoxViewPanel.this.fitType == FitType.FitRect) {
//                    viewport.setCursor(Cursor.getPredefinedCursor(
//                            Cursor.CROSSHAIR_CURSOR));
                if (!textSelectionActive) {
                    viewport.setCursor(rectRedCur);
                }
            } else {
                if (!textSelectionActive) {
                    viewport.setCursor(Cursor.getDefaultCursor());
                }
            }
            calcScaleFactor();
            adjustPreferredSize();
            adjustViewportPosition();
        });
        rendererPanel.repaint();
    }

    public void setFit(FitType fitType) {
        this.fitType = fitType;
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {

                if (JPedalViewPanel.this.fitType == FitType.FitRect) {
//                    viewport.setCursor(Cursor.getPredefinedCursor(
//                            Cursor.CROSSHAIR_CURSOR));
                    if (!textSelectionActive) {
                        viewport.setCursor(rectRedCur);
                    }
                } else {
                    if (!textSelectionActive) {
                        viewport.setCursor(Cursor.getDefaultCursor());
                    }
                }
                calcScaleFactor();
                adjustPreferredSize();
                adjustViewportPosition();
            }
        });
        rendererPanel.repaint();
    }

Replace Anonymous With Lambda it.flavianopetrocchi.jpdfbookmarks.JPedalViewPanel.setFit.invokeLater.new Runnable with () -> {if(JPDFBoxViewPanel.this.fitType == FitType.FitRect){if(!textSelectionActive){viewport.setCursor(rectRedCur); in method public setFit(fitType FitType) : void from class it.flavianopetrocchi.jpdfbookmarks.JPDFBoxViewPanel


    private static String getTextFromClipboard() {
        Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
        try {
            if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                String text = (String) t.getTransferData(DataFlavor.stringFlavor);
                return text;
            }
        } catch (UnsupportedFlavorException | IOException e) {
        }
        return null;
    }

    private static String getTextFromClipboard() {
        Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
        try {
            if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                String text = (String) t.getTransferData(DataFlavor.stringFlavor);
                return text;
            }
        } catch (UnsupportedFlavorException e) {
        } catch (IOException e) {
        }
        return null;
    }

Merge Catch [catch(UnsupportedFlavorException e), catch(IOException e)] to catch(UnsupportedFlavorException|IOException e) in method private getTextFromClipboard() : String from class it.flavianopetrocchi.jpdfbookmarks.JPDFBoxViewPanel


    private void processUrl(WebPageMeta meta) {

        try {
            if (!hasAccess(meta)) {
                LOG.info("disallowed by robots.txt: " + meta.getUrl());
                dbService.block(meta);
                return;
            }
        } catch (IOException ex) {
            dbService.reschedule(meta, 30, TimeUnit.MINUTES);
            return;
        }

        if (!needsUpdate(meta)) {
            LOG.info("update not required: " + meta.getUrl());
            dbService.reschedule(meta, 30, TimeUnit.MINUTES);
            return;
        }

        LOG.info("processing: " + meta.getUrl());
        final Date now = new Date();

        boolean updated = false;
        try {
            try (CloseableHttpClient httpClient = IndexingUtils.createHttpClient()) {
                HttpHead httpHead = new HttpHead(meta.getUrl());
                setPageFetchHeaders(httpHead, meta);

                boolean needUpdate = true;
                try (TimeUsage httpTimeUsage = timeUsage.startSub("http")) {
                    try (CloseableHttpResponse response = httpClient.execute(httpHead)) {
                        httpTimeUsage.stop();
                        needUpdate = checkResponseHeader(response, meta);
                    } catch (BadHttpStatusCodeException ex) {
                    }
                }

                if (needUpdate) {
                    HttpGet httpGet = new HttpGet(meta.getUrl());
                    setPageFetchHeaders(httpGet, meta);

                    try (TimeUsage httpTimeUsage = timeUsage.startSub("http")) {
                        try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
                            httpTimeUsage.stop();
                            updated = handleResponse(response, meta);
                        }
                    }
                }
            } catch (FileTooLargeException | IndexingNotAllowedException
                | UnsupportedContentTypeException | IllegalArgumentException ex) {
                LOG.info("", ex);
                dbService.block(meta);
                return;
            }
        } catch (IOException ex) {
            LOG.info("", ex);
            dbService.error(meta);
            return;
        }

        if (updated) {
            LOG.info("updated: " + meta.getUrl());
            dbService.updated(meta);
        } else {
            LOG.info("not modified: " + meta.getUrl());
            dbService.notModified(meta);
        }
    }

    private void processUrl(WebPageMeta meta) {

        try {
            if (!hasAccess(meta)) {
                LOG.info("disallowed by robots.txt: " + meta.getUrl());
                dbService.block(meta);
                return;
            }
        } catch (IOException ex) {
            dbService.reschedule(meta, 30, TimeUnit.MINUTES);
            return;
        }

        if (!needsUpdate(meta)) {
            LOG.info("update not required: " + meta.getUrl());
            dbService.reschedule(meta, 30, TimeUnit.MINUTES);
            return;
        }

        LOG.info("processing: " + meta.getUrl());
        final Date now = new Date();

        boolean updated = false;
        try {
            try {
                HttpHead httpHead = new HttpHead(meta.getUrl());
                setPageFetchHeaders(httpHead, meta);

                boolean needUpdate = true;
                try (TimeUsage httpTimeUsage = timeUsage.startSub("http")) {
                    try (CloseableHttpResponse response = httpClient.execute(httpHead)) {
                        httpTimeUsage.stop();
                        needUpdate = checkResponseHeader(response, meta);
                    } catch (BadHttpStatusCodeException ex) {
                    }
                }

                if (needUpdate) {
                    HttpGet httpGet = new HttpGet(meta.getUrl());
                    setPageFetchHeaders(httpGet, meta);

                    try (TimeUsage httpTimeUsage = timeUsage.startSub("http")) {
                        try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
                            httpTimeUsage.stop();
                            updated = handleResponse(response, meta);
                        }
                    }
                }
            } catch (FileTooLargeException | IndexingNotAllowedException
                | UnsupportedContentTypeException | IllegalArgumentException ex) {
                LOG.info("", ex);
                dbService.block(meta);
                return;
            }
        } catch (IOException ex) {
            LOG.info("", ex);
            dbService.error(meta);
            return;
        }

        if (updated) {
            LOG.info("updated: " + meta.getUrl());
            dbService.updated(meta);
        } else {
            LOG.info("not modified: " + meta.getUrl());
            dbService.notModified(meta);
        }
    }

Try With Resources try(CloseableHttpClient httpClient=IndexingUtils.createHttpClient()) in method private processUrl(meta WebPageMeta) : void from class com.github.jjYBdx4IL.cms.solr.IndexingTask


    @Override
    public void run() {
        LOG.info("started");

        try (SolrClient client = SolrConfig.getClient()) {
            solrClient = client;
            while (!shutdownLatch.await(0, TimeUnit.MILLISECONDS)) {
                WebPageMeta meta = dbService.getNextUrl4Processing();
                if (meta == null) {
                    shutdownLatch.await(3000, TimeUnit.MILLISECONDS);
                    continue;
                }

                try (UrlLockService.Lock lock = lockService.acquire(meta)) {
                    if (lock == null) {
                        LOG.info("url has process lock: " + meta.getUrl());
                        dbService.rescheduleLocked(meta);
                        continue;
                    }
                    processUrl(meta);
                }

                ping.set(System.currentTimeMillis());
                timeUsage.ivalDump();
            }
        } catch (Exception ex) {
            ping.set(0);
            LOG.warn("", ex);
        }
        LOG.info("stopped");
    }

    @Override
    public void run() {
        LOG.info("started");

        try (SolrClient client = SolrConfig.getClient()) {
            solrClient = client;
            while (!shutdownLatch.await(0, TimeUnit.MILLISECONDS)) {
                WebPageMeta meta = dbService.getNextUrl4Processing();
                if (meta == null) {
                    shutdownLatch.await(3000, TimeUnit.MILLISECONDS);
                    continue;
                }

                UrlLockService.Lock lock = lockService.acquire(meta);
                if (lock == null) {
                    LOG.info("url has process lock: " + meta.getUrl());
                    dbService.rescheduleLocked(meta);
                    continue;
                }
                try {
                    processUrl(meta);
                } finally {
                    lockService.release(lock);
                }

                ping.set(System.currentTimeMillis());
            }
        } catch (Exception ex) {
            ping.set(0);
            LOG.warn("", ex);
        }
        LOG.info("stopped");
    }

Try With Resources try(UrlLockService.Lock lock=lockService.acquire(meta)) in method public run() : void from class com.github.jjYBdx4IL.cms.solr.IndexingTask


    public AppLayout getInstance() {
        try {
            return className.getDeclaredConstructor().newInstance();
        } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
            e.printStackTrace();
        }
        return null;
    }

    public AppLayout getInstance() {
        try {
            return className.getDeclaredConstructor().newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        return null;
    }

Merge Catch [catch(InstantiationException e), catch(IllegalAccessException e), catch(NoSuchMethodException e), catch(InvocationTargetException e)] to catch(InstantiationException|IllegalAccessException|NoSuchMethodException|InvocationTargetException e) in method public getInstance() : AppLayout from class com.github.appreciated.app.layout.component.applayout.Behaviour


    @Override
    public ConverterNumberToNumberVisitor<Boolean> createVisitor() {
        //noinspection unchecked
        return new ConverterNumberToNumberVisitor<>(
                this.converter(),
                Boolean.class,
                CONTEXT
        );
    }

    @Override
    public ConverterNumberToNumberVisitor<Boolean> createVisitor() {
        //noinspection unchecked
        return new ConverterNumberToNumberVisitor<Boolean>(this.converter(), Boolean.class);
    }

Replace Generic With Diamond ConverterNumberToNumberVisitor<Boolean> with ConverterNumberToNumberVisitor<> in method public createVisitor() : ConverterNumberToNumberVisitor<Boolean> from class walkingkooka.convert.ConverterNumberToNumberVisitorTest


	/** 配置优先级别：-D > env > diamond.properties  */
	public static void init() {
		List<Field> fields = new ArrayList<>();
		for (Field field : Constants.class.getDeclaredFields()) {
			if (Modifier.isPublic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers())) {
				fields.add(field);
			}
		}

		Properties props = new Properties();
		{
			ClassLoader cl = Thread.currentThread().getContextClassLoader();
			if (cl == null) cl = Constants.class.getClassLoader();
			try (InputStream in = cl.getResourceAsStream("diamond.properties")) {
				if (in != null) props.load(in);
			} catch (IOException e) {
				log.warn("load diamond.properties", e);
			}
		}
		props.putAll(System.getenv());
		props.putAll(System.getProperties());

		Map<String, Object> old = new HashMap<>();
		try {
			for (Field field : fields) {
				if (!props.containsKey(field.getName())) continue;
				old.put(field.getName(), field.get(Constants.class));

				String value = props.getProperty(field.getName());
				Class<?> clazz = field.getType();
				if (String.class.equals(clazz)) {
					field.set(Constraints.class, value);
				} else if (int.class.equals(clazz)) {
					if (value != null) {
						field.set(Constraints.class, Integer.parseInt(value));
					}
				} else {
					throw new IllegalArgumentException(field + " 设置 " + value + " 还未支持");
				}
			}
		} catch (IllegalAccessException e) {
			throw new IllegalStateException(e);
		}

		setValue(old, "CONFIG_HTTP_URI_FILE", "HTTP_URI_FILE");
		setValue(old, "HTTP_URI_LOGIN", "HTTP_URI_FILE");
		setValue(old, "DAILY_DOMAINNAME", "DEFAULT_DOMAINNAME");
	}

	/** 配置优先级别：-D > env > diamond.properties  */
	public static void init() {
		List<Field> fields = new ArrayList<Field>();
		for (Field field : Constants.class.getDeclaredFields()) {
			if (Modifier.isPublic(field.getModifiers()) && !Modifier.isFinal(field.getModifiers())) {
				fields.add(field);
			}
		}

		Properties props = new Properties();
		{
			ClassLoader cl = Thread.currentThread().getContextClassLoader();
			if (cl == null) cl = Constants.class.getClassLoader();
			InputStream in = null;
			try {
				in = cl.getResourceAsStream("diamond.properties");
				if (in != null) props.load(in);
			} catch (IOException e) {
				log.warn("load diamond.properties", e);
			} finally {
				if (in != null) {
					try {
						in.close();
					} catch (IOException e) {}
				}
			}
		}
		props.putAll(System.getenv());
		props.putAll(System.getProperties());

		Map<String, Object> old = new HashMap<String, Object>();
		try {
			for (Field field : fields) {
				if (!props.containsKey(field.getName())) continue;
				old.put(field.getName(), field.get(Constants.class));

				String value = props.getProperty(field.getName());
				Class<?> clazz = field.getType();
				if (String.class.equals(clazz)) {
					field.set(Constraints.class, value);
				} else if (int.class.equals(clazz)) {
					if (value != null) {
						field.set(Constraints.class, Integer.parseInt(value));
					}
				} else {
					throw new IllegalArgumentException(field + " 设置 " + value + " 还未支持");
				}
			}
		} catch (IllegalAccessException e) {
			throw new IllegalStateException(e);
		}

		setValue(old, "CONFIG_HTTP_URI_FILE", "HTTP_URI_FILE");
		setValue(old, "HTTP_URI_LOGIN", "HTTP_URI_FILE");
		setValue(old, "DAILY_DOMAINNAME", "DEFAULT_DOMAINNAME");
	}

Try With Resources try(InputStream in=cl.getResourceAsStream("diamond.properties")) in method public init() : void from class com.taobao.diamond.common.Constants


    public static <T> T applyInputStreamOfFileOn(File file, IOFunction<FileInputStream, T> block) {
        try {
            try (FileInputStream stream = new FileInputStream(file)) {
                return block.apply(stream);
            }
        } catch (FileNotFoundException e) {
            throw new UncheckedFileNotFoundException(e);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    public static <T> T applyInputStreamOfFileOn(File file, IOFunction<FileInputStream, T> block) {
        try {
            FileInputStream stream = new FileInputStream(file);
            try {
                return block.apply(stream);
            } finally {
                stream.close();
            }
        } catch (FileNotFoundException e) {
            throw new UncheckedFileNotFoundException(e);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

Try With Resources try(FileInputStream stream=new FileInputStream(file)) in method public applyInputStreamOfFileOn(file File, block IOFunction<FileInputStream,T>) : T from class org.abego.commons.io.IOFunctionUtil


    public static <T> T applyOutputStreamOfFileOn(File file, IOFunction<FileOutputStream, T> block) {
        try {
            try (FileOutputStream stream = new FileOutputStream(file)) {
                return block.apply(stream);
            }
        } catch (FileNotFoundException e) {
            throw new UncheckedFileNotFoundException(e);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    public static <T> T applyOutputStreamOfFileOn(File file, IOFunction<FileOutputStream, T> block) {
        try {
            FileOutputStream stream = new FileOutputStream(file);
            try {
                return block.apply(stream);
            } finally {
                stream.close();
            }
        } catch (FileNotFoundException e) {
            throw new UncheckedFileNotFoundException(e);
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

Try With Resources try(FileOutputStream stream=new FileOutputStream(file)) in method public applyOutputStreamOfFileOn(file File, block IOFunction<FileOutputStream,T>) : T from class org.abego.commons.io.IOFunctionUtil


    static <T, S extends T> SeqForIterable<T> newSeqForIterable(Iterable<S> iterable) {
        return new SeqForIterable<>(iterable);
    }

    static <T, S extends T> SeqForIterable<T> newSeqForIterable(Iterable<S> iterable) {
        return new SeqForIterable<T>(iterable);
    }

Replace Generic With Diamond SeqForIterable<T> with SeqForIterable<> in method package newSeqForIterable(iterable Iterable<S>) : SeqForIterable<T> from class org.abego.commons.seq.SeqForIterable


	public void readFromOSM(InputSource filename) {
		try {
			XMLReader xmlReader = XMLReaderFactory.createXMLReader();
			xmlReader.setContentHandler(new OSMHandler());
			xmlReader.parse(filename);
		} catch (SAXException | IOException e) {
			e.printStackTrace();
		}
	}

	public void readFromOSM(InputSource filename) {
		try {
			XMLReader xmlReader = XMLReaderFactory.createXMLReader();
			xmlReader.setContentHandler(new OSMHandler());
			xmlReader.parse(filename);
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

Merge Catch [catch(SAXException e), catch(IOException e)] to catch(SAXException|IOException e) in method public readFromOSM(filename InputSource) : void from class com.noticemedan.map.data.io.OSMReader


  private void zipUpShp() {
    try (ZipOutputStream zOut = new ZipOutputStream( new FileOutputStream( new File( outputZip ) ) )) {
      SHP_FILE_EXTENSIONS.forEach( ext -> {
        try {
          Path pathToShp = Paths.get(outputFileBase + ext);
          if(Files.exists( pathToShp )) {
            ZipEntry entry = new ZipEntry( layerName + ext );
            zOut.putNextEntry( entry );
            Files.copy(pathToShp, zOut);
            zOut.closeEntry();
            Files.deleteIfExists( pathToShp );
          } else {
            log.error("Couldn't find '" + pathToShp + "'");
          }
        } catch ( IOException e ) {
          log.error("Couldn't zip '" + outputFileBase + ext + "'", e);
        }
      } );
    } catch ( IOException e ) {
      log.error("Couldn't open zip '" + outputZip + "'", e);
    }
  }

  private void zipUpShp() {
    try {
      File zFile = new File( outputZip );
      ZipOutputStream zOut = new ZipOutputStream( new FileOutputStream( zFile ) );
      SHP_FILE_EXTENSIONS.forEach( ext -> {
        try {
          Path pathToShp = Paths.get(outputFileBase + ext);
          ZipEntry entry = new ZipEntry( layerName + ext );
          zOut.putNextEntry( entry );
          Files.copy(pathToShp, zOut);
          zOut.closeEntry();
          Files.deleteIfExists( pathToShp );
        } catch ( IOException e ) {
          log.error("Couldn't zip: " + outputFileBase + ext, e);
        }
      } );
    zOut.close();

    } catch ( IOException e ) {
      e.printStackTrace();
    }
  }

Try With Resources try(ZipOutputStream zOut=new ZipOutputStream(new FileOutputStream(new File(outputZip)))) in method private zipUpShp() : void from class com.northpine.ScrapeJob


/**
     * Constructor.
     *
     * @param parsers
     *            the list of data view parsers to be used by this record data
     *            parser. This list should contain one
     *            {@link DataViewParserGenericDOM} or
     *            {@link DataViewParserGenericString} instance.
     * @throws NullPointerException
     *             if parsers is null
     * @throws IllegalArgumentException
     *             if parsers is empty or contains duplicate entries
     */
    protected AbstractClarinFCSRecordDataParser(List<DataViewParser> parsers) {
        if (parsers == null) {
            throw new NullPointerException("parsers == null");
        }
        if (parsers.isEmpty()) {
            throw new IllegalArgumentException("parsers is empty");
        }

        ArrayList<DataViewParser> list = new ArrayList<>();
        boolean foundGeneric = false;
        for (DataViewParser parser : parsers) {
            if ((parser instanceof DataViewParserGenericDOM) ||
                    (parser instanceof DataViewParserGenericString)) {
                if (foundGeneric) {
                    throw new IllegalAccessError("parser list should contain " +
                            "only one instance of DataViewParserGenericDOM " +
                            "or DataViewParserGenericString");
                }
                foundGeneric = true;
            }
            if (list.contains(parser)) {
                throw new IllegalArgumentException("parser list should not " +
                        "contain douplicates: " + parser.getClass().getName());
            }
            list.add(parser);
        }

        if (!foundGeneric) {
            logger.warn("No generic type data view parser found. You should " +
                    "make sure that the parser list contains one " +
                    "DataViewParserGenericDOM or DataViewParserGenericString " +
                    "instance");
        }

        this.parsers = Collections.unmodifiableList(list);
    }

/**
     * Constructor.
     *
     * @param parsers
     *            the list of data view parsers to be used by this record data
     *            parser. This list should contain one
     *            {@link DataViewParserGenericDOM} or
     *            {@link DataViewParserGenericString} instance.
     * @throws NullPointerException
     *             if parsers is null
     * @throws IllegalArgumentException
     *             if parsers is empty or contains duplicate entries
     */
    protected AbstractClarinFCSRecordDataParser(List<DataViewParser> parsers) {
        if (parsers == null) {
            throw new NullPointerException("parsers == null");
        }
        if (parsers.isEmpty()) {
            throw new IllegalArgumentException("parsers is empty");
        }

        ArrayList<DataViewParser> list = new ArrayList<DataViewParser>();
        boolean foundGeneric = false;
        for (DataViewParser parser : parsers) {
            if ((parser instanceof DataViewParserGenericDOM) ||
                    (parser instanceof DataViewParserGenericString)) {
                if (foundGeneric) {
                    throw new IllegalAccessError("parser list should contain " +
                            "only one instance of DataViewParserGenericDOM " +
                            "or DataViewParserGenericString");
                }
                foundGeneric = true;
            }
            if (list.contains(parser)) {
                throw new IllegalArgumentException("parser list should not " +
                        "contain douplicates: " + parser.getClass().getName());
            }
            list.add(parser);
        }

        if (!foundGeneric) {
            logger.warn("No generic type data view parser found. You should " +
                    "make sure that the parser list contains one " +
                    "DataViewParserGenericDOM or DataViewParserGenericString " +
                    "instance");
        }

        this.parsers = Collections.unmodifiableList(list);
    }

Replace Generic With Diamond ArrayList<DataViewParser> with ArrayList<> in method protected AbstractClarinFCSRecordDataParser(parsers List<DataViewParser>) from class eu.clarin.sru.client.fcs.AbstractClarinFCSRecordDataParser


    private List<DataView> parseDataViews(XMLStreamReader reader, String ns)
            throws XMLStreamException, SRUClientException {
        List<DataView> dataviews = null;

        while (XmlStreamReaderUtils.readStart(reader, ns, "DataView", false, true)) {
            final String pid =
                    XmlStreamReaderUtils.readAttributeValue(reader, null, "pid");
            final String ref =
                    XmlStreamReaderUtils.readAttributeValue(reader, null, "ref");
            final String type =
                    XmlStreamReaderUtils.readAttributeValue(reader, null, "type");
            if ((type == null) || type.isEmpty()) {
                throw new SRUClientException("element <DataView> needs a "
                        + "non-empty 'type' attribute");
            }

            // consume start element and get rid of any whitespace
            XmlStreamReaderUtils.consumeStart(reader);
            XmlStreamReaderUtils.consumeWhitespace(reader);

            logger.debug("processing <DataView> of type = {}", type);

            DataViewParser selectedParser = null;
            for (DataViewParser parser : parsers) {
                if (parser.acceptType(type) &&
                        ((selectedParser == null) ||
                         (selectedParser.getPriority() < parser.getPriority()))) {
                    selectedParser = parser;
                }
            }

            DataView dataview = null;
            if (selectedParser != null) {
                dataview = selectedParser.parse(reader, type, pid, ref);
            } else {
                logger.warn("no parser found for <DataView> of type = {}", type);
            }

            XmlStreamReaderUtils.readEnd(reader, ns, "DataView", true);

            if (dataview != null) {
                if (dataviews == null) {
                    dataviews = new LinkedList<>();
                }
                dataviews.add(dataview);
            } else {
                logger.warn("skipped <DataView> of type = {}", type);
            }
        } // while
        return dataviews;
    }

    private List<DataView> parseDataViews(XMLStreamReader reader, String ns)
            throws XMLStreamException, SRUClientException {
        List<DataView> dataviews = null;

        while (XmlStreamReaderUtils.readStart(reader, ns, "DataView", false, true)) {
            final String pid =
                    XmlStreamReaderUtils.readAttributeValue(reader, null, "pid");
            final String ref =
                    XmlStreamReaderUtils.readAttributeValue(reader, null, "ref");
            final String type =
                    XmlStreamReaderUtils.readAttributeValue(reader, null, "type");
            if ((type == null) || type.isEmpty()) {
                throw new SRUClientException("element <DataView> needs a "
                        + "non-empty 'type' attribute");
            }

            // consume start element and get rid of any whitespace
            XmlStreamReaderUtils.consumeStart(reader);
            XmlStreamReaderUtils.consumeWhitespace(reader);

            logger.debug("processing <DataView> of type = {}", type);

            DataViewParser selectedParser = null;
            for (DataViewParser parser : parsers) {
                if (parser.acceptType(type) &&
                        ((selectedParser == null) ||
                         (selectedParser.getPriority() < parser.getPriority()))) {
                    selectedParser = parser;
                }
            }

            DataView dataview = null;
            if (selectedParser != null) {
                dataview = selectedParser.parse(reader, type, pid, ref);
            } else {
                logger.warn("no parser found for <DataView> of type = {}", type);
            }

            XmlStreamReaderUtils.readEnd(reader, ns, "DataView", true);

            if (dataview != null) {
                if (dataviews == null) {
                    dataviews = new LinkedList<DataView>();
                }
                dataviews.add(dataview);
            } else {
                logger.warn("skipped <DataView> of type = {}", type);
            }
        } // while
        return dataviews;
    }

Replace Generic With Diamond LinkedList<DataView> with LinkedList<> in method private parseDataViews(reader XMLStreamReader, ns String) : List<DataView> from class eu.clarin.sru.client.fcs.AbstractClarinFCSRecordDataParser


    private List<Resource.ResourceFragment> parseResourceFragments(
            XMLStreamReader reader, String ns) throws XMLStreamException,
            SRUClientException {
        List<Resource.ResourceFragment> resourceFragments = null;
        while (XmlStreamReaderUtils.readStart(reader, ns, "ResourceFragment", false, true)) {
            logger.debug("found ResourceFragment");
            String pid = XmlStreamReaderUtils.readAttributeValue(reader, null, "pid");
            String ref = XmlStreamReaderUtils.readAttributeValue(reader, null, "ref");
            XmlStreamReaderUtils.consumeStart(reader);
            final List<DataView> dataviews = parseDataViews(reader, ns);
            XmlStreamReaderUtils.readEnd(reader, ns, "ResourceFragment", true);

            if (resourceFragments == null) {
                resourceFragments = new LinkedList<>();
            }
            resourceFragments.add(new Resource.ResourceFragment(pid, ref, dataviews));
        } // while
        return resourceFragments;
    }

    private List<Resource.ResourceFragment> parseResourceFragments(
            XMLStreamReader reader, String ns) throws XMLStreamException,
            SRUClientException {
        List<Resource.ResourceFragment> resourceFragments = null;
        while (XmlStreamReaderUtils.readStart(reader, ns, "ResourceFragment", false, true)) {
            logger.debug("found ResourceFragment");
            String pid = XmlStreamReaderUtils.readAttributeValue(reader, null, "pid");
            String ref = XmlStreamReaderUtils.readAttributeValue(reader, null, "ref");
            XmlStreamReaderUtils.consumeStart(reader);
            final List<DataView> dataviews = parseDataViews(reader, ns);
            XmlStreamReaderUtils.readEnd(reader, ns, "ResourceFragment", true);

            if (resourceFragments == null) {
                resourceFragments = new LinkedList<Resource.ResourceFragment>();
            }
            resourceFragments.add(new Resource.ResourceFragment(pid, ref, dataviews));
        } // while
        return resourceFragments;
    }

Replace Generic With Diamond LinkedList<Resource.ResourceFragment> with LinkedList<> in method private parseResourceFragments(reader XMLStreamReader, ns String) : List<Resource.ResourceFragment> from class eu.clarin.sru.client.fcs.AbstractClarinFCSRecordDataParser


    @SuppressWarnings("deprecation")
    private List<DataViewParser> finalizeDataViewParsers() {
        final List<DataViewParser> result =
                new ArrayList<>(parsers.size() +
                        (legacySupport ? 2 : 1));
        result.addAll(parsers);
        if (unknownAsDom) {
            result.add(new DataViewParserGenericDOM());
        } else {
            result.add(new DataViewParserGenericString());
        }
        if (legacySupport) {
            result.add(new DataViewParserKWIC(fullLegacyCompatMode));
        }
        return result;
    }

    @SuppressWarnings("deprecation")
    private List<DataViewParser> finalizeDataViewParsers() {
        final List<DataViewParser> result =
                new ArrayList<DataViewParser>(parsers.size() +
                        (legacySupport ? 2 : 1));
        result.addAll(parsers);
        if (unknownAsDom) {
            result.add(new DataViewParserGenericDOM());
        } else {
            result.add(new DataViewParserGenericString());
        }
        if (legacySupport) {
            result.add(new DataViewParserKWIC(fullLegacyCompatMode));
        }
        return result;
    }

Replace Generic With Diamond ArrayList<DataViewParser> with ArrayList<> in method private finalizeDataViewParsers() : List<DataViewParser> from class eu.clarin.sru.client.fcs.ClarinFCSClientBuilder


    private static Map<String, String> parseI18String(XMLStreamReader reader,
            String localName, boolean required) throws XMLStreamException {
        Map<String, String> result = null;
        while (XmlStreamReaderUtils.readStart(reader, ED_NS_URI, localName,
                ((result == null) && required), true)) {
            final String lang = XmlStreamReaderUtils.readAttributeValue(reader,
                    XMLConstants.XML_NS_URI, "lang", true);
            reader.next(); // skip start tag
            final String content = XmlStreamReaderUtils.readString(reader, true);
            if (result == null) {
                result = new HashMap<>();
            }
            if (result.containsKey(lang)) {
                throw new XMLStreamException("language '" + lang +
                        "' already defined for element '<" + localName + ">'",
                        reader.getLocation());
            } else {
                result.put(lang, content);
            }
            XmlStreamReaderUtils.readEnd(reader, ED_NS_URI, localName);
        } // while
        return result;
    }

    private static Map<String, String> parseI18String(XMLStreamReader reader,
            String localName, boolean required) throws XMLStreamException {
        Map<String, String> result = null;
        while (XmlStreamReaderUtils.readStart(reader, ED_NS_URI, localName,
                ((result == null) && required), true)) {
            final String lang = XmlStreamReaderUtils.readAttributeValue(reader,
                    XMLConstants.XML_NS_URI, "lang", true);
            reader.next(); // skip start tag
            final String content = XmlStreamReaderUtils.readString(reader, true);
            if (result == null) {
                result = new HashMap<String, String>();
            }
            if (result.containsKey(lang)) {
                throw new XMLStreamException("language '" + lang +
                        "' already defined for element '<" + localName + ">'",
                        reader.getLocation());
            } else {
                result.put(lang, content);
            }
            XmlStreamReaderUtils.readEnd(reader, ED_NS_URI, localName);
        } // while
        return result;
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method private parseI18String(reader XMLStreamReader, localName String, required boolean) : Map<String,String> from class eu.clarin.sru.client.fcs.ClarinFCSEndpointDescriptionParser


    /**
     * distributes uploaded item to system defined
     *
     * @param hostSystem  object contains host system information
     * @param session     an established SSH session
     * @param source      source file
     * @param destination destination file
     * @return status uploaded file
     */
    public static HostSystem pushUpload(HostSystem hostSystem, Session session, String source, String destination) {

        hostSystem.setStatusCd(HostSystem.SUCCESS_STATUS);
        Channel channel = null;
        ChannelSftp c = null;

        try (FileInputStream file = new FileInputStream(source)) {
            channel = session.openChannel("sftp");
            channel.setInputStream(System.in);
            channel.setOutputStream(System.out);
            channel.connect(CHANNEL_TIMEOUT);

            c = (ChannelSftp) channel;
            destination = destination.replaceAll("~\\/|~", "");

            c.put(file, destination);

        } catch (Exception e) {
            log.info(e.toString(), e);
            hostSystem.setErrorMsg(e.getMessage());
            hostSystem.setStatusCd(HostSystem.GENERIC_FAIL_STATUS);
        }
        //exit
        if (c != null) {
            c.exit();
        }
        //disconnect
        if (channel != null) {
            channel.disconnect();
        }

        return hostSystem;

    }

    /**
     * distributes uploaded item to system defined
     *
     * @param hostSystem object contains host system information
     * @param session          an established SSH session
     * @param source           source file
     * @param destination      destination file
     * @return status uploaded file
     */
    public static HostSystem pushUpload(HostSystem hostSystem, Session session, String source, String destination) {

        hostSystem.setStatusCd(HostSystem.SUCCESS_STATUS);
        Channel channel = null;
        ChannelSftp c = null;

        try {

            channel = session.openChannel("sftp");
            channel.setInputStream(System.in);
            channel.setOutputStream(System.out);
            channel.connect(CHANNEL_TIMEOUT);

            c = (ChannelSftp) channel;
            destination = destination.replaceAll("~\\/|~", "");

            //get file input stream
            FileInputStream file = new FileInputStream(source);
            c.put(file, destination);

        } catch (Exception e) {
            hostSystem.setErrorMsg(e.getMessage());
            hostSystem.setStatusCd(HostSystem.GENERIC_FAIL_STATUS);
        }
        //exit
        if (c != null) {
            c.exit();
        }
        //disconnect
        if (channel != null) {
            channel.disconnect();
        }

        return hostSystem;

    }

Try With Resources try(FileInputStream file=new FileInputStream(source)) in method public pushUpload(hostSystem HostSystem, session Session, source String, destination String) : HostSystem from class com.ec2box.manage.util.SSHUtil


    /**
     * gets the property from config and returns map of name / value pairs
     *
     * @param name property name
     * @return configuration property
     */
    public static Map<String,String> getMapProperties(String name) {

        String values= prop.getString(name);
        Map<String,String> map= new LinkedHashMap<>();

        for(String set:values.split(";")){
            String key=set.split(",")[0];
            String val =set.split(",")[1];
            map.put(key,val);

        }
        return map;
    }

    /**
     * gets the property from config and returns map of name / value pairs
     *
     * @param name property name
     * @return configuration property
     */
    public static Map<String,String> getMapProperties(String name) {

        String values= prop.getString(name);
        Map<String,String> map= new LinkedHashMap<String, String>();

        for(String set:values.split(";")){
            String key=set.split(",")[0];
            String val =set.split(",")[1];
            map.put(key,val);

        }
        return map;
    }

Replace Generic With Diamond LinkedHashMap<String,String> with LinkedHashMap<> in method public getMapProperties(name String) : Map<String,String> from class com.ec2box.common.util.AppConfig


    @Action(value = "/admin/qrImage")
    public String qrImage() {

        String username = UserDB.getUser(AuthUtil.getUserId(servletRequest.getSession())).getUsername();

        String secret = AuthUtil.getOTPSecret(servletRequest.getSession());

        AuthUtil.setOTPSecret(servletRequest.getSession(), null);

        try {

            String qrCodeText = "otpauth://totp/EC2Box%20%28" + URLEncoder.encode(servletRequest.getHeader("host").replaceAll("\\:.*$",""), "utf-8") + "%29:" + username + "?secret=" + secret;

            QRCodeWriter qrWriter = new QRCodeWriter();

            Hashtable<EncodeHintType, String> hints = new Hashtable<>();
            hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");

            BitMatrix matrix = qrWriter.encode(qrCodeText, BarcodeFormat.QR_CODE, QR_IMAGE_WIDTH, QR_IMAGE_HEIGHT, hints);
            servletResponse.setContentType("image/png");

            BufferedImage image = new BufferedImage(QR_IMAGE_WIDTH, QR_IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);

            Graphics2D graphics = (Graphics2D) image.getGraphics();
            graphics.setColor(Color.WHITE);
            graphics.fillRect(0, 0, QR_IMAGE_WIDTH, QR_IMAGE_HEIGHT);
            graphics.setColor(Color.BLACK);

            for (int x = 0; x < QR_IMAGE_WIDTH; x++) {
                for (int y = 0; y < QR_IMAGE_HEIGHT; y++) {
                    if (matrix.get(x, y)) {
                        graphics.fillRect(x, y, 1, 1);
                    }
                }
            }
            ImageIO.write(image, "png", servletResponse.getOutputStream());

            servletResponse.getOutputStream().flush();
            servletResponse.getOutputStream().close();

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }

        return null;

    }

    @Action(value = "/admin/qrImage")
    public String qrImage() {

        String username = UserDB.getUser(AuthUtil.getUserId(servletRequest.getSession())).getUsername();

        String secret = AuthUtil.getOTPSecret(servletRequest.getSession());

        AuthUtil.setOTPSecret(servletRequest.getSession(), null);

        try {

            String qrCodeText = "otpauth://totp/EC2Box%20%28" + URLEncoder.encode(servletRequest.getHeader("host").replaceAll("\\:.*$",""), "utf-8") + "%29:" + username + "?secret=" + secret;

            QRCodeWriter qrWriter = new QRCodeWriter();

            Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>();
            hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");

            BitMatrix matrix = qrWriter.encode(qrCodeText, BarcodeFormat.QR_CODE, QR_IMAGE_WIDTH, QR_IMAGE_HEIGHT, hints);
            servletResponse.setContentType("image/png");

            BufferedImage image = new BufferedImage(QR_IMAGE_WIDTH, QR_IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);

            Graphics2D graphics = (Graphics2D) image.getGraphics();
            graphics.setColor(Color.WHITE);
            graphics.fillRect(0, 0, QR_IMAGE_WIDTH, QR_IMAGE_HEIGHT);
            graphics.setColor(Color.BLACK);

            for (int x = 0; x < QR_IMAGE_WIDTH; x++) {
                for (int y = 0; y < QR_IMAGE_HEIGHT; y++) {
                    if (matrix.get(x, y)) {
                        graphics.fillRect(x, y, 1, 1);
                    }
                }
            }
            ImageIO.write(image, "png", servletResponse.getOutputStream());

            servletResponse.getOutputStream().flush();
            servletResponse.getOutputStream().close();

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }

        return null;

    }

Replace Generic With Diamond Hashtable<EncodeHintType,String> with Hashtable<> in method public qrImage() : String from class com.ec2box.manage.action.OTPAction


    /**
     * returns list of all amazon credentials
     *
     * @param sortedSet object that defines sort order
     * @return sorted aws credential list
     */
    public static SortedSet getAWSCredSet(SortedSet sortedSet) {

        List<AWSCred> awsCredList = new ArrayList<>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }
        String sql = "select * from aws_credentials " + orderBy;

        Connection con = null;
        try {
            con = DBUtils.getConn();

            PreparedStatement stmt = con.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {

                AWSCred awsCred = new AWSCred();
                awsCred.setId(rs.getLong("id"));
                awsCred.setAccessKey(rs.getString("access_key"));
                //awsCred.setSecretKey(EncryptionUtil.decrypt(rs.getString("secret_key")));
                awsCredList.add(awsCred);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }

        //close db connection
        DBUtils.closeConn(con);

        sortedSet.setItemList(awsCredList);

        return sortedSet;

    }

    /**
     * returns list of all amazon credentials
     *
     * @param sortedSet object that defines sort order
     * @return sorted aws credential list
     */
    public static SortedSet getAWSCredSet(SortedSet sortedSet) {

        List<AWSCred> awsCredList = new ArrayList<AWSCred>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }
        String sql = "select * from aws_credentials " + orderBy;

        Connection con = null;
        try {
            con = DBUtils.getConn();

            PreparedStatement stmt = con.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {

                AWSCred awsCred = new AWSCred();
                awsCred.setId(rs.getLong("id"));
                awsCred.setAccessKey(rs.getString("access_key"));
                //awsCred.setSecretKey(EncryptionUtil.decrypt(rs.getString("secret_key")));
                awsCredList.add(awsCred);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }

        //close db connection
        DBUtils.closeConn(con);

        sortedSet.setItemList(awsCredList);

        return sortedSet;

    }

Replace Generic With Diamond ArrayList<AWSCred> with ArrayList<> in method public getAWSCredSet(sortedSet SortedSet) : SortedSet from class com.ec2box.manage.db.AWSCredDB


    /**
     * returns list of all amazon credentials
     *
     * @return  aws credential list
     */
    public static List<AWSCred> getAWSCredList() {

        List<AWSCred> awsCredList = new ArrayList<>();

        Connection con = null;
        try {
            con = DBUtils.getConn();

            PreparedStatement stmt = con.prepareStatement("select * from aws_credentials");
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {

                AWSCred awsCred = new AWSCred();
                awsCred.setId(rs.getLong("id"));
                awsCred.setAccessKey(rs.getString("access_key"));
                awsCred.setSecretKey(EncryptionUtil.decrypt(rs.getString("secret_key")));
                awsCredList.add(awsCred);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }

        //close db connection
        DBUtils.closeConn(con);

        return awsCredList;

    }

    /**
     * returns list of all amazon credentials
     *
     * @return  aws credential list
     */
    public static List<AWSCred> getAWSCredList() {

        List<AWSCred> awsCredList = new ArrayList<AWSCred>();

        Connection con = null;
        try {
            con = DBUtils.getConn();

            PreparedStatement stmt = con.prepareStatement("select * from aws_credentials");
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {

                AWSCred awsCred = new AWSCred();
                awsCred.setId(rs.getLong("id"));
                awsCred.setAccessKey(rs.getString("access_key"));
                awsCred.setSecretKey(EncryptionUtil.decrypt(rs.getString("secret_key")));
                awsCredList.add(awsCred);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }

        //close db connection
        DBUtils.closeConn(con);

        return awsCredList;

    }

Replace Generic With Diamond ArrayList<AWSCred> with ArrayList<> in method public getAWSCredList() : List<AWSCred> from class com.ec2box.manage.db.AWSCredDB


    /**
     * returns private key information for user
     *
     * @param sortedSet object that defines sort order
     * @return sorted identity list
     */
    public static SortedSet getEC2KeySet( SortedSet sortedSet) {

        List<EC2Key> ec2KeyList = new ArrayList<>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select * from ec2_keys, aws_credentials where ec2_keys.aws_cred_id=aws_credentials.id "+ orderBy);
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                EC2Key ec2Key = new EC2Key();
                ec2Key.setId(rs.getLong("id"));
                ec2Key.setKeyNm(rs.getString("key_nm"));
                ec2Key.setEc2Region(rs.getString("ec2_region"));
                ec2Key.setAwsCredId(rs.getLong("aws_cred_id"));
                ec2Key.setAccessKey(rs.getString("access_key"));
                ec2KeyList.add(ec2Key);
            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        sortedSet.setItemList(ec2KeyList);

        return sortedSet;

    }

    /**
     * returns private key information for user
     *
     * @param sortedSet object that defines sort order
     * @return sorted identity list
     */
    public static SortedSet getEC2KeySet( SortedSet sortedSet) {

        List<EC2Key> ec2KeyList = new ArrayList<EC2Key>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select * from ec2_keys, aws_credentials where ec2_keys.aws_cred_id=aws_credentials.id "+ orderBy);
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                EC2Key ec2Key = new EC2Key();
                ec2Key.setId(rs.getLong("id"));
                ec2Key.setKeyNm(rs.getString("key_nm"));
                ec2Key.setEc2Region(rs.getString("ec2_region"));
                ec2Key.setAwsCredId(rs.getLong("aws_cred_id"));
                ec2Key.setAccessKey(rs.getString("access_key"));
                ec2KeyList.add(ec2Key);
            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        sortedSet.setItemList(ec2KeyList);

        return sortedSet;

    }

Replace Generic With Diamond ArrayList<EC2Key> with ArrayList<> in method public getEC2KeySet(sortedSet SortedSet) : SortedSet from class com.ec2box.manage.db.EC2KeyDB


    /**
     * returns private keys information for region and user
     *
     * @param ec2Region ec2 region
     * @param awsCredId aws cred id
     * @return key information
     */
    public static List<EC2Key> getEC2KeyByRegion(String ec2Region, Long awsCredId) {
        List<EC2Key> ec2KeyList = new ArrayList<>();

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select * from ec2_keys where ec2_region like ? and aws_cred_id=?");
            stmt.setString(1, ec2Region);
            stmt.setLong(2, awsCredId);
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                EC2Key ec2Key = new EC2Key();
                ec2Key.setId(rs.getLong("id"));
                ec2Key.setKeyNm(rs.getString("key_nm"));
                ec2Key.setEc2Region(rs.getString("ec2_region"));
                ec2Key.setAwsCredId(rs.getLong("aws_cred_id"));
                ec2KeyList.add(ec2Key);
            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        return ec2KeyList;

    }

    /**
     * returns private keys information for region and user
     *
     * @param ec2Region ec2 region
     * @param awsCredId aws cred id
     * @return key information
     */
    public static List<EC2Key> getEC2KeyByRegion(String ec2Region, Long awsCredId) {
        List<EC2Key> ec2KeyList = new ArrayList<EC2Key>();

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select * from ec2_keys where ec2_region like ? and aws_cred_id=?");
            stmt.setString(1, ec2Region);
            stmt.setLong(2, awsCredId);
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                EC2Key ec2Key = new EC2Key();
                ec2Key.setId(rs.getLong("id"));
                ec2Key.setKeyNm(rs.getString("key_nm"));
                ec2Key.setEc2Region(rs.getString("ec2_region"));
                ec2Key.setAwsCredId(rs.getLong("aws_cred_id"));
                ec2KeyList.add(ec2Key);
            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        return ec2KeyList;

    }

Replace Generic With Diamond ArrayList<EC2Key> with ArrayList<> in method public getEC2KeyByRegion(ec2Region String, awsCredId Long) : List<EC2Key> from class com.ec2box.manage.db.EC2KeyDB


    /**
     * returns the EC2 region
     *
     * @return region set
     */
    public static List<String> getEC2Regions() {

        List<String> ec2RegionList = new ArrayList<>();

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select distinct ec2_region from ec2_keys");
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                ec2RegionList.add(rs.getString("ec2_region"));

            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        return ec2RegionList;

    }

    /**
     * returns the EC2 region
     *
     * @return region set
     */
    public static List<String> getEC2Regions() {

        List<String> ec2RegionList = new ArrayList<String>();

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select distinct ec2_region from ec2_keys");
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                ec2RegionList.add(rs.getString("ec2_region"));

            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        return ec2RegionList;

    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getEC2Regions() : List<String> from class com.ec2box.manage.db.EC2KeyDB


    /**
     * method to do order by based on the sorted set object for profiles
     * @return list of profiles
     */
    public static SortedSet getProfileSet(SortedSet sortedSet) {

        ArrayList<Profile> profileList = new ArrayList<>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }
        String sql = "select * from  profiles " + orderBy;

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                Profile profile = new Profile();
                profile.setId(rs.getLong("id"));
                profile.setNm(rs.getString("nm"));
                profile.setTag(rs.getString("tag"));
                profileList.add(profile);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        sortedSet.setItemList(profileList);
        return sortedSet;
    }

    /**
     * method to do order by based on the sorted set object for profiles
     * @return list of profiles
     */
    public static SortedSet getProfileSet(SortedSet sortedSet) {

        ArrayList<Profile> profileList = new ArrayList<Profile>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }
        String sql = "select * from  profiles " + orderBy;

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement(sql);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                Profile profile = new Profile();
                profile.setId(rs.getLong("id"));
                profile.setNm(rs.getString("nm"));
                profile.setTag(rs.getString("tag"));
                profileList.add(profile);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        sortedSet.setItemList(profileList);
        return sortedSet;
    }

Replace Generic With Diamond ArrayList<Profile> with ArrayList<> in method public getProfileSet(sortedSet SortedSet) : SortedSet from class com.ec2box.manage.db.ProfileDB


    /**
     * returns all profile information
     *
     * @return list of profiles
     */
    public static List<Profile> getAllProfiles() {

        ArrayList<Profile> profileList = new ArrayList<>();
        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select * from  profiles order by nm asc");
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                Profile profile = new Profile();
                profile.setId(rs.getLong("id"));
                profile.setNm(rs.getString("nm"));
                profile.setTag(rs.getString("tag"));
                profileList.add(profile);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        return profileList;
    }

    /**
     * returns all profile information
     *
     * @return list of profiles
     */
    public static List<Profile> getAllProfiles() {

        ArrayList<Profile> profileList = new ArrayList<Profile>();
        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement("select * from  profiles order by nm asc");
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                Profile profile = new Profile();
                profile.setId(rs.getLong("id"));
                profile.setNm(rs.getString("nm"));
                profile.setTag(rs.getString("tag"));
                profileList.add(profile);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        return profileList;
    }

Replace Generic With Diamond ArrayList<Profile> with ArrayList<> in method public getAllProfiles() : List<Profile> from class com.ec2box.manage.db.ProfileDB


    /**
     * returns scripts based on sort order defined
     * @param sortedSet object that defines sort order
     * @param userId user id
     * @return sorted script list
     */
    public static SortedSet getScriptSet(SortedSet sortedSet, Long userId) {

        ArrayList<Script> scriptList = new ArrayList<>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }
        String sql = "select * from scripts where user_id =? " + orderBy;

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement(sql);
            stmt.setLong(1, userId);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                Script script = new Script();
                script.setId(rs.getLong("id"));
                script.setDisplayNm(rs.getString("display_nm"));
                script.setScript(rs.getString("script"));
                script.setUserId(rs.getLong("user_id"));

                scriptList.add(script);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        sortedSet.setItemList(scriptList);
        return sortedSet;
    }

    /**
     * returns scripts based on sort order defined
     * @param sortedSet object that defines sort order
     * @param userId user id
     * @return sorted script list
     */
    public static SortedSet getScriptSet(SortedSet sortedSet, Long userId) {

        ArrayList<Script> scriptList = new ArrayList<Script>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = "order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }
        String sql = "select * from scripts where user_id =? " + orderBy;

        Connection con = null;
        try {
            con = DBUtils.getConn();
            PreparedStatement stmt = con.prepareStatement(sql);
            stmt.setLong(1, userId);
            ResultSet rs = stmt.executeQuery();

            while (rs.next()) {
                Script script = new Script();
                script.setId(rs.getLong("id"));
                script.setDisplayNm(rs.getString("display_nm"));
                script.setScript(rs.getString("script"));
                script.setUserId(rs.getLong("user_id"));

                scriptList.add(script);

            }
            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);

        sortedSet.setItemList(scriptList);
        return sortedSet;
    }

Replace Generic With Diamond ArrayList<Script> with ArrayList<> in method public getScriptSet(sortedSet SortedSet, userId Long) : SortedSet from class com.ec2box.manage.db.ScriptDB


    /**
     * returns sessions based on sort order defined
     *
     * @param sortedSet object that defines sort order
     * @return session list
     */
    public static SortedSet getSessions(SortedSet sortedSet) {
        //get db connection
        Connection con = null;
        List<SessionAudit> outputList = new LinkedList<>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = " order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }

        String sql = "select * from session_log, users where users.id= session_log.user_id " + orderBy;
        try {

            con = DBUtils.getConn();
            deleteAuditHistory(con);

            PreparedStatement stmt = con.prepareStatement(sql);

            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                SessionAudit sessionAudit = new SessionAudit();
                sessionAudit.setId(rs.getLong("session_log.id"));
                sessionAudit.setSessionTm(rs.getTimestamp("session_tm"));
                sessionAudit.setUser(UserDB.getUser(con, rs.getLong("user_id")));
                outputList.add(sessionAudit);

            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        //close db connection
        DBUtils.closeConn(con);

        sortedSet.setItemList(outputList);

        return sortedSet;

    }

    /**
     * returns sessions based on sort order defined
     *
     * @param sortedSet object that defines sort order
     * @return session list
     */
    public static SortedSet getSessions(SortedSet sortedSet) {
        //get db connection
        Connection con = null;
        List<SessionAudit> outputList = new LinkedList<SessionAudit>();

        String orderBy = "";
        if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
            orderBy = " order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
        }

        String sql = "select * from session_log, users where users.id= session_log.user_id " + orderBy;
        try {

            con = DBUtils.getConn();
            deleteAuditHistory(con);

            PreparedStatement stmt = con.prepareStatement(sql);

            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                SessionAudit sessionAudit = new SessionAudit();
                sessionAudit.setId(rs.getLong("session_log.id"));
                sessionAudit.setSessionTm(rs.getTimestamp("session_tm"));
                sessionAudit.setUser(UserDB.getUser(con, rs.getLong("user_id")));
                outputList.add(sessionAudit);

            }

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        //close db connection
        DBUtils.closeConn(con);

        sortedSet.setItemList(outputList);

        return sortedSet;

    }

Replace Generic With Diamond LinkedList<SessionAudit> with LinkedList<> in method public getSessions(sortedSet SortedSet) : SortedSet from class com.ec2box.manage.db.SessionAuditDB


    /**
     * returns terminal logs for user session for host system
     *
     * @param sessionId    session id
     * @param hostSystemId host system id
     * @return session output for session
     */
    public static List<SessionOutput> getTerminalLogsForSession(Connection con, Long sessionId, Long hostSystemId) {

        List<SessionOutput> outputList = new LinkedList<>();
        try {
            PreparedStatement stmt = con.prepareStatement("select * from terminal_log where system_id=? and session_id=? order by log_tm asc");
            stmt.setLong(1, hostSystemId);
            stmt.setLong(2, sessionId);
            ResultSet rs = stmt.executeQuery();
            String output = "";
            while (rs.next()) {
                output = output + rs.getString("output");
            }

            output = output.replaceAll("(\\u0007|\u001B\\[K)", "");
            while (output.contains("\b")) {
                output = output.replaceFirst(".\b", "");
            }
            DBUtils.closeRs(rs);

            SessionOutput sessionOutput = new SessionOutput();
            sessionOutput.setId(hostSystemId);
            sessionOutput.setSessionId(sessionId);
            sessionOutput.getOutput().append(output);

            outputList.add(sessionOutput);

            DBUtils.closeRs(rs);

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return outputList;

    }

    /**
     * returns terminal logs for user session for host system
     *
     * @param sessionId    session id
     * @param hostSystemId host system id
     * @return session output for session
     */
    public static List<SessionOutput> getTerminalLogsForSession(Connection con, Long sessionId, Long hostSystemId) {

        List<SessionOutput> outputList = new LinkedList<SessionOutput>();
        try {
            PreparedStatement stmt = con.prepareStatement("select * from terminal_log where system_id=? and session_id=? order by log_tm asc");
            stmt.setLong(1, hostSystemId);
            stmt.setLong(2, sessionId);
            ResultSet rs = stmt.executeQuery();
            String output = "";
            while (rs.next()) {
                output = output + rs.getString("output");
            }

            output = output.replaceAll("(\\u0007|\u001B\\[K)", "");
            while (output.contains("\b")) {
                output = output.replaceFirst(".\b", "");
            }
            DBUtils.closeRs(rs);

            SessionOutput sessionOutput = new SessionOutput();
            sessionOutput.setId(hostSystemId);
            sessionOutput.setSessionId(sessionId);
            sessionOutput.getOutput().append(output);

            outputList.add(sessionOutput);

            DBUtils.closeRs(rs);

            DBUtils.closeStmt(stmt);

        } catch (Exception e) {
            e.printStackTrace();
        }
        return outputList;

    }

Replace Generic With Diamond LinkedList<SessionOutput> with LinkedList<> in method public getTerminalLogsForSession(con Connection, sessionId Long, hostSystemId Long) : List<SessionOutput> from class com.ec2box.manage.db.SessionAuditDB


    /**
     * returns terminal logs for user session for host system
     *
     * @param con       DB connection
     * @param sessionId session id
     * @return session output for session
     */
    public static List<HostSystem> getHostSystemsForSession(Connection con, Long sessionId) {

        List<HostSystem> hostSystemList = new ArrayList<>();
        try {
            PreparedStatement stmt = con.prepareStatement("select distinct system_id from terminal_log where session_id=?");
            stmt.setLong(1, sessionId);
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                HostSystem hostSystem = SystemDB.getSystem(con, rs.getLong("system_id"));
                hostSystemList.add(hostSystem);
            }

            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }
        return hostSystemList;

    }

    /**
     * returns terminal logs for user session for host system
     *
     * @param con       DB connection
     * @param sessionId session id
     * @return session output for session
     */
    public static List<HostSystem> getHostSystemsForSession(Connection con, Long sessionId) {

        List<HostSystem> hostSystemList = new ArrayList<HostSystem>();
        try {
            PreparedStatement stmt = con.prepareStatement("select distinct system_id from terminal_log where session_id=?");
            stmt.setLong(1, sessionId);
            ResultSet rs = stmt.executeQuery();
            while (rs.next()) {
                HostSystem hostSystem = SystemDB.getSystem(con, rs.getLong("system_id"));
                hostSystemList.add(hostSystem);
            }

            DBUtils.closeRs(rs);
            DBUtils.closeStmt(stmt);

        } catch (Exception ex) {
            log.error(ex.toString(), ex);
        }
        return hostSystemList;

    }

Replace Generic With Diamond ArrayList<HostSystem> with ArrayList<> in method public getHostSystemsForSession(con Connection, sessionId Long) : List<HostSystem> from class com.ec2box.manage.db.SessionAuditDB


    /**
     * method to do order by based on the sorted set object for systems. only selects instance IDs in provided list.
     *
     * @param sortedSet      sorted set object
     * @param instanceIdList instance ids to select
     * @return sortedSet with list of host systems
     */
    public static SortedSet getSystemSet(SortedSet sortedSet, List<String> instanceIdList) {
        List<HostSystem> hostSystemList = new ArrayList<>();

        if (!instanceIdList.isEmpty()) {

            String orderBy = "";
            if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
                orderBy = " order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
            }
            String sql = "select *, CONCAT_WS('-',m_alarm,m_insufficient_data,m_ok) as alarms from  system  where instance_id in ( ";
            for (int i = 0; i < instanceIdList.size(); i++) {
                if (i == instanceIdList.size() - 1) sql = sql + "'" + instanceIdList.get(i) + "') ";
                else sql = sql + "'" + instanceIdList.get(i) + "', ";
            }

            sql = sql + orderBy;

            Connection con = null;
            try {
                con = DBUtils.getConn();
                PreparedStatement stmt = con.prepareStatement(sql);

                ResultSet rs = stmt.executeQuery();

                while (rs.next()) {
                    HostSystem hostSystem = new HostSystem();
                    hostSystem.setId(rs.getLong("id"));
                    hostSystem.setDisplayNm(rs.getString("display_nm"));
                    hostSystem.setInstance(rs.getString("instance_id"));
                    hostSystem.setUser(rs.getString("user"));
                    hostSystem.setHost(rs.getString("host"));
                    hostSystem.setPort(rs.getInt("port"));
                    hostSystem.setKeyId(rs.getLong("key_id"));
                    hostSystem.setEc2Region(rs.getString("region"));
                    hostSystem.setState(rs.getString("state"));
                    hostSystem.setInstanceStatus(rs.getString("instance_status"));
                    hostSystem.setSystemStatus(rs.getString("system_status"));
                    hostSystem.setMonitorAlarm(rs.getInt("m_alarm"));
                    hostSystem.setMonitorInsufficientData(rs.getInt("m_insufficient_data"));
                    hostSystem.setMonitorOk(rs.getInt("m_ok"));
                    hostSystemList.add(hostSystem);
                }
                DBUtils.closeRs(rs);
                DBUtils.closeStmt(stmt);

            } catch (Exception e) {
                e.printStackTrace();
            }
            DBUtils.closeConn(con);

            sortedSet.setItemList(hostSystemList);
        }
        return sortedSet;

    }

    /**
     * method to do order by based on the sorted set object for systems. only selects instance IDs in provided list.
     *
     * @param sortedSet      sorted set object
     * @param instanceIdList instance ids to select
     * @return sortedSet with list of host systems
     */
    public static SortedSet getSystemSet(SortedSet sortedSet, List<String> instanceIdList) {
        List<HostSystem> hostSystemList = new ArrayList<HostSystem>();

        if (!instanceIdList.isEmpty()) {

            String orderBy = "";
            if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) {
                orderBy = " order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection();
            }
            String sql = "select *, CONCAT_WS('-',m_alarm,m_insufficient_data,m_ok) as alarms from  system  where instance_id in ( ";
            for (int i = 0; i < instanceIdList.size(); i++) {
                if (i == instanceIdList.size() - 1) sql = sql + "'" + instanceIdList.get(i) + "') ";
                else sql = sql + "'" + instanceIdList.get(i) + "', ";
            }

            sql = sql + orderBy;

            Connection con = null;
            try {
                con = DBUtils.getConn();
                PreparedStatement stmt = con.prepareStatement(sql);

                ResultSet rs = stmt.executeQuery();

                while (rs.next()) {
                    HostSystem hostSystem = new HostSystem();
                    hostSystem.setId(rs.getLong("id"));
                    hostSystem.setDisplayNm(rs.getString("display_nm"));
                    hostSystem.setInstance(rs.getString("instance_id"));
                    hostSystem.setUser(rs.getString("user"));
                    hostSystem.setHost(rs.getString("host"));
                    hostSystem.setPort(rs.getInt("port"));
                    hostSystem.setKeyId(rs.getLong("key_id"));
                    hostSystem.setEc2Region(rs.getString("region"));
                    hostSystem.setState(rs.getString("state"));
                    hostSystem.setInstanceStatus(rs.getString("instance_status"));
                    hostSystem.setSystemStatus(rs.getString("system_status"));
                    hostSystem.setMonitorAlarm(rs.getInt("m_alarm"));
                    hostSystem.setMonitorInsufficientData(rs.getInt("m_insufficient_data"));
                    hostSystem.setMonitorOk(rs.getInt("m_ok"));
                    hostSystemList.add(hostSystem);
                }
                DBUtils.closeRs(rs);
                DBUtils.closeStmt(stmt);

            } catch (Exception e) {
                e.printStackTrace();
            }
            DBUtils.closeConn(con);

            sortedSet.setItemList(hostSystemList);
        }
        return sortedSet;

    }

Replace Generic With Diamond ArrayList<HostSystem> with ArrayList<> in method public getSystemSet(sortedSet SortedSet, instanceIdList List<String>) : SortedSet from class com.ec2box.manage.db.SystemDB


    /**
     * returns list of systems by system instance id
     *
     * @param instanceIdList system instance id
     * @return system
     */
    public static List<HostSystem> getSystems(List<String> instanceIdList) {

        Connection con = null;

        List<HostSystem> hostSystemList = new ArrayList<>();
        for(String instanceId: instanceIdList){

            try {
                con = DBUtils.getConn();

                hostSystemList.add(getSystem(con, instanceId));

            } catch (Exception e) {
                e.printStackTrace();
            }
            DBUtils.closeConn(con);

        }

        return hostSystemList;
    }

    /**
     * returns list of systems by system instance id
     *
     * @param instanceIdList system instance id
     * @return system
     */
    public static List<HostSystem> getSystems(List<String> instanceIdList) {

        Connection con = null;

        List<HostSystem> hostSystemList = new ArrayList<HostSystem>();
        for(String instanceId: instanceIdList){

            try {
                con = DBUtils.getConn();

                hostSystemList.add(getSystem(con, instanceId));

            } catch (Exception e) {
                e.printStackTrace();
            }
            DBUtils.closeConn(con);

        }

        return hostSystemList;
    }

Replace Generic With Diamond ArrayList<HostSystem> with ArrayList<> in method public getSystems(instanceIdList List<String>) : List<HostSystem> from class com.ec2box.manage.db.SystemDB


    /**
     * set the initial status for selected systems
     *
     * @param systemSelectIds systems ids to set initial status
     * @param userId user id
     */
    public static void setInitialSystemStatus(List<Long> systemSelectIds, Long userId, HttpServletRequest servletRequest) {
        Connection con = null;
        try {
            con = DBUtils.getConn();

            if (!Auth.MANAGER.equals(AuthUtil.getUserType(servletRequest.getSession()))) {

                //make sure selected instance id is host the user has permission to.
                List<String> instanceIdList= (List<String>)servletRequest.getSession().getAttribute("instanceIdList");
                List<Long> systemIdList = new ArrayList<>();
                for (HostSystem hostSystem : SystemDB.getSystems(instanceIdList)) {
                    if (systemSelectIds.contains(hostSystem.getId())) {
                        systemIdList.add(hostSystem.getId());
                    }
                }
                systemSelectIds = systemIdList;

            }
            //deletes all old systems
            deleteAllSystemStatus(con, userId);

            for (Long hostSystemId : systemSelectIds) {

                HostSystem hostSystem= new HostSystem();
                hostSystem.setId(hostSystemId);
                hostSystem.setStatusCd(HostSystem.INITIAL_STATUS);

                //insert new status
                insertSystemStatus(con, hostSystem, userId);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);
    }

    /**
     * set the initial status for selected systems
     *
     * @param systemSelectIds systems ids to set initial status
     * @param userId user id
     */
    public static void setInitialSystemStatus(List<Long> systemSelectIds, Long userId, HttpServletRequest servletRequest) {
        Connection con = null;
        try {
            con = DBUtils.getConn();

            if (!Auth.MANAGER.equals(AuthUtil.getUserType(servletRequest.getSession()))) {

                //make sure selected instance id is host the user has permission to.
                List<String> instanceIdList= (List<String>)servletRequest.getSession().getAttribute("instanceIdList");
                List<Long> systemIdList = new ArrayList<Long>();
                for (HostSystem hostSystem : SystemDB.getSystems(instanceIdList)) {
                    if (systemSelectIds.contains(hostSystem.getId())) {
                        systemIdList.add(hostSystem.getId());
                    }
                }
                systemSelectIds = systemIdList;

            }
            //deletes all old systems
            deleteAllSystemStatus(con, userId);

            for (Long hostSystemId : systemSelectIds) {

                HostSystem hostSystem= new HostSystem();
                hostSystem.setId(hostSystemId);
                hostSystem.setStatusCd(HostSystem.INITIAL_STATUS);

                //insert new status
                insertSystemStatus(con, hostSystem, userId);

            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);
    }

Replace Generic With Diamond ArrayList<Long> with ArrayList<> in method public setInitialSystemStatus(systemSelectIds List<Long>, userId Long, servletRequest HttpServletRequest) : void from class com.ec2box.manage.db.SystemStatusDB


    /**
     * returns all statuses
     *
     * @param userId user id
     */
    public static List<HostSystem> getAllSystemStatus(Long userId) {

        List<HostSystem> hostSystemList = new ArrayList<>();
        Connection con = null;
        try {
            con = DBUtils.getConn();
            hostSystemList = getAllSystemStatus(con, userId);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);
        return hostSystemList;

    }

    /**
     * returns all statuses
     *
     * @param userId user id
     */
    public static List<HostSystem> getAllSystemStatus(Long userId) {

        List<HostSystem> hostSystemList = new ArrayList<HostSystem>();
        Connection con = null;
        try {
            con = DBUtils.getConn();
            hostSystemList = getAllSystemStatus(con, userId);

        } catch (Exception e) {
            e.printStackTrace();
        }
        DBUtils.closeConn(con);
        return hostSystemList;

    }

Replace Generic With Diamond ArrayList<HostSystem> with ArrayList<> in method public getAllSystemStatus(userId Long) : List<HostSystem> from class com.ec2box.manage.db.SystemStatusDB