Top.Mail.Ru
? ?

Imageru_java


ru_java, posts by tag: tips - LiveJournal

все о языке программирования java


Entries by tag: tips

Возможность запустить любой Java код в контексте любого работающего Java приложения под Windows
sinkhamukha
Imagevolchenok
Java code injection via WinAPI's CreateRemoteThread function.

Интересно, от этого есть какая-нибудь защита на уровне самого Java приложения?
Tags: , ,

Как в JDK 1.6 реализован SQLException.iterator() и как это можно упростить
Image
Imageunix_junkie
Начиная с 1.6, SQLException реализует Iterable; подробности здесь.
    public Iterator<Throwable> iterator() {

       return new Iterator<Throwable>() {

           SQLException firstException = SQLException.this;
           SQLException nextException =
               firstException.getNextException();
           Throwable cause = firstException.getCause();

           public boolean hasNext() {
               if(firstException != null || nextException != null
                       || cause != null)
                   return true;
               return false;
           }

           public Throwable next() {
               Throwable throwable = null;
               if(firstException != null){
                   throwable = firstException;
                   firstException = null;
               }
               else if(cause != null){
                   throwable = cause;
                   cause = cause.getCause();
               }
               else if(nextException != null){
                   throwable = nextException;
                   cause = nextException.getCause();
                   nextException = nextException.getNextException();
               }
               else
                   throw new NoSuchElementException();
               return throwable;
           }

           public void remove() {
               throw new UnsupportedOperationException();
           }

       };

    }
Суровая критикаCollapse )
Tags:

eclipse ide usability
the_man
Imagegrizagufo
немножко про eclipse ide
http://eclipsenuggets.blogspot.com/2007/05/quick-access-ctrl3-is-bliss-are-you-one.html
Tags:

[Tip of the day][Очередное извращение] Return a Property Without System.getProperty
Україна
Imagesmesh
Return a Property Without System.getProperty
On the JVM, System.getProperty() will only return a property if that property has been set using the -D flag. But what if a property has been set using EXPORT on a UNIX platform? Use this code to return the property:

Process p = null;
                try
                {
                        p = Runtime.getRuntime().exec("env");
                        java.util.Properties pr = new java.util.Properties();
                        pr.load(p.getInputStream());
                        System.out.println("Property : " + pr.getProperty(propName));
                }
                catch(Exception e)
                {
                        e.printStackTrace();
                }
>>>
Tags:

Image