You can do it in such way: protected UserDetailsService userDetailsService() { return new UserDetailsService() { @Override UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User u = crmService.findUserByUsername(username); return new org.springframework.security.core.userdetails.User( u.getUsername(), u.getPassword(), u.isEnabled(), u.isEnabled(), u.isEnabled(), u.isEnabled(), AuthorityUtils.createAuthorityList("USER", "write")); } } } But definitely you should think about extracting it to normal...
It can only be a problem using threads. The update of the values of a shared variable can be delayed. Make limit volatile or so. It is basically a threading issue, a search on java volatile will point further. Rather silly but threads can have stale values of some variable...
It looks like the problem is due to work done in JDK-7133857, in which java.lang.Math.pow() and java.lang.Math.exp() were intrinsified and calculated using x87. These methods are used extensively (!) in the profiled application and hence their considerable effect. JDK-8029302 describes and fixes the issue for power of 2 inputs; and...
See Underscores in Numeric Literals: In Java SE 7 and later, any number of underscore characters (_) can appear anywhere between digits in a numerical literal. This feature enables you, for example, to separate groups of digits in numeric literals, which can improve the readability of your code. You didn't...
java,concurrency,thread-safety,java-7,concurrenthashmap
So you have two separate atomic instructions which need to be synchronized with. Putting a new queue into the Map Putting an object into the Queue Here are my suggestions. Continue to use a ConcurrentHashMap. You still need to put into the map and you may as well do it...
Why not use an interface for this problem made for interfaces! interface PixelLogic { public int doOperation(); } class BlurLogic implements PixelLogic { @Override public int doOperation() { return // some calculated value } } class SomeClass { public void runPixelOperation(PixelLogic logic) { for(int i = 0; i < height;...
java,generics,java-7,classcastexception
JDK is correct. The declaration promises to return ANY datasource, if it doesnt match there will be only a runtime error. Compiler may show some serious warnings but should compile it. The original developer of your snippet probably intended to avoid an explicit cast on each call. Different ways on...
Does your collection contain null? If so, there is one problem with your comparator: It always returns 0 for null, so null is considered equal to everything. As a result for A > B (premise), you will also have A == null and null == B so by transitivity A...
java,generics,compiler-errors,java-7
Compiles for me fine in java 8. Earlier versions of Java might need more help return retval == null ? Collections.<String>emptyList() : retval; should work. EDIT This is due to improvements in Java 8 type inference as explained here http://openjdk.java.net/jeps/101 And here's a blog with the highlights: http://blog.jooq.org/2013/11/25/a-lesser-known-java-8-feature-generalized-target-type-inference/...
You can add something like this right into your POM: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <configuration> <source>${jdk.version}</source> <target>${jdk.version}</target> </configuration> </plugin> You can find more information on the official Maven Compiler plugin page...
java,java-7,unhandled-exception
In the first case, runnable.run does not throw any checked Exception, so your try/catch and rethrow are not inferred to throw anything checked, hence it compiles In your second case, runnable.call() throws Exception and is handled, but then rethrown. In order to fix the compilation in this case, you...
java,java-7,nio,java-io,filechannel
From the specification of RandomAccessFile.getChannel(): The position of the returned channel will always be equal to this object's file-pointer offset as returned by the getFilePointer method. Changing this object's file-pointer offset, whether explicitly or by reading or writing bytes, will change the position of the channel, and vice versa. Changing...
iterator,set,java-7,java-api,set-union
On the one hand you could use the new Java 8 fluent interface import static java.util.stream.Collectors.toSet; Set<Integer> myUnion = map .values() .stream() .flatMap(set -> set.stream()) .collect(toSet()); On the other hand I would suggest taking a look at Guava's SetMultimap if you can use external libraries....
new SimpleDateFormat("dd-MM-yyyy:HH:mm:ss.sss") You're never printing milliseconds here. Read the javadoc of SimpleDateFormat, or the answers you already got. The pattern for milliseconds is SSS, not sss. sss prints seconds. Note that even in your incorrect test, you got 10 values being printed. And that is a proof that the 10...
java,webview,javafx,java-7,javafx-webengine
According to an comment an this question's answer. You should be able to set a user agent for your Weview with webEngine.setUserAgent(USER_AGENT_STRING). It seems to need JDK8 though. Indeed the JavaFX 2.2 javadoc doesn't contain it, though the JavaFX 8 one does. You may be able to fake something like...
We can above this behavior , replacing in Mule CE Runtime Folder (C:\AnypointStudio\plugins\org.mule.tooling.server.3.5.0_3.5.0.201405141856\mule\lib\opt) the following jars: jaxb-api-2.1 to jaxb-api-2.2.jar jaxb-impl-2.1.9 to jaxb-impl-2.2.7.jar jaxb-xjc-2.1.9 to jaxb-xjc-2.2.7.jar Would be usefull if Mule developers replace this packages to the newest distributions....
java-7,stanford-nlp,eclipse-3.4,lemmatization
The problem in this example is that the word painting can be the present participle of to paint or a noun and the output of the lemmatizer depends on the part-of-speech tag assigned to the original word. If you run the tagger only on the fragment painting, then there is...
Your compareTo method breaks the contract for that method in two ways. 1) Transitivity says that if x.compareTo(y) > 0 and y.compareTo(z) > 0 then x.compareTo(z) > 0. Your method breaks this because 5 > 4 and 4 > 1, but 5>1 is not one of your rules. 2) compareTo...
finalize methods have the problem that they may be called at an arbitrary time by an arbitrary thread or even never at all. And like discussed in this question they may be called surprisingly early, i.e. when instance methods are still being executed, so using them to free a resource...
collections,java-8,java-7,guava,apache-commons-collection
Guava As your [Guava] tag suggests, most Guava collection operations are lazy - they are applied only once needed. For example: List<String> strings = Lists.newArrayList("1", "2", "3"); List<Integer> integers = Lists.transform(strings, new Function<String, Integer>() { @Override public Integer apply(String input) { System.out.println(input); return Integer.valueOf(input); } }); This code seems to...
There is no point of using Filter if you want to read all the files from the directory. Filter is primarily designed to apply some filter criteria and read a subset of files. Both of them may not have any real difference in over all performance. If you looking to...
The documentation is quite clear about this (links are to Java 7, although of course the current version is Java 8): Error: ..Error and its subclasses are regarded as unchecked exceptions for the purposes of compile-time checking of exceptions. (my emphasis) RuntimeException: RuntimeException and its subclasses are unchecked exceptions. (my...
"Str1" is a compile-time constant and that's why case "Str" is fine. However, the from the definition of First_String we can see that it is not a constant, because it can change it's value at any time. You can try setting it as final: public static final String First_String =...
Try this: public static Date copyTimeOnly(Date toDate, Date fromDate) { Calendar toCal = new GregorianCalendar(); toCal.setTime(toDate); Calendar fromCal = new GregorianCalendar(); fromCal.setTime(fromDate); // Copy time only toCal.set(Calendar.HOUR_OF_DAY, fromCal.get(Calendar.HOUR_OF_DAY)); toCal.set(Calendar.MINUTE, fromCal.get(Calendar.MINUTE)); toCal.set(Calendar.SECOND, fromCal.get(Calendar.SECOND)); toCal.set(Calendar.MILLISECOND, fromCal.get(Calendar.MILLISECOND)); return toCal.getTime(); } ...
java,reference,java-7,strong-references
...and extending Reference manually seems like the completely wrong direction. It's worse than that. According to the API: Because reference objects are implemented in close cooperation with the garbage collector, this class may not be subclassed directly. If you want to be able to store multiple different kinds of...
java,java-8,java-7,javadoc,doclet
If you are referring to the doclet, you can turn the doclet off by adding -Xdoclint:none to the command line call to javadoc http://blog.joda.org/2014/02/turning-off-doclint-in-jdk-8-javadoc.html If you just want the old CSS used in Java 7 this other Stack overflow question contains the css you can use instead: JDK8: Getting back...
Luiggi Mendoza pointed me in the right direction. Here's my solution. @WebListener public class Banner implements ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { System.out.println(System.getenv()); } @Override public void contextDestroyed(ServletContextEvent sce) { } } You need servlets 3.0 or greater to use @Weblistener....
Just implement it: Map<String, ArrayList<String>> getReversedMap(Map<String, ArrayList<String>> myMap){ Map<String, ArrayList<String>> result = new HashMap<>(); for(String key : myMap.keySet()){ for(String val : myMap.get(key)){ if(!result.containsKey(val)){ result.put(val, new ArrayList()); } result.get(val).add(key); } } return result; } ...
Over the process of trying to produce an MCVE and author the question, I discovered something interesting: When the test is run at the method level, note the timestamp difference of 1 millisecond. The difference is never less than that: [START: 2015-02-26T11:53:20.581-06:00, STOP: 2015-02-26T11:53:20.641-06:00, DURATION: 0.060] [START: 2015-02-26T11:53:20.582-06:00, STOP: 2015-02-26T11:53:20.642-06:00,...
The oracle java download site was never designed to use SSL. The site in this case is only using SSL because of the HTTPSEverywhere browser plugin that I have installed, which is forcing all Oracle domains to use HTTPS when contacted by my browser. In order to make the download...
As,Dozer is not able to convert String-To-Date - At Field Level Mapping for a List. I had defined a new mapping for the List i.e., considering it as a Object I Changed the DozerMapper.xml <?xml version="1.0" encoding="UTF-8"?> <mappings xmlns="http://dozer.sourceforge.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://dozer.sourceforge.net http://dozer.sourceforge.net/schema/beanmapping.xsd"> <mapping date-format="MM/dd/yyyy HH:mm" map-null="true" map-empty-string="true" wildcard="true"...
java-7,bytecode,java-bytecode-asm,bytecode-manipulation,stackframe
Provided that your bytecode is correct, you can let asm create the frame nodes for you. I usually do it like this: ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES) { @Override protected String getCommonSuperClass(final String type1, final String type2) { // the default asm merge uses Class.forName(), this prevents that. return "java/lang/Object";...
java,concatenation,java-7,varargs,variableargumentlists
There isn't a way around creating a new String[], like so: public String myMethod(String... args) { String[] concatenatedArray = new String[args.length + 1]; concatenatedArray[0] = "other string"; for (int i = 0; i < args.length; i++) { // or System.arraycopy... concatenatedArray[i + 1] = args[i]; } return myOtherMethod(concatenatedArray); } Or,...
java,java-7,indentation,readability,try-with-resources
There is no "right" or "wrong" when aesthetics is involved; and each organization ends up converging on its own coding style. However, it is frequent to borrow coding styles from well-known projects or organizations. One of the most-used Java code-bases is the JDK itself. After a few greps, I found...
java,swing,jscrollpane,java-7,jtextarea
Remove these lines from your code fieldType.setPreferredSize(new Dimension(200, 100)); fieldType.setMaximumSize(new Dimension(200, 100)); import java.awt.CardLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton;...
The problem is that im receiving '\\n' instead of '\n' so then i have different solutions One is make a script using echo -e #!/bin/bash VARIABLE=`echo -e "\n\nsomething\n\nhappens"` java -jar test.jar "$VARIABLE" another solution text = text.replace("\\n","\n"); ...
Solved it! Even after doing all the recommended things it wasn't working. Finally saw a setting in another thread that I hadn't tried till now. Project -> Properties -> Java Build Path -> Libraries -> Add Library -> JRE System Library -> Select Workspace Default (jdk 1.7*) Done. So even...
Let's look at each step: byte[] hashedPassword= Utility.convertCharArrayToByteArray(password, null); The above converts the Unicode-16 characters to a byte-array using the default endcoding, probably WIN-1252 or UTF-8. Since the password contains nothing outside standard 7-bit ASCII, the result is the same for either encoding. hashedPassword = md.digest(hashedPassword); hashedPassword now refers to...
java,swing,java-8,java-7,mousemotionlistener
You have to ensure that the modified Container gets revalidated and repainted afterwards, e.g. by calling the similarly named methods on it. But generally, removing and adding components while a mouse event processing is ongoing, is a bad idea. Thankfully, you don’t have to implement it that complicated. Here is...
Should it be relatively safe to "break" this check? What are the problems I could run into? Yes. I would assume that check is to prevent you from running on earlier versions (or unsupported versions). It could stop working. And, it might violate any support contracts you have. It's...
Use a wildcard upper-bounded by your base class: List<Class<? extends BaseClass>> a = new ArrayList<Class<? extends BaseClass>>(); If you declare it like in your code: List<Class<BaseClass>> a = new ArrayList<Class<BaseClass>>(); it won't work because Class<ClassA> is not a subtype of Class<BaseClass>, even if ClassA extends BaseClass. Demo here: http://ideone.com/SJGEIz...
What I think possibly happened here is that your Path is not appropriately specified in Environment variables. Follow the steps and your problem should be fixed: Cancel the installation (For now) Open up the Control Panel Go to the "System and Security section" Click on "System" On the top left...
java,java-7,windows-7-x64,eclipse-kepler,permgen
You are running a 64bit environment, which has a larger permgen default then the 32bit jre's. You get 30% more permgen, which is around 83 Megs, which in turn matches your values. This is also documented at Oracle's VM param page. Oracle VM Params ...
See if the following works, although I think it should: public class EntityConsumer { public <T extends Entity, M extends EntityContainer<T>> void consum(M container){ } } ...
Use: AssociationChangeNotification.AssocChangeEvent.COMM_UP rather than just COMM_UP to refer to this value - it is an enum value in an inner class of the AssociationChangeNotification class so you must refer to it this way (or use more imports)....
When you call Integer.parse, the conversion of binary string representation is done at runtime, so some CPU cycles are spent to do it; When you use a binary constant, the conversion is done at compile time, so there is no performance hit. Method call takes more characters to write...
Map.replace was first declared in Java 1.8 (see the "since: 1.8" at the bottom). You must be compiling against the 1.8 JDK (even if you're compiling in 1.6 mode). It's possible to do this in an IDE, for instance: to set the language compatibility mode to one version, but compile...
java,java-8,java-7,permgen,metaspace
The main difference from a user perspective - which I think the previous answer does not stress enough - is that Metaspace by default auto increases its size (up to what the underlying OS provides), while PermGen always has a fixed maximum size. You can set a fixed maximum for...
Firstly on windows it's not uncommon for files belonging to another process or thread to prevent the deletion of a file. Secondly what exactly is the purpose of the sequential task in your ANT target? The documentation describes the tasks as follows: Sequential is a container task - it can...
This is an error caused by an invalid JVM command-line parameter. Here's one way to reproduce it: C:\>java -agentpath:D:\Program Files\blahblah Error occurred during initialization of VM Could not find agent library D:\Program in absolute path, with error: Can't find dependent libraries Check Tomcat's Java options. Run %CATALINA_HOME%\bin\tomcat8w.exe as administrator, navigate...
Use the generic version of Matchers.eq(): doReturn(foo).when(bar).myMethod(anyString(), Matchers.<List<Integer>> eq(null)) Using Java 7 you have to add the type witness <List<Integer>> to help the compiler figure this all out. In Java 8, that's not required. For more info on that particular aspect, see the bottom paragraphs of this page....
java,debugging,java-7,close,try-with-resources
See comment of @jb-nizet your decompiler did not show the correct things, which explains your question 1. For question 2 have a look at the Stream.path variable in the debugger. On my System this are not the Streams openend by you but Java 8 internal files like "/opt/Oracle_Java/jdk1.8.0_40/jre/lib/tzdb.dat", "/opt/Oracle_Java/jdk1.8.0_40/jre/lib/meta-index" and...
Which means the InputStreamReader is never closed Eh? In your code it is... And it will certainly handle the .close() of your resource stream as well. See below for more details... As @SotiriosDelimanolis mentions however you can declare more than one resource in the "resource block" of a try-with-resources...
java,intellij-idea,java-8,java-7
No, you shouldn't need to download JDK 7. This is a project level setting. Here is how I do it on IntelliJ IDEA 14, but I suspect it is the same if you are on 13 or 12. Go to Settings->Build,Execution,Deployment->Compiler->Java Compiler. Under that tab you should see a Project-wide...
android,java-7,android-5.0-lollipop
An app built using a previous API level should work the same on future platforms. Just like the Android API is constantly being updated, the JDK is as well. So, the dependencies will increase. It just means that the Android API 21 has dependencies on JDK 7....
The Definition The interface states the following about roots: A root component, that identifies a file system hierarchy, may also be present. So as you see, the comment seems to imply that roots are used for file system hierarchies. Now we have to reason about what an absolute path is....
According to the Java Language Specification, Section 3.10.1, the only integer type suffix for integer literals is L (or lower case l). An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (§4.2.1). The suffix...
The case for java.sql.Connection is that the driver provides the implementation classes for this and other interfaces like java.sql.Statement, java.sql.ResultSet, and on. All the magic of binding the interface to the proper class implementation happens in the method DriverManager#getConnection, which calls an internal method private static Connection getConnection(String url, java.util.Properties...
Simply use public class Whatever<T extends U,U> ...
java,java-7,writer,close,try-with-resources
No, you should not open and close a FileWriter every time you want to append a new line to your log file. You should: open the log file at the start of the application append to it call flush() and finally call close(). or if you want to use the...
java,java-7,guava,diamond-operator
As Jeffrey pointed out, Java's type inference has some quirks. The diamond syntax can be used in place of the full type syntax only when you are calling a constructor of the Object type that you are assigning the variable to. The reason you CAN'T use the diamond syntax the...
hibernate,spring-mvc,tomcat,weblogic,java-7
I fixed this. It is basically due to multiple fetchtype.Eager in the entity class which is creating the problem. You can find full information about the fix in "http://blog.eyallupu.com/2010/06/hibernate-exception-simultaneously.html"
java,generics,java-7,comparable
See javadoc of Object.getClass(), the return type of value.getClass() is Class<? extends |T|>, i.e., Class<? extends Comparable>. The type of expression value.getClass() undergoes wildcard capture before it's used further; therefore we see the captured type Class<capture#2-of ? extends Comparable> in messages. The question surrounding type==Boolean.class, according to JLS#15.21.3, depends on...
In your Marquee class, to animate the nodes you call getContentWidth(), which just gets the width of each node: private int getContentsWidth(){ int width = 0; for(Node node : getChildrenUnmodifiable()){ width += node.boundsInLocalProperty().get().getWidth(); } return width; } Then you instantiate your marquees, and start the animation: Marquee marqueeLeft = new...
I doubt there's an error in File.createNewFile(). I don't yet fully grasp in which order you run your code, but are you aware that this sets the file size to zero? out = new PrintStream("/mnt/testfs.pdf", "UTF-8"); From the PrintStream(File file) Javadoc: file - The file to use as the destination...
java,resources,java-7,try-with-resources
You always have to define a new variable part of try-with-resources block. It is the current limitation of the implementation in Java 7/8. In Java 9 they consider supporting what you asked for natively. You can however use the following small trick: public static void main(String[] args) throws IOException {...
For some people who may had same problem as me, it was simply Java version problem-HIPI must be compiled using Java 1.6 I think I can make later versions of Java to compile HIPI, but I haven't tried it. Instead, I just simply used hipi jar file located in the...
java,regex,unix,operating-system,java-7
Use File.lasModified method to compare file date modification, try this code: public static List<String> getLogFiles(String logLocation, final String pattern, String date) throws ParseException { File logDirectory = new File(logLocation); String[] files = new String[] {}; SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy"); Date d = f.parse(date); long milliseconds = d.getTime(); if (logDirectory.isDirectory())...
Muskan answers was very helpful because gave me a hint to bundle a jre with my application. Actually I've not used launch4j instead I've used exe4j, which is very similar but I've used before. If you decide to use this approach you can find step by step here....
I believe that WebLogic 10.3.5 only supports Suns Java JDK 1.6.0_24+ OR JRockit R28.1.3-1.6.0_24+. It appears as though Weblogic 10.3.5 is not compatible with Java 7, try re-installing/configurring with a Java 6 version installed. Source: Oracle Installation Docs...
When the compiler emits the invokeExact call, it records Object as the expected return type. From the MethodHandle javadoc (emphasis mine): As is usual with virtual methods, source-level calls to invokeExact and invoke compile to an invokevirtual instruction. More unusually, the compiler must record the actual argument types, and may...
java,multithreading,java-7,executorservice,scheduledexecutorservice
The only reasonable conclusion is that you (or the framework) are creating two references of ExecutorTest and executing it twice. Add the identityHashCode of the object to your logging. System.out.printf("Thread -" + Thread.currentThread().getId() + " Current time: %tr with reference: %s%n ", new Date(), System.identityHashCode(ExecutorTest.this)); The same code without changes...
maven,hadoop,build,windows-8.1,java-7
I had the same error. Fixed it by making sure the cmake wasn't the one that comes with cygwin. For some reason, that cmake doesn't recognize Visual Studio.
Instead of floating point division, you can use an integer division with remainder. private static int [] divide(int ... num) { int [] ret = new int[num.length]; int sum = sum(num); int rem = 0; for (int i = 0; i < ret.length; i++) { int count = num[i]*100 +...
java,java-7,try-with-resources,resource-leak
So if while closing an FileInputStream an expression exception is generated, since the expression exception will be suppressed , the resource is not closed... You don't know it isn't closed, just that you got an exception while closing it. ... Will it generate a resource leak ? It may...
Often I find the decision whether to use Guava or not difficult. According to the Guava's own caveats docu, you should refrain from using Guava, if there is no net saving of lines of code or a clear performance benefit. However, in your case I fail to see an easy...
Try this : (?s)new (\w+)<.+>(\(.*?\);) String test = "List<String> t = new ArrayList<String>();"; System.out.println(test.replaceAll("(?s)new (\\w+)<.+>(\\(.*?\\);)", "new $1<>$2")); String test2 = "List<String> t = new ArrayList<String>(getList());"; System.out.println(test2.replaceAll("(?s)new (\\w+)<.+>(\\(.*?\\);)", "new $1<>$2")); String test3 = "List<String> t = new ArrayList<String>(\n\tgetList(\n\t\tanotherMethod()\n\t)\n);";...
java,playframework-2.0,promise,java-7
From play documentation: Maps this promise to a promise of type B. The function function is applied as soon as the promise is redeemed. The function: new Function<Double,Result>() { public Result apply(Double pi) { return ok("PI value computed: " + pi); } } will convert the pi value of type...
We ended up swapping JSCH out for SSHJ. It depends on the BouncyCastle crypto libraries rather than on Java's built-in crypto packages, and is capable of connecting to our server with no problems.
java,generics,java-7,erasure,type-polymorphism
The problem you are having is because the method updateSimple requires all generic types to be T, this means: any but all equal! However you give different types for the generic parameters, respectively. ? (any), Object and ? (does not have to be the same as the one before). So...
java,eclipse,ide,java-7,java-6
Eclipse has its own Java compiler, it does not use the JDK compiler. The 'Preferences > Java > Compiler' preferences set which language level the Eclipse compiler uses. You can also override this for individual projects in the 'Java Compiler' Property page for the project. The 'JRE System Library' setting...
You could try: Objects.hash(field1, field2, Arrays.hashCode(array1), Arrays.hashCode(array2)); This is the same as creating one array that contains field1, field2, the contents of array1 and the contents of array2. Then computing Arrays.hashCode on this array....
java-7,executorservice,java.util.concurrent
This behavior you observe is indeed the expected one. Consider the following: 1) Task3 counts up to Integer.MAX_VALUE - 5000, whereas Task1 and Task2 count up to Long.MAX_VALUE - 5000. All things being equal, this means that Task1 and Task2 will last 2^32 times longer than Task3, that's over 4...
java,java-8,java-7,introspection
Well, the specification clearly says that an IndexedPropertyDescriptor may have additional array based accessor methods, nothing else. That hasn’t changed. What you have here are conflicting property methods defining a simple List<String> typed property and and an indexed String property of the same name. The List based methods were never...
java,exception-handling,java-7
Why compiler reports an error in last case, can't it figure out that FileNotFoundException is special case of IOException? Because FileNotFoundException is a subclass of IOException. In other words, the "FileNotFoundException |" part is redundant. The reason why the code below is ok... } catch(FileNotFoundException e) { ... }...
This error message in client layer code is a consequence of code hardening following "SSL V3.0 Poodle Vulnerability - CVE-2014-3566" in recent Java updates. And it is a bug - here are work-arounds in case you cannot update your JRE immediately: A first option is to force TLS protocol when...
If what you want to display is the time part, what ou need to call is getTimeInstance(), and not getDateInstance(). This is the kind of answer that you should learn to find by yourself, simply by reading the javadoc: Use getDateInstance to get the normal date format for that country....
You can specify return type generic type with: return Sets.<LivingEntity>newHashSet(player); Maybe it would be OK for you to return Set<? extends LivingEntity>, then you can write it as a return type: private Set<? extends LivingEntity> example() { return Sets.newHashSet(player); } ...