auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private SortedMap<Path, IOException> deleteAllFilesAndDirectories() throws IOException { if (Files.notExists(dir)) { return Collections.emptySortedMap(); } SortedMap<Path, IOException> failures = new TreeMap<>(); Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) { return deleteAndContinue(file); } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) { return deleteAndContinue(dir); } private FileVisitResult deleteAndContinue(Path path) { try { Files.delete(path); return CONTINUE; } catch (IOException ex) { return deleteUndeletableAndContinue(path, ex); } } private FileVisitResult deleteUndeletableAndContinue(Path path, IOException ex) { boolean isWritable; try { isWritable = path.toFile().setWritable(true); } catch (Exception e) { ex.addSuppressed(e); failures.put(path, ex); return CONTINUE; } if (!isWritable) { ex.addSuppressed( new Exception("Cannot make file " + path + " writable with .toFile().setWritable(true)") { @Override public synchronized Throwable fillInStackTrace() { return this; } }); return CONTINUE; } try { Files.delete(path); } catch (IOException ex2) { ex.addSuppressed(ex2); failures.put(path, ex); } return CONTINUE; } }); return failures; }

Target:
private SortedMap<Path, IOException> deleteAllFilesAndDirectories() throws IOException { if (Files.notExists(dir)) { return Collections.emptySortedMap(); } SortedMap<Path, IOException> failures = new TreeMap<>(); Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) { return deleteAndContinue(file); } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) { return deleteAndContinue(dir); } private FileVisitResult deleteAndContinue(Path path) { try { Files.delete(path); } catch (NoSuchFileException ignore) { } catch (DirectoryNotEmptyException exception) { failures.put(path, exception); } catch (IOException exception) { makeWritableAndTryToDeleteAgain(path, exception); } return CONTINUE; } private void makeWritableAndTryToDeleteAgain(Path path, IOException exception) { try { makeWritable(path); Files.delete(path); } catch (Exception suppressed) { exception.addSuppressed(suppressed); failures.put(path, exception); } } private void makeWritable(Path path) { boolean writable = path.toFile().setWritable(true); if (!writable) { throw new UndeletableFileException("Attempt to make file '" + path + "' writable failed"); } } }); return failures; }
Source:
public void testBucketProbingV1() throws Exception { Configuration configuration = this.getConfiguration(); configuration.setInt(S3A_BUCKET_PROBE, 1); intercept(FileNotFoundException.class, () -> FileSystem.get(uri, configuration)); }

Target:
public void testBucketProbingV1() throws Exception { describe("Test the V1 bucket probe"); Configuration configuration = createConfigurationWithProbe(1); expectUnknownStore( () -> FileSystem.get(uri, configuration)); }
Source:
public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } for (String contact_number : ns.<String>getList("contact")) { m.setContactBlocked(contact_number, true); } if(ns.<String>getList("group") != null) { for (String groupIdString : ns.<String>getList("group")) { try { byte[] groupId = Util.decodeGroupId(groupIdString); m.setGroupBlocked(groupId, true); } catch (GroupIdFormatException | GroupNotFoundException e) { System.err.println(e.getMessage()); } } } return 0; }

Target:
public int handleCommand(final Namespace ns, final Manager m) { if (!m.isRegistered()) { System.err.println("User is not registered."); return 1; } for (String contact_number : ns.<String>getList("contact")) { try { m.setContactBlocked(contact_number, true); } catch (InvalidNumberException e) { System.err.println(e.getMessage()); } } if (ns.<String>getList("group") != null) { for (String groupIdString : ns.<String>getList("group")) { try { byte[] groupId = Util.decodeGroupId(groupIdString); m.setGroupBlocked(groupId, true); } catch (GroupIdFormatException | GroupNotFoundException e) { System.err.println(e.getMessage()); } } } return 0; }
Source:
public void init(final OrganizationalUnit organizationalUnit) { view.init(this); organizationalUnitPopUpPresenter.setup(); view.setup("fa-folder", "fa-folder-open", organizationalUnit, () -> open(organizationalUnit), () -> edit(organizationalUnit), () -> remove(organizationalUnit)); }

Target:
public void init(final OrganizationalUnit organizationalUnit) { view.init(this); view.setup("fa-folder", "fa-folder-open", organizationalUnit, () -> open(organizationalUnit), () -> edit(organizationalUnit), () -> remove(organizationalUnit)); if (!canUpdateOrganizationalUnit(organizationalUnit)) { view.hideEditAction(); } if (!canRemoveOrganizationalUnit(organizationalUnit)) { view.hideRemoveAction(); } }
Source:
public Response get(String url, Map<String, String> headers) throws IOException { try (CloseableHttpClient client = createHttpClient()) { final HttpGet request = new HttpGet(url); addHeaders(headers, request); log.info("Sending request: " + request + " with headers: " + Arrays.asList(request.getAllHeaders())); final HttpResponse response = client.execute(request); return Response.from(response); } }

Target:
public Response get(String url, Map<String, String> headers) throws IOException { try (CloseableHttpClient client = createHttpClient()) { final HttpGet request = new HttpGet(url); addHeaders(headers, request); String message = "Sending request: " + request + " with headers: " + Arrays.asList(request.getAllHeaders()); log.log(PropertySecurityAction.isArquillianDebug() ? Level.INFO : Level.FINE, message); final HttpResponse response = client.execute(request); return Response.from(response); } }
Source:
public static Slice stUnion(@SqlType(GEOMETRY_TYPE_NAME) Slice left, @SqlType(GEOMETRY_TYPE_NAME) Slice right) { OGCGeometry leftGeometry = deserialize(left); OGCGeometry rightGeometry = deserialize(right); OGCGeometry ogcGeometry = leftGeometry.union(rightGeometry); return ogcGeometry == null ? null : serialize(ogcGeometry); }

Target:
public static Slice stUnion(@SqlType(GEOMETRY_TYPE_NAME) Slice left, @SqlType(GEOMETRY_TYPE_NAME) Slice right) { OGCGeometry leftGeometry = deserialize(left); validateType("ST_Union", leftGeometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); if (leftGeometry.isEmpty()) { return right; } OGCGeometry rightGeometry = deserialize(right); validateType("ST_Union", rightGeometry, EnumSet.of(POINT, MULTI_POINT, LINE_STRING, MULTI_LINE_STRING, POLYGON, MULTI_POLYGON)); if (rightGeometry.isEmpty()) { return left; } return serialize(leftGeometry.union(rightGeometry)); }
Source:
protected final void registerAddRevisionDelta(CDOObject object, EStructuralFeature feature, int index, Object value) { final CDOAddFeatureDeltaImpl featureDelta = new CDOAddFeatureDeltaImpl(feature, 0, value); getRevisionDelta(object).addFeatureDelta(featureDelta); }

Target:
protected final void registerAddRevisionDelta(CDOObject object, EStructuralFeature feature, int index, Object value) { final CDOAddFeatureDeltaImpl featureDelta = new CDOAddFeatureDeltaImpl(feature, index, value); getRevisionDelta(object).addFeatureDelta(featureDelta); }
Source:
public InternetDataConnection.BothStreams andOutput() throws IOException { if (connected) throw new RuntimeException("Cannot enable output after having already connected"); return new InternetDataConnection.BothStreams(this, new InternetDataConnection.OutputStreamProvider()); }

Target:
public InternetDataConnection.BothStreams andOutput() throws IOException { if (connected) { throw new RuntimeException("Cannot enable output after having already connected"); } return new InternetDataConnection.BothStreams(this, new InternetDataConnection.OutputStreamProvider()); }
Source:
public void shouldRetrievePermissionWithoutFailure() { assertNotNull(uiPermissionService); String[] permissions = uiPermissionService.getUIPermissions("unExistingType"); assertNotNull(permissions); assertTrue(permissions.length == 0); }

Target:
public void shouldRetrievePermissionWithoutFailure() { assertNotNull(uiPermissionService); String[] permissions = uiPermissionService.getUIPermissions("unExistingType"); assertNotNull(permissions); assertEquals(0, permissions.length); }
Source:
public void testWithCollectionCallbackFindOne() throws Exception { Message<String> message = MessageBuilder.withPayload("").build(); MongoDbOutboundGateway gateway = createGateway(); gateway.setEntityClass(Person.class); gateway.setExpectSingleResult(true); gateway.setCollectionNameExpression(new LiteralExpression("data")); gateway.setRequiresReply(false); gateway.setCollectionCallback(collection -> { collection.insertOne(new Document("name", "Mike")); return null; }); gateway.afterPropertiesSet(); gateway.handleRequestMessage(message); List<Person> persons = this.mongoTemplate.find(new Query(), Person.class, COLLECTION_NAME); assertEquals(5, persons.size()); assertTrue(persons.stream().anyMatch(p -> p.getName().equals("Mike"))); }

Target:
public void testWithCollectionCallbackFindOne() throws Exception { Message<String> message = MessageBuilder.withPayload("").build(); MongoDbOutboundGateway gateway = createGateway(); gateway.setEntityClass(Person.class); gateway.setCollectionNameExpression(new LiteralExpression("data")); gateway.setRequiresReply(false); gateway.setCollectionCallback(collection -> { collection.insertOne(new Document("name", "Mike")); return null; }); gateway.afterPropertiesSet(); gateway.handleRequestMessage(message); List<Person> persons = this.mongoTemplate.find(new Query(), Person.class, COLLECTION_NAME); assertEquals(5, persons.size()); assertTrue(persons.stream().anyMatch(p -> p.getName().equals("Mike"))); }
Source:
private static void assertEmptyCanDoActionMessage() { assertTrue(EXPECTED_EMPTY_CAN_DO_MESSAGE, canDoActionMessages.size() == 0); }

Target:
private void assertEmptyCanDoActionMessage() { assertTrue(EXPECTED_EMPTY_CAN_DO_MESSAGE, canDoActionMessages.isEmpty()); }
Source:
public static boolean isDyeable(Item item) { if (item.equals(Items.dye)) { return true; } Block bl = Block.getBlockFromItem(item); return bl != null && (bl.equals(Blocks.wool) || bl.equals(Blocks.stained_glass) || bl.equals(Blocks.stained_glass_pane) || bl.equals(Blocks.stained_hardened_clay)); }

Target:
public static boolean isDyeable(Item item) { if (item.equals(Items.dye)) { return true; } Block block = Block.getBlockFromItem(item); return block != null && (block.equals(Blocks.wool) || block.equals(Blocks.stained_glass) || block.equals(Blocks.stained_glass_pane) || block.equals(Blocks.stained_hardened_clay)); }
Source:
void setThreshold(int threshold) { this.threshold = threshold; }

Target:
public void setThreshold(int threshold) { this.threshold = threshold; }
Source:
private static void uploadJar(File jarFile, final Path path,final FileSystem fs) throws IOException { log.info("Uploading jar to path[%s]", path); ByteStreams.copy( Files.newInputStreamSupplier(jarFile), new OutputSupplier<OutputStream>() { @Override public OutputStream getOutput() throws IOException { return fs.create(path); } } ); }

Target:
static void uploadJar(File jarFile, final Path path, final FileSystem fs) throws IOException { log.info("Uploading jar to path[%s]", path); ByteStreams.copy( Files.newInputStreamSupplier(jarFile), new OutputSupplier<OutputStream>() { @Override public OutputStream getOutput() throws IOException { return fs.create(path); } } ); }
Source:
public Void invoke(File f, VirtualChannel channel) throws IOException { Util.deleteRecursive(deleting(f)); return null; }

Target:
public Void invoke(File f, VirtualChannel channel) throws IOException { Util.deleteRecursive(fileToPath(f), path -> deleting(path.toFile())); return null; }
Source:
private void loadTrace(final ITmfTrace trace) { if (fZoomThread != null) { fZoomThread.cancel(); fZoomThread = null; } if (fTrace != null) { fFiltersMap.put(fTrace, fTimeGraphViewer.getFilters()); fViewContext.put(fTrace, new ViewContext(fCurrentSortColumn, fSortDirection, fTimeGraphViewer.getSelection(), fTimeGraphViewer.getExpandedElements())); } fTrace = trace; TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "TimeGraphView:LoadingTrace", "trace", trace.getName(), "viewId", getViewId()); restoreViewContext(); fEditorFile = TmfTraceManager.getInstance().getTraceEditorFile(trace); synchronized (fEntryListMap) { fEntryList = fEntryListMap.get(fTrace); if (fEntryList == null) { rebuild(); } else { setTimeBoundsAndRefresh(); } } }

Target:
private void loadTrace(final ITmfTrace trace) { if (fZoomThread != null) { fZoomThread.cancel(); fZoomThread = null; } if (fTrace != null) { fFiltersMap.put(fTrace, fTimeGraphViewer.getFilters()); fViewContext.put(fTrace, new ViewContext(fCurrentSortColumn, fSortDirection, fTimeGraphViewer.getSelection(), fTimeGraphViewer.getAllExpandedElements())); } fTrace = trace; TraceCompassLogUtils.traceInstant(LOGGER, Level.FINE, "TimeGraphView:LoadingTrace", "trace", trace.getName(), "viewId", getViewId()); restoreViewContext(); fEditorFile = TmfTraceManager.getInstance().getTraceEditorFile(trace); synchronized (fEntryListMap) { fEntryList = fEntryListMap.get(fTrace); if (fEntryList == null) { rebuild(); } else { setTimeBoundsAndRefresh(); } } }
Source:
protected DMNExpressionEvaluator compileDecisionTable(DMNCompilerContext ctx, DMNModelImpl model, DMNBaseNode node, String dtName, DecisionTable dt) { String decisionName = ExecModelDMNEvaluatorCompiler.getDecisionTableName(dtName, dt); DTableModel dTableModel = new DTableModel(ctx.getFeelHelper(), model, dtName, decisionName, dt); String evaluatorClassName = dTableModel.getGeneratedClassName(ExecModelDMNEvaluatorCompiler.GeneratorsEnum.EVALUATOR); Optional<String> generatedClass = dmnRuleClassFile.getCompiledClass(evaluatorClassName); return generatedClass.map(gc -> { try { Class<?> evaluatorClass = getRootClassLoader().loadClass(gc); AbstractModelEvaluator evaluatorInstance = (AbstractModelEvaluator) evaluatorClass.newInstance(); String feelExpressionClassName = dTableModel.getGeneratedClassName(ExecModelDMNEvaluatorCompiler.GeneratorsEnum.FEEL_EXPRESSION); Class<?> feelExpressionClass = getRootClassLoader().loadClass(feelExpressionClassName); DTableModel execModelDTableModel = new ExecModelDTableModel(ctx.getFeelHelper(), model, dtName, decisionName, dt, feelExpressionClass); evaluatorInstance.initParameters(ctx, execModelDTableModel, node); logger.debug("Read compiled evaluator from class loader: " + evaluatorClassName); return evaluatorInstance; } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new RuntimeException("Cannot instantiate class" + e); } }).orElseThrow(() -> new RuntimeException("No evaluator class find in file: " + dmnRuleClassFile)); }

Target:
protected DMNExpressionEvaluator compileDecisionTable(DMNCompilerContext ctx, DMNModelImpl model, DMNBaseNode node, String dtName, DecisionTable dt) { String decisionName = ExecModelDMNEvaluatorCompiler.getDecisionTableName(dtName, dt); DTableModel dTableModel = new DTableModel(ctx.getFeelHelper(), model, dtName, decisionName, dt); String evaluatorClassName = dTableModel.getGeneratedClassName(ExecModelDMNEvaluatorCompiler.GeneratorsEnum.EVALUATOR); Optional<String> generatedClass = dmnRuleClassFile.getCompiledClass(evaluatorClassName); return generatedClass.map(gc -> { try { Class<?> evaluatorClass = getRootClassLoader().loadClass(gc); AbstractModelEvaluator evaluatorInstance = (AbstractModelEvaluator) evaluatorClass.newInstance(); String feelExpressionClassName = dTableModel.getGeneratedClassName(ExecModelDMNEvaluatorCompiler.GeneratorsEnum.FEEL_EXPRESSION); Class<?> feelExpressionClass = getRootClassLoader().loadClass(feelExpressionClassName); DTableModel execModelDTableModel = new ExecModelDTableModel(ctx.getFeelHelper(), model, dtName, decisionName, dt, feelExpressionClass); evaluatorInstance.initParameters(ctx, execModelDTableModel, node); logger.debug("Read compiled evaluator from class loader: " + evaluatorClassName); return evaluatorInstance; } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) { throw new RuntimeException("Cannot instantiate class" + e); } }).orElseThrow(() -> new RuntimeException("No evaluator class found in file: " + dmnRuleClassFile)); }
Source:
public Class<?> resolveSuperClassFor(Class<?> eventClass, Class<?> superClass) { if (superClass == null) { ImplementedBy implementedBy = null; final Queue<Class<?>> queue = new ArrayDeque<Class<?>>(); queue.add(eventClass); Class<?> scannedType; while ((scannedType = queue.poll()) != null) { if ((implementedBy = scannedType.getAnnotation(ImplementedBy.class)) != null) { break; } for (Class<?> implInterfaces : scannedType.getInterfaces()) { queue.offer(implInterfaces); } } if (implementedBy != null) { return implementedBy.value(); } throw new RuntimeException("Congratulations. You've attempted to create an event which doesn't have" + "an @ImplementedBy annotation, on itself of any of its superinterfaces." + "If your event extends Event, then, well, something's mess up pretty badly." + "If not: *WHY* aren't you extending Event????"); } return superClass; }

Target:
public Class<?> resolveSuperClassFor(Class<?> eventClass, Class<?> superClass) { if (superClass != null) { return superClass; } ImplementedBy implementedBy = null; final Queue<Class<?>> queue = new ArrayDeque<Class<?>>(); queue.add(eventClass); Class<?> scannedType; while ((scannedType = queue.poll()) != null) { if ((implementedBy = scannedType.getAnnotation(ImplementedBy.class)) != null) { break; } for (Class<?> implInterfaces : scannedType.getInterfaces()) { queue.offer(implInterfaces); } } if (implementedBy != null) { return implementedBy.value(); } throw new RuntimeException("Congratulations. You've attempted to create an event which doesn't have " + "an @ImplementedBy annotation, on itself of any of its superinterfaces. " + "If your event extends Event, then, well, something's mess up pretty badly. " + "If not: *WHY* aren't you extending Event????"); }
Source:
protected void updateDataProvider(List<Job> items) { List<Job> firstRowData = items.isEmpty() ? Arrays.asList(emptyJob) : Arrays.asList(items.get(0)); super.updateDataProvider(firstRowData); }

Target:
protected void updateDataProvider(List<Job> items) { List<Job> firstRowData = items.isEmpty() ? emptyJobList : Arrays.asList(items.get(0)); super.updateDataProvider(firstRowData); }
Source:
public boolean execute() throws Exception { String archivePathArg = requiredArgument(0, Messages.i18n.format("InvalidArgMsg.EntryPath")); String subCommandArg = requiredArgument(1, Messages.i18n.format("UpdateEntry.InvalidArgMsg.SubCommand")); QName varName = new QName("archive", "active-archive"); SrampArchive archive = (SrampArchive) getContext().getVariable(varName); if (archive == null) { print(Messages.i18n.format("NO_ARCHIVE_OPEN")); return false; } else if (archivePathArg.endsWith(File.separator)) { print(Messages.i18n.format("Archive.Path.Arg.should.not.contain.slash.end")); return false; } else { if (!archive.containsEntry(archivePathArg)) { throw new InvalidCommandArgumentException(0, Messages.i18n.format("UpdateEntry.EntryNotFound", archivePathArg)); } if ("setContent".equals(subCommandArg)) { executeSetContent(archive, archivePathArg, getContext()); } if ("setProperty".equals(subCommandArg)) { executeSetProperty(archive, archivePathArg, getContext()); } if ("setRelationship".equals(subCommandArg)) { executeSetRelationship(archive, archivePathArg, getContext()); } } return true; }

Target:
public boolean execute() throws Exception { super.initialize(); String archivePathArg = requiredArgument(0, Messages.i18n.format("InvalidArgMsg.EntryPath")); String subCommandArg = requiredArgument(1, Messages.i18n.format("UpdateEntry.InvalidArgMsg.SubCommand")); if (!validate(archivePathArg)) { return false; } else { if ("setContent".equals(subCommandArg)) { executeSetContent(archive, archivePathArg, getContext()); } if ("setProperty".equals(subCommandArg)) { executeSetProperty(archive, archivePathArg, getContext()); } if ("setRelationship".equals(subCommandArg)) { executeSetRelationship(archive, archivePathArg, getContext()); } } return true; }
Source:
public void addFormatters(FormatterRegistry registry) { registry.addConverter(sortConverter()); registry.addConverter(query()); }

Target:
public void addFormatters(FormatterRegistry registry) { registry.addConverter(sortConverter()); registry.addConverter(queryConverter()); }
Source:
public KijiTable retain() { Preconditions.checkState(mRetainCount.incrementAndGet() >= 0, "Cannot retain a closed KijiTable."); return this; }

Target:
public KijiTable retain() { Preconditions.checkState(mRetainCount.getAndIncrement() >= 0, String.format( "Cannot retain a closed resource: retain counter is %s.", mRetainCount.get())); return this; }
Source:
public static <R> R parsePemContent(CodePointIterator pemContent, BiFunction<String, ByteIterator, R> contentFunction) throws IllegalArgumentException { Assert.checkNotNullParam("pemContent", pemContent); Assert.checkNotNullParam("contentFunction", contentFunction); pemContent = pemContent.skip(Character::isWhitespace).skipCrLf(); if (! pemContent.limitedTo(10).contentEquals("-----BEGIN")) { throw log.malformedPemContent(pemContent.offset()); } String type = pemContent.delimitedBy('-').drainToString().trim(); final Matcher matcher = VALID_LABEL.matcher(type); if (matcher.find()) { throw log.malformedPemContent(matcher.start() + 10); } if (! pemContent.limitedTo(5).contentEquals("-----")) { throw log.malformedPemContent(pemContent.offset()); } final ByteIterator byteIterator = pemContent.delimitedBy('-').base64Decode(); final R result = contentFunction.apply(type, byteIterator); if (! pemContent.limitedTo(8).contentEquals("-----END")) { throw log.malformedPemContent(pemContent.offset()); } if (! pemContent.limitedTo(type.length()).contentEquals(type)) { throw log.malformedPemContent(pemContent.offset()); } if (! pemContent.limitedTo(5).contentEquals("-----")) { throw log.malformedPemContent(pemContent.offset()); } return result; }

Target:
public static <R> R parsePemContent(CodePointIterator pemContent, BiFunction<String, ByteIterator, R> contentFunction) throws IllegalArgumentException { Assert.checkNotNullParam("pemContent", pemContent); Assert.checkNotNullParam("contentFunction", contentFunction); while(true) { if (! pemContent.hasNext()) return null; int cp = pemContent.next(); if (cp == '-') break; if (! Character.isWhitespace(cp)) { throw log.malformedPemContent(pemContent.offset()); } } if (! pemContent.limitedTo(10).contentEquals("----BEGIN ")) { throw log.malformedPemContent(pemContent.offset()); } String type = pemContent.delimitedBy('-').drainToString(); final Matcher matcher = VALID_LABEL.matcher(type); if (matcher.find()) { throw log.malformedPemContent(matcher.start() + 11); } if (! pemContent.limitedTo(5).contentEquals("-----")) { throw log.malformedPemContent(pemContent.offset()); } CodePointIterator delimitedIterator = pemContent.delimitedBy('-').skip(Character::isWhitespace).skipCrLf(); final ByteIterator byteIterator = delimitedIterator.base64Decode(); final R result = contentFunction.apply(type, byteIterator); delimitedIterator.skipAll(); if (! pemContent.limitedTo(9).contentEquals("-----END ")) { throw log.malformedPemContent(pemContent.offset()); } if (! pemContent.limitedTo(type.length()).contentEquals(type)) { throw log.malformedPemContent(pemContent.offset()); } if (! pemContent.limitedTo(5).contentEquals("-----")) { throw log.malformedPemContent(pemContent.offset()); } return result; }
Source:
public void encode(Object object, Type bodyType, RequestTemplate template) { try { JavaType javaType = mapper.getTypeFactory().constructType(bodyType); template.body(mapper.writerFor(javaType).writeValueAsBytes(object), StandardCharsets.UTF_8); } catch (JsonProcessingException e) { throw new EncodeException(e.getMessage(), e); } }

Target:
public void encode(Object object, Type bodyType, RequestTemplate template) { try { JavaType javaType = mapper.getTypeFactory().constructType(bodyType); template.body(mapper.writerFor(javaType).writeValueAsBytes(object), Util.UTF_8); } catch (JsonProcessingException e) { throw new EncodeException(e.getMessage(), e); } }
Source:
public Linkifier(GitilesUrls urls, Config config) { this.urls = checkNotNull(urls, "urls"); List<CommentLinkInfo> list = new ArrayList<>(); list.add(new CommentLinkInfo(HTTP_URL_PATTERN, "$0")); Set<String> subsections = config.getSubsections(COMMENTLINK); List<String> patterns = new ArrayList<>(); patterns.add(HTTP_URL_PATTERN.pattern()); patterns.add(CHANGE_ID_PATTERN.pattern()); for (String subsection : subsections) { String match = config.getString("commentlink", subsection, "match"); String link = config.getString("commentlink", subsection, "link"); String html = config.getString("commentlink", subsection, "html"); if (html != null) System.out.println( "Beware: html in commentlinks is unsupported in gitiles; " + "Did you copy it from a gerrit config?"); checkArgument(!Strings.isNullOrEmpty(match), "invalid commentlink.%s.match", subsection); Pattern compiledPattern = Pattern.compile(match); list.add(new CommentLinkInfo(compiledPattern, link)); patterns.add(match); } this.commentLinks = Collections.unmodifiableList(list); allPattern = Pattern.compile(Joiner.on('|').join(patterns)); }

Target:
public Linkifier(GitilesUrls urls, Config config) { this.urls = checkNotNull(urls, "urls"); List<CommentLinkInfo> list = new ArrayList<>(); list.add(new CommentLinkInfo(HTTP_URL_PATTERN, "$0")); Set<String> subsections = config.getSubsections(COMMENTLINK); List<String> patterns = new ArrayList<>(); patterns.add(HTTP_URL_PATTERN.pattern()); patterns.add(CHANGE_ID_PATTERN.pattern()); for (String subsection : subsections) { String match = config.getString("commentlink", subsection, "match"); String link = config.getString("commentlink", subsection, "link"); String html = config.getString("commentlink", subsection, "html"); if (html != null) log.warn( "Beware: html in commentlinks is unsupported in gitiles; " + "Did you copy it from a gerrit config?"); checkArgument(!Strings.isNullOrEmpty(match), "invalid commentlink.%s.match", subsection); Pattern compiledPattern = Pattern.compile(match); list.add(new CommentLinkInfo(compiledPattern, link)); patterns.add(match); } this.commentLinks = Collections.unmodifiableList(list); allPattern = Pattern.compile(Joiner.on('|').join(patterns)); }
Source:
private boolean sendHeaderPayloads(String path, String host, String schema, URI uri) throws IOException { String[] headerPayloads = { "X-Rewrite-URL: " + path, "X-Original-URL: " + path, "Referer: " + path, "X-Custom-IP-Authorization: 127.0.0.1", "X-Originating-IP: 127.0.0.1", "X-Forwarded-For: 127.0.0.1", "X-Remote-IP: 127.0.0.1", "X-Client-IP: 127.0.0.1", "X-Host: 127.0.0.1", "X-Forwared-Host: 127.0.0.1" }; for (String header : headerPayloads) { String tmpUri = schema + "://" + host; if (header.contains("X-Rewrite-URL")) { tmpUri = tmpUri + "/anything"; } else if (header.contains("X-Original-URL")) { tmpUri = tmpUri + "://" + host + "/"; } else if (header.contains("Referer")) { tmpUri = tmpUri + "://" + host + "/anything"; } else { tmpUri = tmpUri + path; } HttpMessage reqWithPayload = new HttpMessage(new URI(tmpUri, true)); String[] headerPayload = header.split(":"); reqWithPayload.getRequestHeader().setHeader(headerPayload[0], headerPayload[1]); sendAndReceive(reqWithPayload); if (reqWithPayload.getResponseHeader().getStatusCode() == HttpStatusCode.OK) { createAlert(uri.toString(), reqWithPayload).raise(); return true; } } return false; }

Target:
private boolean sendHeaderPayloads(String path, String host, String schema, URI uri) throws IOException { String[] headerPayloads = { "X-Rewrite-URL: " + path, "X-Original-URL: " + path, "Referer: " + path, "X-Custom-IP-Authorization: 127.0.0.1", "X-Originating-IP: 127.0.0.1", "X-Forwarded-For: 127.0.0.1", "X-Remote-IP: 127.0.0.1", "X-Client-IP: 127.0.0.1", "X-Host: 127.0.0.1", "X-Forwared-Host: 127.0.0.1" }; for (String header : headerPayloads) { String tmpUri = schema + "://" + host; if (header.contains("X-Rewrite-URL") || header.contains("Referer")) { tmpUri = tmpUri + "/anything"; } else if (header.contains("X-Original-URL")) { tmpUri = tmpUri + "/"; } else { tmpUri = tmpUri + path; } HttpMessage reqWithPayload = new HttpMessage(new URI(tmpUri, true)); String[] headerPayload = header.split(":"); reqWithPayload.getRequestHeader().setHeader(headerPayload[0], headerPayload[1]); sendAndReceive(reqWithPayload); if (reqWithPayload.getResponseHeader().getStatusCode() == HttpStatusCode.OK) { createAlert(uri.toString(), reqWithPayload, header).raise(); return true; } } return false; }
Source:
public ClientConfiguration getConf() { return conf; }

Target:
protected ClientConfiguration getConf() { return conf; }
Source:
public ResponseEntity putSynonymCatalog(@PathVariable("tenant") final String tenant, @PathVariable("name") final String name, @RequestBody final SynonymCatalogModel synonymCatalogModel) { final TenantContext context = _contextFactory.getContext(tenant); final FileResource resource = new FileResource(getResourceFile(context, name)); resource.write(stream -> { for (final Synonym synonym : synonymCatalogModel.getEntries()) { final List<String> line = new ArrayList<>(synonym.getSynonyms().size() + 1); line.add(synonym.getMasterTerm()); line.addAll(synonym.getSynonyms()); stream.write((Joiner.on(",").join(line) + "\n").getBytes("UTF-8")); } }); final TextFileSynonymCatalog catalog = new TextFileSynonymCatalog(name, resource.getFile(), synonymCatalogModel.isCaseSensitive(), "UTF-8"); _referenceDataDao.removeSynonymCatalog(context, name); _referenceDataDao.addSynonymCatalog(context, catalog); return ResponseEntity.created(ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUri()).build(); }

Target:
public ResponseEntity<Void> putSynonymCatalog(@PathVariable("tenant") final String tenant, @PathVariable("name") final String name, @RequestBody final SynonymCatalogModel synonymCatalogModel) { final TenantContext context = _contextFactory.getContext(tenant); final FileResource resource = new FileResource(getResourceFile(context, name)); resource.write(stream -> { for (final Synonym synonym : synonymCatalogModel.getEntries()) { final List<String> line = new ArrayList<>(synonym.getSynonyms().size() + 1); line.add(synonym.getMasterTerm()); line.addAll(synonym.getSynonyms()); stream.write((Joiner.on(",").join(line) + "\n").getBytes("UTF-8")); } }); final TextFileSynonymCatalog catalog = new TextFileSynonymCatalog(name, resource.getFile(), synonymCatalogModel.isCaseSensitive(), "UTF-8"); _referenceDataDao.removeSynonymCatalog(context, name); _referenceDataDao.addSynonymCatalog(context, catalog); return ResponseEntity.created(ServletUriComponentsBuilder.fromCurrentRequestUri().build().toUri()).build(); }
Source:
public boolean isAvailable() { boolean isAvailable = false; if (!isAvailable) return true; if (!lastAvailable || (lastAvailableDate.before( new Date(System.currentTimeMillis() - AVAILABLE_TIMEOUT_CHECK)))) { WebClient client; Response response; try { client = factory.getWebClient(); response = client.head(); } catch (Exception e) { LOGGER.debug("Web Client was unable to connect to endpoint.", e); return false; } if (response != null && !(response.getStatus() >= 404 || response.getStatus() == 402)) { isAvailable = true; lastAvailableDate = new Date(); } } else { isAvailable = lastAvailable; } lastAvailable = isAvailable; return isAvailable; }

Target:
public boolean isAvailable() { boolean isAvailable = false; if (!lastAvailable || (lastAvailableDate.before( new Date(System.currentTimeMillis() - AVAILABLE_TIMEOUT_CHECK)))) { WebClient client; Response response; try { client = factory.getWebClient(); response = client.head(); } catch (Exception e) { LOGGER.debug("Web Client was unable to connect to endpoint.", e); return false; } if (response != null && !(response.getStatus() >= 404 || response.getStatus() == 402)) { isAvailable = true; lastAvailableDate = new Date(); } } else { isAvailable = lastAvailable; } lastAvailable = isAvailable; return isAvailable; }
Source:
public static <T> T[] filter(T[] array, IUnaryPredicate<T> predicate) { T[] result = array; int resultIndex = 0; for (int i = 0; i < array.length; ++i) { if (predicate.apply(array[i])) { if (result != array) { result[resultIndex] = array[i]; } ++resultIndex; } else { if (result == array) { result = (T[]) Array.newInstance(array.getClass().getComponentType(), array.length - 1); System.arraycopy(array, 0, result, 0, i); } } } return trim(result); }

Target:
public static <T> T[] filter(T[] array, IUnaryPredicate<T> predicate) { T[] result = array; int resultIndex = 0; for (int i = 0; i < array.length; ++i) { if (predicate.apply(array[i])) { if (result != array) { result[resultIndex] = array[i]; } ++resultIndex; } else { if (result == array) { result = Arrays.copyOf(array, array.length - 1); Arrays.fill(result, i, result.length, null); } } } return resultIndex == result.length ? result : Arrays.copyOf(result, resultIndex); }
Source:
public void execute(CommandContext commandContext) { CoreExecution context = null; if (executionId != null) { context = getExecution(); ensureNotNull("Cannot find execution with id '" + executionId + "' referenced from job '" + this + "'", "execution", execution); } else if (caseExecutionId != null) { context = getCaseExecution(); ensureNotNull("Cannot find case execution with id '" + caseExecutionId + "' referenced from job '" + id + "'", caseExecution); } getActivityId(); incrementSequenceCounter(); preExecute(commandContext); JobHandler jobHandler = getJobHandler(); JobHandlerConfiguration configuration = getJobHandlerConfiguration(); ensureNotNull("Cannot find job handler '" + jobHandlerType + "' from job '" + this + "'", "jobHandler", jobHandler); if(execution!=null) jobHandler.execute(configuration, execution, commandContext, tenantId); else if(caseExecution!=null) jobHandler.execute(configuration,caseExecution,commandContext,tenantId); postExecute(commandContext); }

Target:
public void execute(CommandContext commandContext) { CoreExecution context = null; if (executionId != null) { context = getExecution(); ensureNotNull("Cannot find execution with id '" + executionId + "' referenced from job '" + this + "'", "execution", execution); } else if (caseExecutionId != null) { context = getCaseExecution(); ensureNotNull("Cannot find case execution with id '" + caseExecutionId + "' referenced from job '" + id + "'", caseExecution); } getActivityId(); incrementSequenceCounter(); preExecute(commandContext); JobHandler jobHandler = getJobHandler(); JobHandlerConfiguration configuration = getJobHandlerConfiguration(); ensureNotNull("Cannot find job handler '" + jobHandlerType + "' from job '" + this + "'", "jobHandler", jobHandler); jobHandler.execute(configuration, context, commandContext, tenantId); postExecute(commandContext); }
Source:
public void open_withCompressDeflateCapability_shouldEnableCompression() throws Exception { settings.setUseCompression(true); MockImapServer server = new MockImapServer(); simplePreAuthAndLoginDialog(server, "", "COMPRESS=DEFLATE"); server.expect("3 COMPRESS DEFLATE"); server.output("3 OK"); server.enableCompression(); simplePostAuthenticationDialog(server, false, 4); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }

Target:
public void open_withCompressDeflateCapability_shouldEnableCompression() throws Exception { settings.setUseCompression(true); MockImapServer server = new MockImapServer(); simplePreAuthAndLoginDialog(server, "COMPRESS=DEFLATE"); server.expect("3 COMPRESS DEFLATE"); server.output("3 OK"); server.enableCompression(); simplePostAuthenticationDialog(server, 4); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }
Source:
public void testReplaceURLsByAbsolutePaths() throws IOException { String filename = "plouf.png"; FileBlob imageBlob = new FileBlob("image"); imageBlob.setFilename(filename); imageBlob.setMimeType("image/png"); String url = "http://localhost:8080/nuxeo/nxfile/default/3727ef6b-cf8c/files:files/0/file/" + filename; Blob blob = new StringBlob("<h1>Hello World</><img src=\"" + url + "\" />"); blob.setMimeType("text/html"); Function<String, Blob> blobResolver = mock(Function.class); doReturn(imageBlob).when(blobResolver).apply(url); Path tempDirectory = Framework.createTempDirectory("blobs"); Blob newBlob = ConversionServiceImpl.replaceURLsByAbsolutePaths(blob, tempDirectory, blobResolver); String absolutePath = tempDirectory.toString() + "/" + filename; assertEquals("<h1>Hello World</><img src=\"" + absolutePath + "\" />", newBlob.getString()); FileUtils.deleteQuietly(tempDirectory.toFile()); }

Target:
public void testReplaceURLsByAbsolutePaths() throws IOException { String filename = "plouf.png"; FileBlob imageBlob = new FileBlob("image"); imageBlob.setFilename(filename); imageBlob.setMimeType("image/png"); String url = "http://localhost:8080/nuxeo/nxfile/default/3727ef6b-cf8c/files:files/0/file/" + filename; Blob blob = new StringBlob("<h1>Hello World</><img src=\"" + url + "\" />"); blob.setMimeType("text/html"); Function<String, Blob> blobResolver = u -> { return url.equals(u) ? imageBlob : null; }; Path tempDirectory = Framework.createTempDirectory("blobs"); Blob newBlob = ConversionServiceImpl.replaceURLsByAbsolutePaths(blob, tempDirectory, blobResolver); String absolutePath = tempDirectory.toString() + "/" + filename; assertEquals("<h1>Hello World</><img src=\"" + absolutePath + "\" />", newBlob.getString()); FileUtils.deleteQuietly(tempDirectory.toFile()); }
Source:
public static Vector3d worldToLocal(Extent extent, double x, double y, double z) { Stack<Extent> stack = new Stack<Extent>(); while (extent != null) { stack.push(extent); extent = extent.getParent().orNull(); } while (!stack.isEmpty()) { Extent next = stack.pop(); x += next.getOrigin().getX(); y += next.getOrigin().getY(); z += next.getOrigin().getZ(); } return new Vector3d(x, y, z); }

Target:
public static Vector3d worldToLocal(Extent extent, double x, double y, double z) { while (extent != null) { x += extent.getOrigin().getX(); y += extent.getOrigin().getY(); z += extent.getOrigin().getZ(); extent = extent.getParent().orNull(); } return new Vector3d(x, y, z); }
Source:
private boolean categorizeField(Element element) { VariableElement field = (VariableElement) element; if (field.getModifiers().contains(Modifier.STATIC)) { return true; } if (field.getAnnotation(Ignore.class) != null || field.getModifiers().contains(Modifier.TRANSIENT)) { return true; } if (field.getAnnotation(Index.class) != null) { if (!categorizeIndexField(element, field)) { return false; } } if (field.getAnnotation(Required.class) != null) { categorizeRequiredField(element, field); } else { if (!Utils.isPrimitiveType(field) && !Utils.isRealmList(field)) { nullableFields.add(field); } } if (field.getAnnotation(PrimaryKey.class) != null) { if (!categorizePrimaryKeyField(field)) { return false; } } if (field.getAnnotation(LinkingObjects.class) != null) { return categorizeBacklinkField(field); } if (Utils.isRealmInteger(field)) { if (!categorizeMutableRealmIntegerField(field)) { return false; } } fields.add(field); return true; }

Target:
private boolean categorizeField(Element element) { VariableElement field = (VariableElement) element; if (field.getModifiers().contains(Modifier.STATIC)) { return true; } if (field.getAnnotation(Ignore.class) != null || field.getModifiers().contains(Modifier.TRANSIENT)) { return true; } if (field.getAnnotation(Index.class) != null) { if (!categorizeIndexField(element, field)) { return false; } } if (field.getAnnotation(Required.class) != null) { categorizeRequiredField(element, field); } else { if (!Utils.isPrimitiveType(field) && !Utils.isRealmList(field)) { nullableFields.add(field); } } if (field.getAnnotation(PrimaryKey.class) != null) { if (!categorizePrimaryKeyField(field)) { return false; } } if (field.getAnnotation(LinkingObjects.class) != null) { return categorizeBacklinkField(field); } if (Utils.isMutableRealmInteger(field)) { if (!categorizeMutableRealmIntegerField(field)) { return false; } } fields.add(field); return true; }
Source:
private TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, @JsonProperty("statusCode") @Nullable TaskState statusCode, @Deprecated @JsonProperty("status") @Nullable TaskState status, @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, @JsonProperty("errorMsg") @Nullable String errorMsg ) { if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); if (statusCode != null && status == null) { this.state = statusCode; this.status = statusCode; } else if (statusCode == null && status != null) { this.state = status; this.status = status; } else { if (statusCode != null && status != null && statusCode != status) { log.error("statusCode[%s] and status[%s] must be same", statusCode, status); } this.state = statusCode; this.status = status; } this.runnerTaskState = runnerTaskState; this.duration = duration; this.location = Preconditions.checkNotNull(location, "location"); this.dataSource = dataSource; this.errorMsg = errorMsg; }

Target:
public TaskStatusPlus( @JsonProperty("id") String id, @JsonProperty("type") @Nullable String type, @JsonProperty("createdTime") DateTime createdTime, @JsonProperty("queueInsertionTime") DateTime queueInsertionTime, @JsonProperty("statusCode") @Nullable TaskState statusCode, @Deprecated @JsonProperty("status") @Nullable TaskState status, @JsonProperty("runnerStatusCode") @Nullable RunnerTaskState runnerTaskState, @JsonProperty("duration") @Nullable Long duration, @JsonProperty("location") TaskLocation location, @JsonProperty("dataSource") @Nullable String dataSource, @JsonProperty("errorMsg") @Nullable String errorMsg ) { if (statusCode != null && statusCode.isComplete()) { Preconditions.checkNotNull(duration, "duration"); } this.id = Preconditions.checkNotNull(id, "id"); this.type = type; this.createdTime = Preconditions.checkNotNull(createdTime, "createdTime"); this.queueInsertionTime = Preconditions.checkNotNull(queueInsertionTime, "queueInsertionTime"); if (statusCode != null && status == null) { this.statusCode = statusCode; } else if (statusCode == null && status != null) { this.statusCode = status; } else { if (statusCode != null && status != null && statusCode != status) { throw new RuntimeException(StringUtils.format("statusCode[%s] and status[%s] must match", statusCode, status)); } this.statusCode = statusCode; } this.runnerTaskState = runnerTaskState; this.duration = duration; this.location = Preconditions.checkNotNull(location, "location"); this.dataSource = dataSource; this.errorMsg = errorMsg; }
Source:
private void deactivateSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().confirmDeactivateSnapshot() + " - " + getEntity().getName()); model.setHelpTag(HelpTag.volume_deactivate_snapshot_confirmation); model.setHashName("volume_deactivate_snapshot_confirmation"); model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotDeactivate()); UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeactivateSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this); model.getCommands().add(cancelCommand); }

Target:
private void deactivateSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmDeactivateSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_deactivate_snapshot_confirmation); model.setHashName("volume_deactivate_snapshot_confirmation"); model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotDeactivateMessage()); UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeactivateSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }
Source:
public RecipeImpl getRecipe(MachineConfig machineConfig) throws MachineException { URL recipeUrl; File file = null; final String location = machineConfig.getSource().getLocation(); try { UriBuilder targetUriBuilder = UriBuilder.fromUri(location); final String apiEndPointHost = apiEndpoint.getHost(); final String host = UriBuilder.fromUri(location).build().getHost(); if (host.equals(apiEndPointHost)) { if (EnvironmentContext.getCurrent().getSubject() != null && EnvironmentContext.getCurrent().getSubject().getToken() != null) { targetUriBuilder.queryParam("token", EnvironmentContext.getCurrent().getSubject().getToken()); } } recipeUrl = targetUriBuilder.build().toURL(); file = IoUtil.downloadFileWithRedirect(null, "recipe", null, recipeUrl); return new RecipeImpl().withType(machineConfig.getSource().getType()) .withScript(IoUtil.readAndCloseQuietly(new FileInputStream(file))); } catch (IOException | IllegalArgumentException e) { throw new MachineException(format("Can't start machine %s because machine recipe downloading failed. Recipe url %s. Error: %s", machineConfig.getName(), location, e.getLocalizedMessage())); } finally { if (file != null && !file.delete()) { LOG.error(String.format("Removal of recipe file %s failed.", file.getAbsolutePath())); } } }

Target:
public RecipeImpl getRecipe(MachineConfig machineConfig) throws MachineException { URL recipeUrl; File file = null; final String location = machineConfig.getSource().getLocation(); try { UriBuilder targetUriBuilder = UriBuilder.fromUri(location); final String apiEndPointHost = apiEndpoint.getHost(); final String host = targetUriBuilder.build().getHost(); if (apiEndPointHost.equals(host)) { if (EnvironmentContext.getCurrent().getSubject() != null && EnvironmentContext.getCurrent().getSubject().getToken() != null) { targetUriBuilder.queryParam("token", EnvironmentContext.getCurrent().getSubject().getToken()); } } recipeUrl = targetUriBuilder.build().toURL(); file = IoUtil.downloadFileWithRedirect(null, "recipe", null, recipeUrl); return new RecipeImpl().withType(machineConfig.getSource().getType()) .withScript(IoUtil.readAndCloseQuietly(new FileInputStream(file))); } catch (IOException | IllegalArgumentException e) { throw new MachineException(format("Can't start machine %s because machine recipe downloading failed. Recipe url %s. Error: %s", machineConfig.getName(), location, e.getLocalizedMessage())); } finally { if (file != null && !file.delete()) { LOG.error(String.format("Removal of recipe file %s failed.", file.getAbsolutePath())); } } }