Example usage for java.lang NullPointerException printStackTrace

List of usage examples for java.lang NullPointerException printStackTrace

Introduction

In this page you can find the example usage for java.lang NullPointerException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:com.hygenics.parser.RepConn.java

/**
 * Run the Pentaho Transformation Cleaner that replaces the connection
 * information for the specified transformations
 * /*from  www. j a va  2 s  . c  o  m*/
 * @throws -NullPointerException when no transformation list given
 */
public void run() {

    // save it

    log.info("Starting RepConn");
    if (transformations == null && transformdirs == null) {
        try {
            throw new NullPointerException("No transformation files specified!");
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
    } else if (transformdirs != null) {
        transformations = new ArrayList<String>();

        for (String dir : transformdirs) {
            transformations.addAll(getFiles(dir));
        }
    }

    if (transformations != null && transformations.size() > 0) {
        // vars
        TransMeta transMeta;
        DatabaseMeta dbm;
        JobMeta jMeta;

        /**
         * Iterate through the provided list of transformations and perform
         * the requested update
         */
        for (String trfpath : transformations) {
            log.info("Manipulating: " + trfpath + " @ " + Calendar.getInstance().getTime());
            transMeta = null;
            dbm = null;
            jMeta = null;

            File f = new File(trfpath);

            if (f.exists()) {

                try {
                    KettleEnvironment.init();
                    transMeta = new TransMeta(trfpath);

                    if (trfpath.toLowerCase().contains(".ktr")) {
                        // change transformation database information
                        List<DatabaseMeta> dbs = transMeta.getDatabases();
                        int pos = 0;
                        while (pos < dbs.size() && dbs.get(pos).getName().compareTo(connname.trim()) != 0) {
                            log.info("Conn FOUND :" + dbs.get(pos).getName());
                            pos++;
                        }

                        if (pos < dbs.size() && dbs.get(pos).getName().compareTo(connname.trim()) == 0) {
                            dbm = new DatabaseMeta();
                            dbm.setDatabaseInterface(DatabaseMeta.getDatabaseInterface("POSTGRESQL"));
                            dbm.setName(connname.trim());
                            dbm.setHostname(jdbname.trim());
                            dbm.setDBName(jdbdatabase.trim());
                            dbm.setDBPort("5432");
                            dbm.setUsername(jdbuser.trim());
                            dbm.setPassword(jdbpass.trim());

                            // save transformation
                            transMeta.addOrReplaceDatabase(dbm);
                            transMeta.setChanged(true);
                            transMeta.saveSharedObjects();

                            String xml = transMeta.getXML();
                            xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml;
                            transMeta.saveSharedObjects();
                            log.info("Saving to " + trfpath);
                            try (FileWriter writer = new FileWriter(new File(trfpath))) {
                                writer.write(xml);
                            }

                        }
                    } else if (trfpath.contains(".kjb")) {

                        // change job database information
                        jMeta = new JobMeta(trfpath, null);
                        dbm = new DatabaseMeta();
                        dbm.setDatabaseInterface(DatabaseMeta.getDatabaseInterface("POSTGRESQL"));
                        dbm.setName(connname.trim());
                        dbm.setHostname(jdbhost.trim());
                        dbm.setDBName(jdbdatabase.trim());
                        dbm.setDBPort(jdbport.trim());
                        dbm.setUsername(jdbuser.trim());
                        dbm.setPassword(jdbpass.trim());

                        // save job
                        jMeta.addOrReplaceDatabase(dbm);
                        jMeta.setChanged(true);
                        jMeta.saveSharedObjects();

                        String xml = jMeta.getXML();
                        xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml;
                        try (FileWriter writer = new FileWriter(new File(trfpath))) {
                            writer.write(xml);
                        }

                    } else {
                        // this will hit if the file is not a .kjb or.ktr
                        log.warn("SKIP FILE WARNING: " + trfpath
                                + " Is Not a Proper or Recognized Pentaho File!\n The extensions .ktr and .kjb are accepted!\n");
                    }

                } catch (KettleXMLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (KettleMissingPluginsException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (KettleDatabaseException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (KettleException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } else {
                try {
                    throw new FileNotFoundException("File Not Found");
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                }
            }

            log.info("Done!\nGetting next Fpath");
        }
        log.info("Ending Repconn");
    }

}

From source file:nl.hnogames.domoticz.Fragments.Wizard.java

private void createCards() {
    context = getActivity();//  w  ww.ja  v  a2s  . com
    MaterialListView mListView = (MaterialListView) root.findViewById(R.id.wizard_listview);
    mListView.getItemAnimator().setAddDuration(300);
    mListView.getItemAnimator().setRemoveDuration(300);
    mListView.getAdapter().clearAll();

    mListView.setOnDismissCallback(new OnDismissCallback() {
        @Override
        public void onDismiss(@NonNull Card card, int position) {

            String cardTag = "Unknown";
            try {
                //noinspection ConstantConditions
                cardTag = card.getTag().toString();
            } catch (NullPointerException ex) {
                ex.printStackTrace();
            }

            Log.d(TAG, "CARD_TYPE: " + cardTag);
            mSharedPrefs.completeCard(cardTag);
            createCards();
        }
    });

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

    if (!mSharedPrefs.isCardCompleted(WELCOME))
        cardsToGenerate.add(WELCOME);
    if (!mSharedPrefs.isCardCompleted(FAVORITE))
        cardsToGenerate.add(FAVORITE);
    if (!mSharedPrefs.isCardCompleted(STARTUP))
        cardsToGenerate.add(STARTUP);
    if (!mSharedPrefs.isCardCompleted(GEOFENCE))
        cardsToGenerate.add(GEOFENCE);
    if (!mSharedPrefs.isCardCompleted(WEAR))
        cardsToGenerate.add(WEAR);
    if (!mSharedPrefs.isCardCompleted(GRAPH))
        cardsToGenerate.add(GRAPH);
    if (!mSharedPrefs.isCardCompleted(FILTER))
        cardsToGenerate.add(FILTER);
    if (!mSharedPrefs.isCardCompleted(WIDGETS))
        cardsToGenerate.add(WIDGETS);

    if (cardsToGenerate.size() <= 0)
        cardsToGenerate.add(FINISH);
    List<Card> cards = generateCards(cardsToGenerate);

    mListView.getAdapter().addAll(cards);
}

From source file:eu.celarcloud.jcatascopia.serverpack.MetricProcessor.java

public void processor(JSONObject json) {
    try {/* w  w  w .jav  a2 s  .c om*/
        String agentID = (String) json.get("agentID");
        String agentIP = (String) json.get("agentIP");

        AgentObj agent = this.server.agentMap.get(agentID);
        if (agent != null) {
            if (!agent.isRunning() && this.server.getDatabaseFlag())
                this.server.dbHandler.updateAgent(agent.getAgentID(), AgentObj.AgentStatus.UP.name());
            agent.clearAttempts();
            agent.setStatus(AgentObj.AgentStatus.UP);
        } else {
            if (this.server.inDebugMode())
                System.out.println(
                        "Agent with ID: " + agentID + " and IP: " + agentIP + ")" + "is NOT REGISTERED");
            this.server.writeToLog(Level.INFO, "Agent with ID: " + agentID + " and IP: " + agentIP
                    + " tried to inject metrics without REGISTERING");

            String s = "";
            if (this.server.inMaaSMode())
                s = this.server.getAvailableServer();
            this.sendRegisterRequest(agentIP, "4243", "AGENT.RECONNECT", s);

            return;
        }

        JSONArray eventArray = (JSONArray) json.get("events");
        JSONObject event;
        for (Object o : eventArray) {
            event = (JSONObject) o;

            String group = event.get("group").toString().replace("Probe", "");
            long timestamp = Long.parseLong(event.get("timestamp").toString());

            JSONArray metrics = (JSONArray) event.get("metrics");
            JSONObject obj;
            for (Object iter : metrics) {
                obj = (JSONObject) iter;
                String metric_name = (String) obj.get("name");
                String metricID = agentID + ":" + metric_name;
                String value = (String) obj.get("val");

                MetricObj metric = new MetricObj(metricID, agentID, metric_name, (String) obj.get("units"),
                        (String) obj.get("type"), group, value, timestamp);

                if (this.server.inDebugMode())
                    System.out.println("MetricProccessor>> metric values: " + metric.toString());

                if (this.server.metricMap.putIfAbsent(metricID, metric) != null) {
                    this.server.metricMap.replace(metricID, metric);

                    if (this.server.getDatabaseFlag())
                        this.server.dbHandler.insertMetricValue(metric);
                } else {
                    agent.addMetricToList(metricID);
                    if (this.server.getDatabaseFlag()) {
                        this.server.dbHandler.createMetric(metric);
                        this.server.dbHandler.insertMetricValue(metric);
                    }
                }

                if (server.inRedistributeMode()) {
                    String t = metric.getType();
                    if (t.equals("DOUBLE") || t.equals("INTEGER") || t.equals("LONG") || t.equals("FLOAT")) {
                        metric.calcAvg(Double.parseDouble(value));
                    }
                }
            }
        }
    } catch (NullPointerException e) {
        this.server.writeToLog(Level.SEVERE, e);
    } catch (Exception e) {
        this.server.writeToLog(Level.SEVERE, e);
        e.printStackTrace();
    }
    return;
}

From source file:io.github.jeremgamer.editor.panels.Buttons.java

public Buttons(final JFrame frame, final ButtonPanel be, final PanelSave ps) {
    this.setBorder(BorderFactory.createTitledBorder(""));

    this.frame = frame;

    JButton add = null;//from  ww  w  .ja v a  2 s .com
    try {
        add = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("add.png"))));
    } catch (IOException e) {
        e.printStackTrace();
    }
    add.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                JOptionPane jop = new JOptionPane();
                @SuppressWarnings("static-access")
                String name = jop.showInputDialog(null, "Nommez le bouton :", "Crer un bouton",
                        JOptionPane.QUESTION_MESSAGE);

                if (name != null) {
                    for (int i = 0; i < data.getSize(); i++) {
                        if (data.get(i).equals(name)) {
                            name += "1";
                        }
                    }
                    data.addElement(name);
                    new ButtonSave(name);
                    ActionPanel.updateLists();
                    OtherPanel.updateLists();
                    PanelsPanel.updateLists();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

    });

    JButton remove = null;
    try {
        remove = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e) {
        e.printStackTrace();
    }
    remove.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                if (buttonList.getSelectedValue() != null) {
                    File file = new File("projects/" + Editor.getProjectName() + "/buttons/"
                            + buttonList.getSelectedValue() + "/" + buttonList.getSelectedValue() + ".rbd");
                    JOptionPane jop = new JOptionPane();
                    @SuppressWarnings("static-access")
                    int option = jop.showConfirmDialog(null, "tes-vous sr de vouloir supprimer ce bouton?",
                            "Avertissement", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);

                    if (option == JOptionPane.OK_OPTION) {
                        File dir = new File("projects/" + Editor.getProjectName() + "/panels");
                        for (File f : FileUtils.listFilesAndDirs(dir, TrueFileFilter.INSTANCE,
                                TrueFileFilter.INSTANCE)) {
                            if (!f.isDirectory()) {
                                try {
                                    ps.load(f);
                                } catch (IOException e) {
                                    e.printStackTrace();
                                }
                                for (String section : ps
                                        .getSectionsContaining(buttonList.getSelectedValue() + " (Bouton)")) {
                                    ps.removeSection(section);
                                    try {
                                        ps.save(f);
                                    } catch (IOException e) {
                                        e.printStackTrace();
                                    }
                                }
                            }
                        }
                        if (buttonList.getSelectedValue().equals(be.getFileName())) {
                            be.setFileName("");
                        }
                        be.hide();
                        file.delete();
                        File parent = new File(file.getParent());
                        for (File img : FileUtils.listFiles(parent, TrueFileFilter.INSTANCE,
                                TrueFileFilter.INSTANCE)) {
                            img.delete();
                        }
                        parent.delete();
                        data.remove(buttonList.getSelectedIndex());
                        ActionPanel.updateLists();
                        OtherPanel.updateLists();
                        PanelsPanel.updateLists();
                    }
                }
            } catch (NullPointerException npe) {
                npe.printStackTrace();
            }

        }

    });

    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.LINE_AXIS));
    buttons.add(add);
    buttons.add(remove);

    updateList();
    buttonList.addMouseListener(new MouseAdapter() {
        @SuppressWarnings("unchecked")
        public void mouseClicked(MouseEvent evt) {
            JList<String> list = (JList<String>) evt.getSource();
            if (evt.getClickCount() == 2) {
                int index = list.locationToIndex(evt.getPoint());
                if (isOpen == false) {
                    be.load(new File("projects/" + Editor.getProjectName() + "/buttons/"
                            + list.getModel().getElementAt(index) + "/" + list.getModel().getElementAt(index)
                            + ".rbd"));
                    be.show();
                    previousSelection = list.getSelectedValue();
                    isOpen = true;
                } else {
                    try {
                        if (previousSelection.equals(list.getModel().getElementAt(index))) {
                            be.hide();
                            previousSelection = list.getSelectedValue();
                            list.clearSelection();
                            isOpen = false;
                        } else {
                            be.hideThenShow();
                            previousSelection = list.getSelectedValue();
                            be.load(new File("projects/" + Editor.getProjectName() + "/buttons/"
                                    + list.getModel().getElementAt(index) + "/"
                                    + list.getModel().getElementAt(index) + ".rbd"));
                        }
                    } catch (NullPointerException npe) {
                        be.hide();
                        list.clearSelection();
                    }
                }
            } else if (evt.getClickCount() == 3) {
                int index = list.locationToIndex(evt.getPoint());
                if (isOpen == false) {
                    be.load(new File("projects/" + Editor.getProjectName() + "/buttons/"
                            + list.getModel().getElementAt(index) + "/" + list.getModel().getElementAt(index)
                            + ".rbd"));
                    be.show();
                    previousSelection = list.getSelectedValue();
                    isOpen = true;
                } else {
                    try {
                        if (previousSelection.equals(list.getModel().getElementAt(index))) {
                            be.hide();
                            previousSelection = list.getSelectedValue();
                            list.clearSelection();
                            isOpen = false;
                        } else {
                            be.hideThenShow();
                            previousSelection = list.getSelectedValue();
                            be.load(new File("projects/" + Editor.getProjectName() + "/buttons/"
                                    + list.getModel().getElementAt(index) + "/"
                                    + list.getModel().getElementAt(index) + ".rbd"));
                        }
                    } catch (NullPointerException npe) {
                        be.hide();
                        list.clearSelection();
                    }
                }
            }
        }
    });
    JScrollPane listPane = new JScrollPane(buttonList);
    listPane.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED);
    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    this.add(buttons);
    this.add(listPane);

}

From source file:org.lunci.dumbthing.fragment.MainDisplayFragment.java

@Override
public void onSaveInstanceState(Bundle bundle) {
    super.onSaveInstanceState(bundle);
    try {//from   ww w . j ava2 s. c  o  m
        final ArrayList<DumbModel> models = new ArrayList<>(mAdapter.getCount());
        for (int i = 0; i < mAdapter.getCount(); ++i) {
            models.add(mAdapter.getItem(i));
        }
        bundle.putParcelableArrayList(EXTRA_ITEMS, models);
        bundle.putInt(EXTRA_CURRENT_INDEX, mViewHolder.getItemSwitcher().getDisplayedChild());
    } catch (NullPointerException ex) {
        ex.printStackTrace();
    }
}

From source file:org.apache.cordova.sipkita.BluetoothPrinter.java

void beginListenForData() {
    try {/*w w w.  j  a va2 s  .c  o m*/
        RequestHandler rh = new RequestHandler();
        hThread = new Thread(rh);
        hThread.start();
    } catch (NullPointerException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel.OjbMetaCollectionDescriptorNode.java

/**
 * @see OjbMetaTreeNode#_load()// w w w. j a  v a2s  . c o  m
 */
protected boolean _load() {
    java.util.ArrayList newChildren = new java.util.ArrayList();
    ClassDescriptor itemClass = this.getRepository()
            .getDescriptorFor(this.collectionDescriptor.getItemClassName());
    newChildren.add(getOjbMetaTreeModel().getClassDescriptorNodeForClassDescriptor(itemClass));

    // Foreign Key fields retrieved here map to FieldDescriptors of the table in the collection
    System.err.println(toString());
    java.util.Iterator it;
    try {
        it = new ArrayIterator(collectionDescriptor.getFksToThisClass());
        while (it.hasNext())
            newChildren.add(
                    new javax.swing.tree.DefaultMutableTreeNode("FksToThisClass: " + it.next().toString()));
        it = new ArrayIterator(collectionDescriptor.getFksToItemClass());
        while (it.hasNext())
            newChildren.add(
                    new javax.swing.tree.DefaultMutableTreeNode("FksToItemClass: " + it.next().toString()));

    } catch (NullPointerException npe) {
    }
    try {

        it = collectionDescriptor.getForeignKeyFields().iterator();
        while (it.hasNext())
            newChildren.add(new javax.swing.tree.DefaultMutableTreeNode("FkFields: " + it.next().toString()));
    } catch (NullPointerException npe) {
        npe.printStackTrace();
    }
    this.alChildren = newChildren;
    this.getOjbMetaTreeModel().nodeStructureChanged(this);
    return true;
}

From source file:io.github.jeremgamer.editor.panels.Panels.java

public Panels(final JFrame frame, final PanelsPanel pp) {
    this.setBorder(BorderFactory.createTitledBorder(""));

    JButton add = null;//from  w w w . jav a 2 s  .c o  m
    try {
        add = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("add.png"))));
    } catch (IOException e) {
        e.printStackTrace();
    }
    add.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                JOptionPane jop = new JOptionPane();
                @SuppressWarnings("static-access")
                String name = jop.showInputDialog((JFrame) SwingUtilities.windowForComponent(panelList),
                        "Nommez le panneau :", "Crer un panneau", JOptionPane.QUESTION_MESSAGE);

                if (name != null) {
                    for (int i = 0; i < data.getSize(); i++) {
                        if (data.get(i).equals(name)) {
                            name += "1";
                        }
                    }
                    data.addElement(name);
                    new PanelSave(name);
                    PanelsPanel.updateLists();
                    mainPanel.addItem(name);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }

        }

    });

    JButton remove = null;
    try {
        remove = new JButton(new ImageIcon(ImageIO.read(ImageGetter.class.getResource("remove.png"))));
    } catch (IOException e) {
        e.printStackTrace();
    }
    remove.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            try {
                if (panelList.getSelectedValue() != null) {
                    File file = new File("projects/" + Editor.getProjectName() + "/panels/"
                            + panelList.getSelectedValue() + "/" + panelList.getSelectedValue() + ".rbd");
                    JOptionPane jop = new JOptionPane();
                    @SuppressWarnings("static-access")
                    int option = jop.showConfirmDialog((JFrame) SwingUtilities.windowForComponent(panelList),
                            "tes-vous sr de vouloir supprimer ce panneau?", "Avertissement",
                            JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);

                    if (option == JOptionPane.OK_OPTION) {
                        if (panelList.getSelectedValue().equals(pp.getFileName())) {
                            pp.setFileName("");
                        }
                        pp.hide();
                        file.delete();
                        File parent = new File(file.getParent());
                        for (File img : FileUtils.listFiles(parent, TrueFileFilter.INSTANCE,
                                TrueFileFilter.INSTANCE)) {
                            img.delete();
                        }
                        parent.delete();
                        mainPanel.removeItem(panelList.getSelectedValue());
                        data.remove(panelList.getSelectedIndex());
                        ActionPanel.updateLists();
                        PanelsPanel.updateLists();
                    }
                }
            } catch (NullPointerException npe) {
                npe.printStackTrace();
            }

        }

    });

    JPanel buttons = new JPanel();
    buttons.setLayout(new BoxLayout(buttons, BoxLayout.LINE_AXIS));
    buttons.add(add);
    buttons.add(remove);

    mainPanel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            @SuppressWarnings("unchecked")
            JComboBox<String> combo = (JComboBox<String>) event.getSource();
            GeneralSave gs = new GeneralSave();
            try {
                gs.load(new File("projects/" + Editor.getProjectName() + "/general.rbd"));
                gs.set("mainPanel", combo.getSelectedItem());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    });

    updateList();
    panelList.addMouseListener(new MouseAdapter() {
        @SuppressWarnings("unchecked")
        public void mouseClicked(MouseEvent evt) {
            JList<String> list = (JList<String>) evt.getSource();
            if (evt.getClickCount() == 2) {
                int index = list.locationToIndex(evt.getPoint());
                if (isOpen == false) {
                    pp.load(new File("projects/" + Editor.getProjectName() + "/panels/"
                            + list.getModel().getElementAt(index) + "/" + list.getModel().getElementAt(index)
                            + ".rbd"));
                    PanelsPanel.updateLists();
                    pp.show();
                    previousSelection = list.getSelectedValue();
                    isOpen = true;
                } else {
                    try {
                        if (previousSelection.equals(list.getModel().getElementAt(index))) {
                            pp.hide();
                            previousSelection = list.getSelectedValue();
                            list.clearSelection();
                            isOpen = false;
                        } else {
                            pp.hideThenShow();
                            previousSelection = list.getSelectedValue();
                            pp.load(new File("projects/" + Editor.getProjectName() + "/panels/"
                                    + list.getModel().getElementAt(index) + "/"
                                    + list.getModel().getElementAt(index) + ".rbd"));
                            PanelsPanel.updateLists();
                        }
                    } catch (NullPointerException npe) {
                        pp.hide();
                        list.clearSelection();
                    }
                }
            } else if (evt.getClickCount() == 3) {
                int index = list.locationToIndex(evt.getPoint());
                if (isOpen == false) {
                    pp.load(new File("projects/" + Editor.getProjectName() + "/panels/"
                            + list.getModel().getElementAt(index) + "/" + list.getModel().getElementAt(index)
                            + ".rbd"));
                    PanelsPanel.updateLists();
                    pp.show();
                    previousSelection = list.getSelectedValue();
                    isOpen = true;
                } else {
                    try {
                        if (previousSelection.equals(list.getModel().getElementAt(index))) {
                            pp.hide();
                            previousSelection = list.getSelectedValue();
                            list.clearSelection();
                            isOpen = false;
                        } else {
                            pp.hideThenShow();
                            previousSelection = list.getSelectedValue();
                            pp.load(new File("projects/" + Editor.getProjectName() + "/panels/"
                                    + list.getModel().getElementAt(index) + "/"
                                    + list.getModel().getElementAt(index) + ".rbd"));
                            PanelsPanel.updateLists();
                        }
                    } catch (NullPointerException npe) {
                        pp.hide();
                        list.clearSelection();
                    }
                }
            }
        }
    });
    JScrollPane listPane = new JScrollPane(panelList);
    listPane.getVerticalScrollBar().setUnitIncrement(Editor.SCROLL_SPEED);
    this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    this.add(buttons);
    this.add(listPane);

    JPanel mainPanelInput = new JPanel();
    mainPanelInput.setPreferredSize(new Dimension(280, 35));
    mainPanelInput.setMaximumSize(new Dimension(280, 35));
    mainPanelInput.add(new JLabel("Panneau principal:"));
    mainPanel.setPreferredSize(new Dimension(150, 27));
    mainPanelInput.add(mainPanel);
    this.add(mainPanelInput);
}

From source file:com.pemikir.youtubeplus.VideoItemDetailFragment.java

public void updateInfo(VideoInfo info) {
    Activity a = getActivity();//from w w w  .  ja v a 2  s .com
    try {
        ProgressBar progressBar = (ProgressBar) a.findViewById(R.id.detailProgressBar);
        TextView videoTitleView = (TextView) a.findViewById(R.id.detailVideoTitleView);
        TextView uploaderView = (TextView) a.findViewById(R.id.detailUploaderView);
        TextView viewCountView = (TextView) a.findViewById(R.id.detailViewCountView);
        TextView thumbsUpView = (TextView) a.findViewById(R.id.detailThumbsUpCountView);
        TextView thumbsDownView = (TextView) a.findViewById(R.id.detailThumbsDownCountView);
        TextView uploadDateView = (TextView) a.findViewById(R.id.detailUploadDateView);
        TextView descriptionView = (TextView) a.findViewById(R.id.detailDescriptionView);
        ImageView thumbnailView = (ImageView) a.findViewById(R.id.detailThumbnailView);
        ImageView uploaderThumbnailView = (ImageView) a.findViewById(R.id.detailUploaderThumbnailView);
        ImageView thumbsUpPic = (ImageView) a.findViewById(R.id.detailThumbsUpImgView);
        ImageView thumbsDownPic = (ImageView) a.findViewById(R.id.detailThumbsDownImgView);
        View textSeperationLine = a.findViewById(R.id.textSeperationLine);

        if (textSeperationLine != null) {
            textSeperationLine.setVisibility(View.VISIBLE);
        }
        progressBar.setVisibility(View.GONE);
        videoTitleView.setVisibility(View.VISIBLE);
        uploaderView.setVisibility(View.VISIBLE);
        uploadDateView.setVisibility(View.VISIBLE);
        viewCountView.setVisibility(View.VISIBLE);
        thumbsUpView.setVisibility(View.VISIBLE);
        thumbsDownView.setVisibility(View.VISIBLE);
        uploadDateView.setVisibility(View.VISIBLE);
        descriptionView.setVisibility(View.VISIBLE);
        thumbnailView.setVisibility(View.VISIBLE);
        uploaderThumbnailView.setVisibility(View.VISIBLE);
        thumbsUpPic.setVisibility(View.VISIBLE);
        thumbsDownPic.setVisibility(View.VISIBLE);

        switch (info.videoAvailableStatus) {
        case VideoInfo.VIDEO_AVAILABLE: {
            videoTitleView.setText(info.title);
            uploaderView.setText(info.uploader);
            viewCountView.setText(info.view_count + " " + a.getString(R.string.viewSufix));
            thumbsUpView.setText(info.like_count);
            thumbsDownView.setText(info.dislike_count);
            uploadDateView.setText(a.getString(R.string.uploadDatePrefix) + " " + info.upload_date);
            descriptionView.setText(Html.fromHtml(info.description));
            descriptionView.setMovementMethod(LinkMovementMethod.getInstance());

            ActionBarHandler.getHandler().setVideoInfo(info.webpage_url, info.title);

            // parse streams
            Vector<VideoInfo.VideoStream> streamsToUse = new Vector<>();
            for (VideoInfo.VideoStream i : info.videoStreams) {
                if (useStream(i, streamsToUse)) {
                    streamsToUse.add(i);
                }
            }
            VideoInfo.VideoStream[] streamList = new VideoInfo.VideoStream[streamsToUse.size()];
            for (int i = 0; i < streamList.length; i++) {
                streamList[i] = streamsToUse.get(i);
            }
            ActionBarHandler.getHandler().setStreams(streamList, info.audioStreams);
        }
            break;
        case VideoInfo.VIDEO_UNAVAILABLE_GEMA:
            thumbnailView.setImageBitmap(
                    BitmapFactory.decodeResource(getResources(), R.drawable.gruese_die_gema_unangebracht));
            break;
        case VideoInfo.VIDEO_UNAVAILABLE:
            thumbnailView.setImageBitmap(
                    BitmapFactory.decodeResource(getResources(), R.drawable.not_available_monkey));
            break;
        default:
            Log.e(TAG, "Video Availeble Status not known.");
        }

        if (autoPlayEnabled) {
            ActionBarHandler.getHandler().playVideo();
        }
    } catch (java.lang.NullPointerException e) {
        Log.w(TAG, "updateInfo(): Fragment closed before thread ended work... or else");
        e.printStackTrace();
    }
}

From source file:com.mhise.util.MHISEUtil.java

public static String makeNameInUpperCase(String name) {
    StringBuffer updatedName = new StringBuffer();
    try {//  w ww .  j a  v  a 2 s  . co m
        String[] names = name.split(Constants.STR_SEPARATOR_USERNAME);
        Log.e("names length", "" + names.length);
        for (int i = 0; i < names.length; i++) {
            Log.e("names[i].substring(0,1)", "" + names[0]);
            updatedName.append(names[i].substring(0, 1).toUpperCase() + names[i].substring(1) + " ");
        }
    } catch (NullPointerException e) {
        Logger.error("MHISEUtil -->makeNameInUpperCase", "Exception--" + e);
    } catch (ArrayIndexOutOfBoundsException e) {
        e.printStackTrace();
    }
    return updatedName.toString();
}