Skip to content

Commit

Permalink
Issue 53
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed May 22, 2013
1 parent 8706c8c commit 60db107
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
11 changes: 11 additions & 0 deletions nbactions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>CUSTOM-deploy</actionName>
<displayName>deploy</displayName>
<recursive>false</recursive>
<goals>
<goal>deploy</goal>
</goals>
</action>
</actions>
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
Expand Down Expand Up @@ -177,7 +179,7 @@ interface ArtifactClosure {
*
* @since 2.2.1
*/
@Parameter(property = "project.build.sourceEncoding", readonly = true, required = true)
@Parameter(property = "project.build.sourceEncoding")
private String encoding;

/**
Expand Down Expand Up @@ -474,11 +476,30 @@ public void execute(Artifact artifact) {
return;
}

final StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, Charset.forName(encoding));
Charset charset = null; ;

if( encoding != null ) {
try {
charset = Charset.forName(encoding);
}
catch( IllegalCharsetNameException ex1 ) {
getLog().warn( String.format("the given charset name [%s] is illegal!. default is used", encoding ));
charset = null;
}
catch( UnsupportedCharsetException ex2 ) {
getLog().warn( String.format("the given charset name [%s] is unsupported!. default is used", encoding ));
charset = null;
}
}

final StandardJavaFileManager fileManager =
compiler.getStandardFileManager(null, null,
(charset==null) ?
Charset.defaultCharset() :
charset);

if( files!=null && !files.isEmpty() ) {



for( JavaFileObject f : fileManager.getJavaFileObjectsFromFiles(files) ) {

allSources.add(f);
Expand Down

0 comments on commit 60db107

Please sign in to comment.