Java AES Decryption: random chars & message at the end

I have a problem with decrypting a message using AES. At the end when I expect a message, eg ala123 Instead of that I receive sth like: ...6�b}7�k�8�vFP�8~%��_zժF��FW��O_e���ó������������ala123 The message I pass to encryption is built as: cipher key is SHA-256 from AES_TOKEN cipher IV is some characters, which are then stored in the message (at the beginnig) decrypted message is wrapp

Java AES解密:最后的随机字符和消息

使用AES解密消息时遇到问题。 最后,当我期待一个消息,例如 ala123 而不是我收到某事如: ...6�b}7�k�8�vFP�8~%��_zժF��FW��O_e���ó������������ala123 我传递给加密的消息构建为: 密码密钥是来自AES_TOKEN的SHA-256 密码IV是一些字符,然后存储在消息中(在beginnig处) 解密的消息被包装到Base64中 问题是为什么最终我最终会收到我期望的信息,但是在开始时有很多垃圾信息? 我的加密代码是: private static

Error:java: javacTask: source release 8 requires target release 1.8

Using IntelliJ IDE can't compile any projects. Screenshots of settings below: Used JDK: Project SDK and Language level: Language Level: Anybody have any ideas? File > Settings > Build, Execution, Deployment > Compiler > Java Compiler Change Target bytecode version to 1.8 of the module that you are working for. If you are using Maven Add the compiler plugin to pom.

错误:java:javacTask:源版本8需要目标版本1.8

使用IntelliJ IDE无法编译任何项目。 以下设置的屏幕截图: 使用的JDK: 项目SDK和语言级别: 语言级别: 任何人有任何想法? 文件>设置>构建,执行,部署>编译器> Java编译器 将目标字节码版本更改为您正在使用的模块的1.8 版本 。 如果你使用Maven 将编译器插件添加到顶级project节点下的pom.xml : <build> <plugins> <plugin> <groupId>org.a

Youtube gdata API returning limited results

I'm trying to retrieve the videos returned by the following youtube url using gdata API. https://gdata.youtube.com/feeds/api/users/lyndapodcast/uploads?v=2&max-results=50&start-index=1&q=autodesk If I use the above url, I'm only getting first 4 results, whereas I can see this query produces more results. https://www.youtube.com/user/lyndapodcast/search?query=autodesk I

Youtube gdata API返回有限的结果

我正在尝试使用gdata API检索由以下YouTube网址返回的视频。 https://gdata.youtube.com/feeds/api/users/lyndapodcast/uploads?v=2&max-results=50&start-index=1&q=autodesk 如果我使用上面的url,我只能得到前4个结果,而我可以看到这个查询产生更多结果。 https://www.youtube.com/user/lyndapodcast/search?query=autodesk 有没有不同的方式来构建这个网址? 我正在使用标准的gdata java API。 S

ModeShape rest api: unable to unpublish node

I'm using ModeShape 2.8.2 and JBoss 7.1.1. ModeShape rest server deployed as usual web application. And I have a kind of a stupid question. I can to publish a file - it uploads to the storage and everything is fine. But when I try to unpublish - I have an exception. According to the api I have to provide workspace , path and file as parameters. But is there any examples how to combin

ModeShape rest api:无法取消发布节点

我正在使用ModeShape 2.8.2和JBoss 7.1.1。 ModeShape rest服务器像平常一样部署web应用程序。 我有一个愚蠢的问题。 我可以发布一个文件 - 它上传到存储,一切都很好。 但是当我尝试取消发布时 - 我有一个例外。 根据API我必须提供workspace , path和file作为参数。 但是,有没有例子如何组合path和file参数? 例如,我想在/repo/file path /repo/file发布节点。 以下代码不起作用: File file = new File("file")

NullPointerException in invokeLater while running through Java Webstart

After upgraded from JRE 1.7.0_21 to 1.7.0_25-b15 my application started to throw NullPointerException in SwingUtilities.invokeLater(...) when it is run from Java WebStart. Surprisingly when it is executed as a standalone application (outside JWS), it works great. Here is the top of the stack: Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException at sun.awt.SunToolkit.getSystem

在通过Java Webstart运行时,invokeLater中的NullPointerException

从JRE 1.7.0_21升级到1.7.0_25-b15后,我的应用程序在从Java WebStart运行时,开始在SwingUtilities.invokeLater(...)中抛出NullPointerException。 令人惊讶的是,当它作为独立的应用程序(JWS之外)执行时,效果很好。 这是堆栈的顶部: Exception in thread "AWT-EventQueue-2" java.lang.NullPointerException at sun.awt.SunToolkit.getSystemEventQueueImplPP(SunToolkit.java:1011) at sun.awt.SunToolkit.getSystem

getResource() can't load content in a jar

I can successfully load resources that stand in some package of my src/ dir in eclipse. Now, I export the jar (right click src, export, jar, and keep default settings) and can't have the resource loaded in another eclipse project. I build the path to the resource by indicating a class standing in the same package name: URL out = getClass().getClassLoader().getResource(packageName(getClass

getResource()无法加载jar中的内容

我可以在eclipse中成功加载站在我的src / dir的一些包中的资源。 现在,我导出jar(右键单击src,export,jar,并保留默认设置),并且不能将资源加载到另一个eclipse项目中。 我通过指出站在同一个包名中的类来构建资源的路径: URL out = getClass().getClassLoader().getResource(packageName(getClass())+"file.glsl"); // out is null when loaded from a jar!! protected static String packageName(Class<?>

In org .commons.ziparchiveentry how to give the filename in foreign languages

In ZipArchiveEntry how to define the filename(files that are zipped have name in the foreign language other than english). When i define ZipArchiveEntry ze = new ZipArchiveEntry(filename); It works fine for linux machines but not for windows. please help. update Using ZipArchiveEntry i trying to zip the indivdual files with name in foreign language. After zipped i extract the file from

在org .commons.ziparchiveentry如何给外文件名

在ZipArchiveEntry中如何定义文件名(压缩文件的名称除英文以外的其他语言)。 当我定义 ZipArchiveEntry ze = new ZipArchiveEntry(filename); 它适用于Linux机器,但不适用于Windows。 请帮忙。 更新 使用ZipArchiveEntry我试图用外文名称压缩个人文件。 压缩后,我从该zip文件中提取文件。 在Linux中,它正确地返回文件名。 但在Windows中文件名已损坏 同样使用jdk报告的问题也是如此。 http://bugs.sun.c

How to debug java depenendency failure on version of DOMImplementation

I've a chunk of code that works fine in isolation, but used a dependency in a clients project fails. A call to Document doc = impl.createDocument(null,null,null); fails (looks like the problem at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4913257). The instance of 'impl' in my unit tests is an instance of com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl. In

如何在DOMImplementation版本上调试java depenendency失败

我有一段代码可以独立工作,但是在客户端项目中使用依赖项失败。 打电话给 Document doc = impl.createDocument(null,null,null); 失败(看起来像http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4913257上的问题)。 我的单元测试中的'impl'实例是com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl的一个实例。 在我的客户端代码中,它是org.apache.xerces.dom.DOMImplementationImpl的一

Java App : Unable to read iso

I have a file which is encoded as iso-8859-1, and contains characters such as ô . I am reading this file with java code, something like: File in = new File("myfile.csv"); InputStream fr = new FileInputStream(in); byte[] buffer = new byte[4096]; while (true) { int byteCount = fr.read(buffer, 0, buffer.length); if (byteCount <= 0) { break; } String s = new String(buff

Java应用程序:无法读取ISO

我有一个编码为iso-8859-1的文件,并且包含诸如ô的字符。 我正在用java代码读取此文件,如下所示: File in = new File("myfile.csv"); InputStream fr = new FileInputStream(in); byte[] buffer = new byte[4096]; while (true) { int byteCount = fr.read(buffer, 0, buffer.length); if (byteCount <= 0) { break; } String s = new String(buffer, 0, byteCount,"ISO-8859-1"); System.o

List iterator causes heap allocations?

I'm profiling my android game and surprised to see that: for(O o : myArrayList) { } Creates a bunch of heap allocations. Aside from using a numeric i++ for loop, is there a better way to get around this problem? Can I preallocate my iterators or something? This loop, for(O o : myArrayList) { } gets converted to: for(Iterator<O> iter = myArrayList.iterator()

列表迭代器会导致堆分配?

我正在分析我的Android游戏,并惊讶地发现: for(O o : myArrayList) { } 创建一堆堆分配。 除了使用数字i++ for循环,有没有更好的方法来解决这个问题? 我可以预先分配我的迭代器或其他东西吗? 这个循环, for(O o : myArrayList) { } 被转换为: for(Iterator<O> iter = myArrayList.iterator(); iter.hasNext(); ) { O o = iter.next(); } 所以如果你使用这个模式