3838import com .ibm .g11n .pipeline .client .ResourceEntryData ;
3939import com .ibm .g11n .pipeline .client .ServiceClient ;
4040import com .ibm .g11n .pipeline .client .ServiceException ;
41+ import com .ibm .g11n .pipeline .resfilter .Bundle ;
4142import com .ibm .g11n .pipeline .resfilter .ResourceFilter ;
4243import com .ibm .g11n .pipeline .resfilter .ResourceFilterFactory ;
4344import com .ibm .g11n .pipeline .resfilter .ResourceString ;
@@ -243,17 +244,17 @@ private void mergeTranslation(ServiceClient client, String bundleId, String lang
243244 return ;
244245 }
245246
246- Collection < ResourceString > resStrings = null ;
247+ Bundle resBundle = null ;
247248 try {
248- resStrings = getResourceStrings (client , bundleId , language , false );
249+ resBundle = getBundle (client , bundleId , language , false );
249250 } catch (ServiceException e ) {
250251 throw new MojoFailureException ("Globalization Pipeline service error" , e );
251252 }
252253
253254 ResourceFilter filter = ResourceFilterFactory .get (type );
254255 try (FileOutputStream fos = new FileOutputStream (outFile );
255256 FileInputStream fis = new FileInputStream (srcFile )) {
256- filter .merge (fis , fos , language , resStrings );
257+ filter .merge (fis , fos , language , resBundle );
257258 } catch (IOException e ) {
258259 throw new MojoFailureException ("I/O error while merging the translated values to "
259260 + outFile .getAbsolutePath (), e );
@@ -262,23 +263,23 @@ private void mergeTranslation(ServiceClient client, String bundleId, String lang
262263
263264 private void exportTranslation (ServiceClient client , String bundleId , String language ,
264265 ResourceType type , File outFile , boolean withFallback ) throws MojoFailureException {
265- Collection < ResourceString > resStrings = null ;
266+ Bundle resBundle = null ;
266267 try {
267- resStrings = getResourceStrings (client , bundleId , language , withFallback );
268+ resBundle = getBundle (client , bundleId , language , withFallback );
268269 } catch (ServiceException e ) {
269270 throw new MojoFailureException ("Globalization Pipeline service error" , e );
270271 }
271272
272273 ResourceFilter filter = ResourceFilterFactory .get (type );
273274 try (FileOutputStream fos = new FileOutputStream (outFile )) {
274- filter .write (fos , language , resStrings );
275+ filter .write (fos , language , resBundle );
275276 } catch (IOException e ) {
276277 throw new MojoFailureException ("Failed to write the translated resoruce data to "
277278 + outFile .getAbsolutePath (), e );
278279 }
279280 }
280281
281- private Collection < ResourceString > getResourceStrings (ServiceClient client ,
282+ private Bundle getBundle (ServiceClient client ,
282283 String bundleId , String language , boolean withFallback ) throws ServiceException {
283284 Map <String , ResourceEntryData > resEntries = client .getResourceEntries (bundleId , language );
284285 Collection <ResourceString > resStrings = new LinkedList <>();
@@ -298,6 +299,6 @@ private Collection<ResourceString> getResourceStrings(ServiceClient client,
298299 resStrings .add (resString );
299300 }
300301 }
301- return resStrings ;
302+ return new Bundle ( resStrings , null ) ;
302303 }
303304}
0 commit comments